Commit 751f4d14 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Georgi Djakov

interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth

Make it possible to set destination as well as source bandwidth. If the
*dst pointer is non-NULL. Right now it appears that we never make the
destination bw allocation call, which is inconsistent with the downstream
way of doing this.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20220707093823.1691870-1-bryan.odonoghue@linaro.orgSigned-off-by: default avatarGeorgi Djakov <djakov@kernel.org>
parent f2906aa8
...@@ -233,10 +233,30 @@ static int qcom_icc_rpm_set(int mas_rpm_id, int slv_rpm_id, u64 sum_bw) ...@@ -233,10 +233,30 @@ static int qcom_icc_rpm_set(int mas_rpm_id, int slv_rpm_id, u64 sum_bw)
return ret; return ret;
} }
static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn,
u64 sum_bw)
{
int ret;
if (!qn->qos.ap_owned) {
/* send bandwidth request message to the RPM processor */
ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw);
if (ret)
return ret;
} else if (qn->qos.qos_mode != -1) {
/* set bandwidth directly from the AP */
ret = qcom_icc_qos_set(n, sum_bw);
if (ret)
return ret;
}
return 0;
}
static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) static int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
{ {
struct qcom_icc_provider *qp; struct qcom_icc_provider *qp;
struct qcom_icc_node *qn; struct qcom_icc_node *src_qn = NULL, *dst_qn = NULL;
struct icc_provider *provider; struct icc_provider *provider;
struct icc_node *n; struct icc_node *n;
u64 sum_bw; u64 sum_bw;
...@@ -246,7 +266,9 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) ...@@ -246,7 +266,9 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
u32 agg_peak = 0; u32 agg_peak = 0;
int ret, i; int ret, i;
qn = src->data; src_qn = src->data;
if (dst)
dst_qn = dst->data;
provider = src->provider; provider = src->provider;
qp = to_qcom_provider(provider); qp = to_qcom_provider(provider);
...@@ -257,21 +279,18 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) ...@@ -257,21 +279,18 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
sum_bw = icc_units_to_bps(agg_avg); sum_bw = icc_units_to_bps(agg_avg);
max_peak_bw = icc_units_to_bps(agg_peak); max_peak_bw = icc_units_to_bps(agg_peak);
if (!qn->qos.ap_owned) { ret = __qcom_icc_set(src, src_qn, sum_bw);
/* send bandwidth request message to the RPM processor */ if (ret)
ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw); return ret;
if (ret) if (dst_qn) {
return ret; ret = __qcom_icc_set(dst, dst_qn, sum_bw);
} else if (qn->qos.qos_mode != -1) {
/* set bandwidth directly from the AP */
ret = qcom_icc_qos_set(src, sum_bw);
if (ret) if (ret)
return ret; return ret;
} }
rate = max(sum_bw, max_peak_bw); rate = max(sum_bw, max_peak_bw);
do_div(rate, qn->buswidth); do_div(rate, src_qn->buswidth);
rate = min_t(u64, rate, LONG_MAX); rate = min_t(u64, rate, LONG_MAX);
for (i = 0; i < qp->num_clks; i++) { for (i = 0; i < qp->num_clks; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment