Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20220707093823.1691870-1-bryan.odonoghue@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>

authored by

Bryan O'Donoghue and committed by
Georgi Djakov
751f4d14 f2906aa8

+30 -11
+30 -11
drivers/interconnect/qcom/icc-rpm.c
··· 233 233 return ret; 234 234 } 235 235 236 + static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn, 237 + u64 sum_bw) 238 + { 239 + int ret; 240 + 241 + if (!qn->qos.ap_owned) { 242 + /* send bandwidth request message to the RPM processor */ 243 + ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw); 244 + if (ret) 245 + return ret; 246 + } else if (qn->qos.qos_mode != -1) { 247 + /* set bandwidth directly from the AP */ 248 + ret = qcom_icc_qos_set(n, sum_bw); 249 + if (ret) 250 + return ret; 251 + } 252 + 253 + return 0; 254 + } 255 + 236 256 static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) 237 257 { 238 258 struct qcom_icc_provider *qp; 239 - struct qcom_icc_node *qn; 259 + struct qcom_icc_node *src_qn = NULL, *dst_qn = NULL; 240 260 struct icc_provider *provider; 241 261 struct icc_node *n; 242 262 u64 sum_bw; ··· 266 246 u32 agg_peak = 0; 267 247 int ret, i; 268 248 269 - qn = src->data; 249 + src_qn = src->data; 250 + if (dst) 251 + dst_qn = dst->data; 270 252 provider = src->provider; 271 253 qp = to_qcom_provider(provider); 272 254 ··· 279 257 sum_bw = icc_units_to_bps(agg_avg); 280 258 max_peak_bw = icc_units_to_bps(agg_peak); 281 259 282 - if (!qn->qos.ap_owned) { 283 - /* send bandwidth request message to the RPM processor */ 284 - ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw); 285 - if (ret) 286 - return ret; 287 - } else if (qn->qos.qos_mode != -1) { 288 - /* set bandwidth directly from the AP */ 289 - ret = qcom_icc_qos_set(src, sum_bw); 260 + ret = __qcom_icc_set(src, src_qn, sum_bw); 261 + if (ret) 262 + return ret; 263 + if (dst_qn) { 264 + ret = __qcom_icc_set(dst, dst_qn, sum_bw); 290 265 if (ret) 291 266 return ret; 292 267 } 293 268 294 269 rate = max(sum_bw, max_peak_bw); 295 270 296 - do_div(rate, qn->buswidth); 271 + do_div(rate, src_qn->buswidth); 297 272 rate = min_t(u64, rate, LONG_MAX); 298 273 299 274 for (i = 0; i < qp->num_clks; i++) {