Skip to contentSkip to conversation

Rework rpm-icc QoS settings

PATCH In review Konrad Dybcio 4 participants 15 messages Mar 26, 2024 – Jun 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Rework rpm-icc QoS settings

Currently, the QoS settings take up a lot of space and are scattered all over the nodes, even though the config is only applied once and it's not a direct property of the nodes themselves.

This series aims to make things better in this regard and contains some fly-by fixes.

More fixes and cleanups uncovered after the making of this coming soon..

Didn't cause any spontaneous explosions on 6115 and 8996.

---
Konrad Dybcio (4):
interconnect: qcom: sm6115: Unspaghettify SNoC QoS port numbering
interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment
interconnect: qcom: icc-rpm: Make simple functions return void
interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

 drivers/interconnect/qcom/icc-rpm.c | 187 ++++++-------
 drivers/interconnect/qcom/icc-rpm.h |  13 +-
 drivers/interconnect/qcom/msm8909.c | 268 ++++++++++---------
 drivers/interconnect/qcom/msm8916.c | 153 ++++++-----
 drivers/interconnect/qcom/msm8939.c | 157 ++++++-----
 drivers/interconnect/qcom/msm8996.c | 517 +++++++++++++++++-------------------
 drivers/interconnect/qcom/qcm2290.c | 416 +++++++++++++++++------------
 drivers/interconnect/qcom/sdm660.c  | 393 +++++++++++++--------------
 drivers/interconnect/qcom/sm6115.c  | 242 ++++++++++++-----
 9 files changed, 1251 insertions(+), 1095 deletions(-)

---
base-commit: 084c8e315db34b59d38d06e684b1a0dd07d30287
change-id: 20240326-topic-rpm_icc_qos_cleanup-bd8958232f39

Best regards,

Signature · 1 line
Konrad Dybcio <[email protected]>
#1 lore raw

PATCH 1/4 interconnect: qcom: sm6115: Unspaghettify SNoC QoS port numbering

When I was creating this driver, my bright mind overlooked the existence of desc->qos_offset and decided to make up for the difference it made by adding 21 (0x15) to the port index on SNoC and its downstream buses.

Undo this mistake to make the indices actually mean something.

---
 drivers/interconnect/qcom/sm6115.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/interconnect/qcom/sm6115.c +18 -15
index 7e15ddf0a80a..271b07c74862 100644
@@ -242,7 +242,7 @@ static struct qcom_icc_node crypto_c0 = {
 	.id = SM6115_MASTER_CRYPTO_CORE0,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 43,
+	.qos.qos_port = 22,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = 23,
@@ -332,7 +332,7 @@ static struct qcom_icc_node qnm_camera_nrt = {
 	.id = SM6115_MASTER_CAMNOC_SF,
 	.channels = 1,
 	.buswidth = 32,
-	.qos.qos_port = 25,
+	.qos.qos_port = 4,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 3,
 	.mas_rpm_id = -1,
@@ -346,7 +346,7 @@ static struct qcom_icc_node qxm_venus0 = {
 	.id = SM6115_MASTER_VIDEO_P0,
 	.channels = 1,
 	.buswidth = 16,
-	.qos.qos_port = 30,
+	.qos.qos_port = 9,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 3,
 	.qos.urg_fwd_en = true,
@@ -361,7 +361,7 @@ static struct qcom_icc_node qxm_venus_cpu = {
 	.id = SM6115_MASTER_VIDEO_PROC,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 34,
+	.qos.qos_port = 13,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 4,
 	.mas_rpm_id = -1,
@@ -379,7 +379,7 @@ static struct qcom_icc_node qnm_camera_rt = {
 	.id = SM6115_MASTER_CAMNOC_HF,
 	.channels = 1,
 	.buswidth = 32,
-	.qos.qos_port = 31,
+	.qos.qos_port = 10,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 3,
 	.qos.urg_fwd_en = true,
@@ -394,7 +394,7 @@ static struct qcom_icc_node qxm_mdp0 = {
 	.id = SM6115_MASTER_MDP_PORT0,
 	.channels = 1,
 	.buswidth = 16,
-	.qos.qos_port = 26,
+	.qos.qos_port = 5,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 3,
 	.qos.urg_fwd_en = true,
@@ -434,7 +434,7 @@ static struct qcom_icc_node qhm_tic = {
 	.id = SM6115_MASTER_TIC,
 	.channels = 1,
 	.buswidth = 4,
-	.qos.qos_port = 29,
+	.qos.qos_port = 8,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = -1,
@@ -484,7 +484,7 @@ static struct qcom_icc_node qxm_pimem = {
 	.id = SM6115_MASTER_PIMEM,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 41,
+	.qos.qos_port = 20,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = -1,
@@ -498,7 +498,7 @@ static struct qcom_icc_node qhm_qdss_bam = {
 	.id = SM6115_MASTER_QDSS_BAM,
 	.channels = 1,
 	.buswidth = 4,
-	.qos.qos_port = 23,
+	.qos.qos_port = 2,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = -1,
@@ -523,7 +523,7 @@ static struct qcom_icc_node qhm_qup0 = {
 	.id = SM6115_MASTER_QUP_0,
 	.channels = 1,
 	.buswidth = 4,
-	.qos.qos_port = 21,
+	.qos.qos_port = 0,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = 166,
@@ -537,7 +537,7 @@ static struct qcom_icc_node qxm_ipa = {
 	.id = SM6115_MASTER_IPA,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 24,
+	.qos.qos_port = 3,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = 59,
@@ -551,7 +551,7 @@ static struct qcom_icc_node xm_qdss_etr = {
 	.id = SM6115_MASTER_QDSS_ETR,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 33,
+	.qos.qos_port = 12,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = -1,
@@ -565,7 +565,7 @@ static struct qcom_icc_node xm_sdc1 = {
 	.id = SM6115_MASTER_SDCC_1,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 38,
+	.qos.qos_port = 17,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = 33,
@@ -579,7 +579,7 @@ static struct qcom_icc_node xm_sdc2 = {
 	.id = SM6115_MASTER_SDCC_2,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 44,
+	.qos.qos_port = 23,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = 35,
@@ -593,7 +593,7 @@ static struct qcom_icc_node xm_usb3_0 = {
 	.id = SM6115_MASTER_USB3,
 	.channels = 1,
 	.buswidth = 8,
-	.qos.qos_port = 45,
+	.qos.qos_port = 24,
 	.qos.qos_mode = NOC_QOS_MODE_FIXED,
 	.qos.areq_prio = 2,
 	.mas_rpm_id = -1,
@@ -1336,6 +1336,7 @@ static const struct qcom_icc_desc sm6115_sys_noc = {
 	.intf_clocks = snoc_intf_clocks,
 	.num_intf_clocks = ARRAY_SIZE(snoc_intf_clocks),
 	.bus_clk_desc = &bus_2_clk,
+	.qos_offset = 0x15000,
 	.keep_alive = true,
 };
 
@@ -1367,6 +1368,7 @@ static const struct qcom_icc_desc sm6115_mmnrt_virt = {
 	.regmap_cfg = &sys_noc_regmap_config,
 	.bus_clk_desc = &mmaxi_0_clk,
 	.keep_alive = true,
+	.qos_offset = 0x15000,
 	.ab_coeff = 142,
 };
 
@@ -1383,6 +1385,7 @@ static const struct qcom_icc_desc sm6115_mmrt_virt = {
 	.regmap_cfg = &sys_noc_regmap_config,
 	.bus_clk_desc = &mmaxi_1_clk,
 	.keep_alive = true,
+	.qos_offset = 0x15000,
 	.ab_coeff = 139,
 };
 
Signature · 1 line
2.44.0
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] interconnect: qcom: sm6115: Unspaghettify SNoC QoS port numbering

Quoted 6 lines · Konrad Dybcio

When I was creating this driver, my bright mind overlooked the existence of desc->qos_offset and decided to make up for the difference it made by adding 21 (0x15) to the port index on SNoC and its downstream buses.

Undo this mistake to make the indices actually mean something.

So, what is the meaning of qos_port?

Quoted 20 lines
---
 drivers/interconnect/qcom/sm6115.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/interconnect/qcom/sm6115.c +1 -1
index 7e15ddf0a80a..271b07c74862 100644
@@ -242,7 +242,7 @@ static struct qcom_icc_node crypto_c0 = {
        .id = SM6115_MASTER_CRYPTO_CORE0,
        .channels = 1,
        .buswidth = 8,
-       .qos.qos_port = 43,
+       .qos.qos_port = 22,
        .qos.qos_mode = NOC_QOS_MODE_FIXED,
        .qos.areq_prio = 2,
        .mas_rpm_id = 23,
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [PATCH 1/4] interconnect: qcom: sm6115: Unspaghettify SNoC QoS port numbering

Quoted 9 lines · Dmitry Baryshkov
Quoted 6 lines · Konrad Dybcio

When I was creating this driver, my bright mind overlooked the existence of desc->qos_offset and decided to make up for the difference it made by adding 21 (0x15) to the port index on SNoC and its downstream buses.

Undo this mistake to make the indices actually mean something.

So, what is the meaning of qos_port?

"The index of the [data?] port that we're applying the QoS settings to"

Konrad

#4 lore raw

PATCH 2/4 interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment

In reply to Konrad Dybcio

The value was wrong, resulting in misprogramming of the hardware. Fix it.

Fixes 1a14b1ac3935 ("interconnect: qcom: Add QCM2290 driver support")
---
 drivers/interconnect/qcom/qcm2290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/qcom/qcm2290.c +1 -1
index 96735800b13c..ba4cc08684d6 100644
@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = {
 	.name = "mas_snoc_bimc",
 	.buswidth = 16,
 	.qos.ap_owned = true,
-	.qos.qos_port = 2,
+	.qos.qos_port = 6,
 	.qos.qos_mode = NOC_QOS_MODE_BYPASS,
 	.mas_rpm_id = 164,
 	.slv_rpm_id = -1,
Signature · 1 line
2.44.0
#5 lore raw

Re: [PATCH 2/4] interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment

Quoted 14 lines · Konrad Dybcio

The value was wrong, resulting in misprogramming of the hardware. Fix it.

Fixes 1a14b1ac3935 ("interconnect: qcom: Add QCM2290 driver support")
---
 drivers/interconnect/qcom/qcm2290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/qcom/qcm2290.c +0 -0
index 96735800b13c..ba4cc08684d6 100644

drivers/interconnect/qcom/qcm2290.c static struct qcom_icc_node mas_snoc_bimc = { · line 169

Quoted 7 lines
drivers/interconnect/qcom/qcm2290.c +1 -1
@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = {
 	.name = "mas_snoc_bimc",
 	.buswidth = 16,
 	.qos.ap_owned = true,
-	.qos.qos_port = 2,
+	.qos.qos_port = 6,
 	.qos.qos_mode = NOC_QOS_MODE_BYPASS,
 	.mas_rpm_id = 164,

The mas_rpm_id is also wrong, I think it should be = 3. This looks wrongly copy pasted from BIMC_NRT. The qos_port on the other hand was copied from BIMC_RT. I wonder how that happened. :')

Thanks,
Stephan

#6 lore raw

Re: [PATCH 2/4] interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment

Quoted 10 lines · Stephan Gerhold
Quoted 9 lines · Konrad Dybcio

The value was wrong, resulting in misprogramming of the hardware. Fix it.

Fixes 1a14b1ac3935 ("interconnect: qcom: Add QCM2290 driver support")
---
 drivers/interconnect/qcom/qcm2290.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/interconnect/qcom/qcm2290.c static struct qcom_icc_node mas_snoc_bimc = { · line 169

Quoted 12 lines
drivers/interconnect/qcom/qcm2290.c +1 -1
index 96735800b13c..ba4cc08684d6 100644
@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = {
 	.name = "mas_snoc_bimc",
 	.buswidth = 16,
 	.qos.ap_owned = true,
-	.qos.qos_port = 2,
+	.qos.qos_port = 6,
 	.qos.qos_mode = NOC_QOS_MODE_BYPASS,
 	.mas_rpm_id = 164,

The mas_rpm_id is also wrong, I think it should be = 3. This looks wrongly copy pasted from BIMC_NRT. The qos_port on the other hand was copied from BIMC_RT. I wonder how that happened. :')

Looks like you're right ;) I'll submit it in a separate series, preferably after this one..

Konrad

#7 lore raw

PATCH 3/4 interconnect: qcom: icc-rpm: Make simple functions return void

In reply to Konrad Dybcio

Register accesses can't just randomly fail. Change the return type of functions that only do that to void.

---
 drivers/interconnect/qcom/icc-rpm.c | 110 +++++++++++++++---------------------
 1 file changed, 47 insertions(+), 63 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +47 -63
index a8ed435f696c..0169de588a46 100644
@@ -50,30 +50,27 @@
 
 #define ICC_BUS_CLK_MIN_RATE		19200ULL /* kHz */
 
-static int qcom_icc_set_qnoc_qos(struct icc_node *src)
+static void qcom_icc_set_qnoc_qos(struct icc_node *src)
 {
 	struct icc_provider *provider = src->provider;
 	struct qcom_icc_provider *qp = to_qcom_provider(provider);
 	struct qcom_icc_node *qn = src->data;
 	struct qcom_icc_qos *qos = &qn->qos;
-	int rc;
-
-	rc = regmap_update_bits(qp->regmap,
-			qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
-			QNOC_QOS_MCTL_DFLT_PRIO_MASK,
-			qos->areq_prio << QNOC_QOS_MCTL_DFLT_PRIO_SHIFT);
-	if (rc)
-		return rc;
-
-	return regmap_update_bits(qp->regmap,
-			qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
-			QNOC_QOS_MCTL_URGFWD_EN_MASK,
-			!!qos->urg_fwd_en << QNOC_QOS_MCTL_URGFWD_EN_SHIFT);
+
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
+			   QNOC_QOS_MCTL_DFLT_PRIO_MASK,
+			   qos->areq_prio << QNOC_QOS_MCTL_DFLT_PRIO_SHIFT);
+
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
+			   QNOC_QOS_MCTL_URGFWD_EN_MASK,
+			   !!qos->urg_fwd_en << QNOC_QOS_MCTL_URGFWD_EN_SHIFT);
 }
 
-static int qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp,
-					struct qcom_icc_qos *qos,
-					int regnum)
+static void qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp,
+					 struct qcom_icc_qos *qos,
+					 int regnum)
 {
 	u32 val;
 	u32 mask;
@@ -90,19 +87,18 @@ static int qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp,
 		mask |= M_BKE_HEALTH_CFG_LIMITCMDS_MASK;
 	}
 
-	return regmap_update_bits(qp->regmap,
-				  qp->qos_offset + M_BKE_HEALTH_CFG_ADDR(regnum, qos->qos_port),
-				  mask, val);
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + M_BKE_HEALTH_CFG_ADDR(regnum, qos->qos_port),
+			   mask, val);
 }
 
-static int qcom_icc_set_bimc_qos(struct icc_node *src)
+static void qcom_icc_set_bimc_qos(struct icc_node *src)
 {
 	struct qcom_icc_provider *qp;
 	struct qcom_icc_node *qn;
 	struct icc_provider *provider;
 	u32 mode = NOC_QOS_MODE_BYPASS;
 	u32 val = 0;
-	int i, rc = 0;
 
 	qn = src->data;
 	provider = src->provider;
@@ -115,48 +111,42 @@ static int qcom_icc_set_bimc_qos(struct icc_node *src)
 	 * only if we are NOT in Bypass Mode.
 	 */
 	if (mode != NOC_QOS_MODE_BYPASS) {
-		for (i = 3; i >= 0; i--) {
-			rc = qcom_icc_bimc_set_qos_health(qp,
-							  &qn->qos, i);
-			if (rc)
-				return rc;
-		}
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 3);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 2);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 1);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 0);
 
 		/* Set BKE_EN to 1 when Fixed, Regulator or Limiter Mode */
 		val = 1;
 	}
 
-	return regmap_update_bits(qp->regmap,
-				  qp->qos_offset + M_BKE_EN_ADDR(qn->qos.qos_port),
-				  M_BKE_EN_EN_BMASK, val);
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + M_BKE_EN_ADDR(qn->qos.qos_port),
+			   M_BKE_EN_EN_BMASK, val);
 }
 
-static int qcom_icc_noc_set_qos_priority(struct qcom_icc_provider *qp,
+static void qcom_icc_noc_set_qos_priority(struct qcom_icc_provider *qp,
 					 struct qcom_icc_qos *qos)
 {
 	u32 val;
-	int rc;
 
 	/* Must be updated one at a time, P1 first, P0 last */
 	val = qos->areq_prio << NOC_QOS_PRIORITY_P1_SHIFT;
-	rc = regmap_update_bits(qp->regmap,
-				qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
-				NOC_QOS_PRIORITY_P1_MASK, val);
-	if (rc)
-		return rc;
-
-	return regmap_update_bits(qp->regmap,
-				  qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
-				  NOC_QOS_PRIORITY_P0_MASK, qos->prio_level);
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
+			   NOC_QOS_PRIORITY_P1_MASK, val);
+
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
+			   NOC_QOS_PRIORITY_P0_MASK, qos->prio_level);
 }
 
-static int qcom_icc_set_noc_qos(struct icc_node *src)
+static void qcom_icc_set_noc_qos(struct icc_node *src)
 {
 	struct qcom_icc_provider *qp;
 	struct qcom_icc_node *qn;
 	struct icc_provider *provider;
 	u32 mode = NOC_QOS_MODE_BYPASS_VAL;
-	int rc = 0;
 
 	qn = src->data;
 	provider = src->provider;
@@ -166,15 +156,12 @@ static int qcom_icc_set_noc_qos(struct icc_node *src)
 		dev_dbg(src->provider->dev,
 			"NoC QoS: Skipping %s: vote aggregated on parent.\n",
 			qn->name);
-		return 0;
 	}
 
 	if (qn->qos.qos_mode == NOC_QOS_MODE_FIXED) {
 		dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", qn->name);
 		mode = NOC_QOS_MODE_FIXED_VAL;
-		rc = qcom_icc_noc_set_qos_priority(qp, &qn->qos);
-		if (rc)
-			return rc;
+		qcom_icc_noc_set_qos_priority(qp, &qn->qos);
 	} else if (qn->qos.qos_mode == NOC_QOS_MODE_BYPASS) {
 		dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", qn->name);
 		mode = NOC_QOS_MODE_BYPASS_VAL;
@@ -182,12 +169,12 @@ static int qcom_icc_set_noc_qos(struct icc_node *src)
 		/* How did we get here? */
 	}
 
-	return regmap_update_bits(qp->regmap,
-				  qp->qos_offset + NOC_QOS_MODEn_ADDR(qn->qos.qos_port),
-				  NOC_QOS_MODEn_MASK, mode);
+	regmap_update_bits(qp->regmap,
+			   qp->qos_offset + NOC_QOS_MODEn_ADDR(qn->qos.qos_port),
+			   NOC_QOS_MODEn_MASK, mode);
 }
 
-static int qcom_icc_qos_set(struct icc_node *node)
+static void qcom_icc_qos_set(struct icc_node *node)
 {
 	struct qcom_icc_provider *qp = to_qcom_provider(node->provider);
 	struct qcom_icc_node *qn = node->data;
@@ -196,11 +183,14 @@ static int qcom_icc_qos_set(struct icc_node *node)
 
 	switch (qp->type) {
 	case QCOM_ICC_BIMC:
-		return qcom_icc_set_bimc_qos(node);
+		qcom_icc_set_bimc_qos(node);
+		break;
 	case QCOM_ICC_QNOC:
-		return qcom_icc_set_qnoc_qos(node);
+		qcom_icc_set_qnoc_qos(node);
+		break;
 	default:
-		return qcom_icc_set_noc_qos(node);
+		qcom_icc_set_noc_qos(node);
+		break;
 	}
 }
 
@@ -586,14 +576,8 @@ int qnoc_probe(struct platform_device *pdev)
 
 		/* Set QoS registers (we only need to do it once, generally) */
 		if (qnodes[i]->qos.ap_owned &&
-		    qnodes[i]->qos.qos_mode != NOC_QOS_MODE_INVALID) {
-			ret = qcom_icc_qos_set(node);
-			if (ret) {
-				clk_bulk_disable_unprepare(qp->num_intf_clks,
-							   qp->intf_clks);
-				goto err_remove_nodes;
-			}
-		}
+		    qnodes[i]->qos.qos_mode != NOC_QOS_MODE_INVALID)
+			qcom_icc_qos_set(node);
 
 		data->nodes[i] = node;
 	}
Signature · 1 line
2.44.0
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] interconnect: qcom: icc-rpm: Make simple functions return void

Quoted 8 lines · Konrad Dybcio

Register accesses can't just randomly fail. Change the return type of functions that only do that to void.

---
 drivers/interconnect/qcom/icc-rpm.c | 110 +++++++++++++++---------------------
 1 file changed, 47 insertions(+), 63 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#9 lore raw

Re: [PATCH 3/4] interconnect: qcom: icc-rpm: Make simple functions return void

In reply to Konrad Dybcio
Quoted 8 lines · Konrad Dybcio

Register accesses can't just randomly fail. Change the return type of functions that only do that to void.

---
 drivers/interconnect/qcom/icc-rpm.c | 110 +++++++++++++++---------------------
 1 file changed, 47 insertions(+), 63 deletions(-)

[...]

Quoted 4 lines
drivers/interconnect/qcom/icc-rpm.c +0 -0
@@ -115,48 +111,42 @@ static int qcom_icc_set_bimc_qos(struct icc_node *src)
 	 * only if we are NOT in Bypass Mode.
 	 */
 	if (mode != NOC_QOS_MODE_BYPASS) {

drivers/interconnect/qcom/icc-rpm.c static int qcom_icc_set_bimc_qos(struct icc_node *src) · line 117

Quoted 10 lines
drivers/interconnect/qcom/icc-rpm.c +4 -6
-		for (i = 3; i >= 0; i--) {
-			rc = qcom_icc_bimc_set_qos_health(qp,
-							  &qn->qos, i);
-			if (rc)
-				return rc;
-		}
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 3);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 2);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 1);
+		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 0);

Not sure I see the point of unrolling this loop. With the error checking removed, the loop could be reduced to just two lines, which is shorter than the unrolled version and isn't really any more complicated:

	for (i = 3; i >= 0; i--)
		qcom_icc_bimc_set_qos_health(qp, &qn->qos, i);

Unrolling the loop is also slightly out-of-scope for this patch that claims to just change the return types.

Otherwise, patch looks good to me.

#10 lore raw

PATCH 4/4 interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

In reply to Konrad Dybcio

Currently, the QoS settings are stored in the node data, even though they're a property of the bus/provider instead. Moreover, they are only needed during the probe step, so they can be easily moved into struct qcom_icc_desc.

Reshuffle things around to make it anywhere near readable & comparable with a reference. As a nice bonus, a lot of bytes are shaved off and a few miliseconds are shaved off here and there.

As an example, bloat-o-meter reports this on sm6115.o:
Total: Before=14799, After=13263, chg -10.38%

---
 drivers/interconnect/qcom/icc-rpm.c | 123 +++++----
 drivers/interconnect/qcom/icc-rpm.h |  13 +-
 drivers/interconnect/qcom/msm8909.c | 268 ++++++++++---------
 drivers/interconnect/qcom/msm8916.c | 153 ++++++-----
 drivers/interconnect/qcom/msm8939.c | 157 ++++++-----
 drivers/interconnect/qcom/msm8996.c | 517 +++++++++++++++++-------------------
 drivers/interconnect/qcom/qcm2290.c | 416 +++++++++++++++++------------
 drivers/interconnect/qcom/sdm660.c  | 393 +++++++++++++--------------
 drivers/interconnect/qcom/sm6115.c  | 239 ++++++++++++-----
 9 files changed, 1224 insertions(+), 1055 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +61 -62
index 0169de588a46..3f71a18af7db 100644
@@ -50,26 +50,24 @@
 
 #define ICC_BUS_CLK_MIN_RATE		19200ULL /* kHz */
 
-static void qcom_icc_set_qnoc_qos(struct icc_node *src)
+static void qcom_icc_set_qnoc_qos(struct qcom_icc_provider *qp,
+				  const struct qcom_icc_qos_data *qos,
+				  unsigned int qos_off)
 {
-	struct icc_provider *provider = src->provider;
-	struct qcom_icc_provider *qp = to_qcom_provider(provider);
-	struct qcom_icc_node *qn = src->data;
-	struct qcom_icc_qos *qos = &qn->qos;
-
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
+			   qos_off + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
 			   QNOC_QOS_MCTL_DFLT_PRIO_MASK,
 			   qos->areq_prio << QNOC_QOS_MCTL_DFLT_PRIO_SHIFT);
 
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
+			   qos_off + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port),
 			   QNOC_QOS_MCTL_URGFWD_EN_MASK,
 			   !!qos->urg_fwd_en << QNOC_QOS_MCTL_URGFWD_EN_SHIFT);
 }
 
 static void qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp,
-					 struct qcom_icc_qos *qos,
+					 const struct qcom_icc_qos_data *qos,
+					 unsigned int qos_off,
 					 int regnum)
 {
 	u32 val;
@@ -88,108 +86,105 @@ static void qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp,
 	}
 
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + M_BKE_HEALTH_CFG_ADDR(regnum, qos->qos_port),
+			   qos_off + M_BKE_HEALTH_CFG_ADDR(regnum, qos->qos_port),
 			   mask, val);
 }
 
-static void qcom_icc_set_bimc_qos(struct icc_node *src)
+static void qcom_icc_set_bimc_qos(struct qcom_icc_provider *qp,
+				  const struct qcom_icc_qos_data *qos,
+				  unsigned int qos_off)
 {
-	struct qcom_icc_provider *qp;
-	struct qcom_icc_node *qn;
-	struct icc_provider *provider;
-	u32 mode = NOC_QOS_MODE_BYPASS;
+	u32 mode = qos->qos_mode;
 	u32 val = 0;
 
-	qn = src->data;
-	provider = src->provider;
-	qp = to_qcom_provider(provider);
-
-	if (qn->qos.qos_mode != NOC_QOS_MODE_INVALID)
-		mode = qn->qos.qos_mode;
-
 	/* QoS Priority: The QoS Health parameters are getting considered
 	 * only if we are NOT in Bypass Mode.
 	 */
 	if (mode != NOC_QOS_MODE_BYPASS) {
-		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 3);
-		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 2);
-		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 1);
-		qcom_icc_bimc_set_qos_health(qp, &qn->qos, 0);
+		qcom_icc_bimc_set_qos_health(qp, qos, qos_off, 3);
+		qcom_icc_bimc_set_qos_health(qp, qos, qos_off, 2);
+		qcom_icc_bimc_set_qos_health(qp, qos, qos_off, 1);
+		qcom_icc_bimc_set_qos_health(qp, qos, qos_off, 0);
 
 		/* Set BKE_EN to 1 when Fixed, Regulator or Limiter Mode */
 		val = 1;
 	}
 
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + M_BKE_EN_ADDR(qn->qos.qos_port),
+			   qos_off + M_BKE_EN_ADDR(qos->qos_port),
 			   M_BKE_EN_EN_BMASK, val);
 }
 
 static void qcom_icc_noc_set_qos_priority(struct qcom_icc_provider *qp,
-					 struct qcom_icc_qos *qos)
+					  const struct qcom_icc_qos_data *qos,
+					  unsigned int qos_off)
 {
 	u32 val;
 
 	/* Must be updated one at a time, P1 first, P0 last */
 	val = qos->areq_prio << NOC_QOS_PRIORITY_P1_SHIFT;
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
+			   qos_off + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
 			   NOC_QOS_PRIORITY_P1_MASK, val);
 
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
+			   qos_off + NOC_QOS_PRIORITYn_ADDR(qos->qos_port),
 			   NOC_QOS_PRIORITY_P0_MASK, qos->prio_level);
 }
 
-static void qcom_icc_set_noc_qos(struct icc_node *src)
+static void qcom_icc_set_noc_qos(struct qcom_icc_provider *qp,
+				 const struct qcom_icc_qos_data *qos,
+				 unsigned int qos_off,
+				 int idx)
 {
-	struct qcom_icc_provider *qp;
-	struct qcom_icc_node *qn;
-	struct icc_provider *provider;
 	u32 mode = NOC_QOS_MODE_BYPASS_VAL;
 
-	qn = src->data;
-	provider = src->provider;
-	qp = to_qcom_provider(provider);
-
-	if (qn->qos.qos_port < 0) {
-		dev_dbg(src->provider->dev,
-			"NoC QoS: Skipping %s: vote aggregated on parent.\n",
-			qn->name);
+	if (qos->qos_port < 0) {
+		dev_dbg(qp->provider.dev,
+			"NoC QoS: Skipping setting[%i] aggregated on parent.\n",
+			idx);
 	}
 
-	if (qn->qos.qos_mode == NOC_QOS_MODE_FIXED) {
-		dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", qn->name);
+	if (qos->qos_mode == NOC_QOS_MODE_FIXED) {
+		dev_dbg(qp->provider.dev, "NoC QoS[%i] (port %i): Set Fixed mode\n",
+			idx, qos->qos_port);
 		mode = NOC_QOS_MODE_FIXED_VAL;
-		qcom_icc_noc_set_qos_priority(qp, &qn->qos);
-	} else if (qn->qos.qos_mode == NOC_QOS_MODE_BYPASS) {
-		dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", qn->name);
+		qcom_icc_noc_set_qos_priority(qp, qos, qos_off);
+	} else if (qos->qos_mode == NOC_QOS_MODE_BYPASS) {
+		dev_dbg(qp->provider.dev, "NoC QoS[%i] (port %i): Set Bypass mode\n",
+			idx, qos->qos_port);
 		mode = NOC_QOS_MODE_BYPASS_VAL;
 	} else {
 		/* How did we get here? */
 	}
 
 	regmap_update_bits(qp->regmap,
-			   qp->qos_offset + NOC_QOS_MODEn_ADDR(qn->qos.qos_port),
+			   qos_off + NOC_QOS_MODEn_ADDR(qos->qos_port),
 			   NOC_QOS_MODEn_MASK, mode);
 }
 
-static void qcom_icc_qos_set(struct icc_node *node)
+static void qcom_icc_qos_set(struct qcom_icc_provider *qp,
+			     const struct qcom_icc_desc *desc,
+			     int idx)
 {
-	struct qcom_icc_provider *qp = to_qcom_provider(node->provider);
-	struct qcom_icc_node *qn = node->data;
+	const struct qcom_icc_qos_data *qos = &desc->qos_data[idx];
+	unsigned int qos_off = desc->qos_offset;
 
-	dev_dbg(node->provider->dev, "Setting QoS for %s\n", qn->name);
+	dev_dbg(qp->provider.dev, "Setting QoS data[%i] (port %i)\n", idx, qos->qos_port);
+
+	/* Sanity check the QoS settings data */
+	if (WARN_ON_ONCE(qos->qos_mode == NOC_QOS_MODE_INVALID))
+		return;
 
 	switch (qp->type) {
 	case QCOM_ICC_BIMC:
-		qcom_icc_set_bimc_qos(node);
+		qcom_icc_set_bimc_qos(qp, qos, qos_off);
 		break;
 	case QCOM_ICC_QNOC:
-		qcom_icc_set_qnoc_qos(node);
+		qcom_icc_set_qnoc_qos(qp, qos, qos_off);
 		break;
 	default:
-		qcom_icc_set_noc_qos(node);
+		qcom_icc_set_noc_qos(qp, qos, qos_off, idx);
 		break;
 	}
 }
@@ -199,7 +194,8 @@ static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw)
 	int ret, rpm_ctx = 0;
 	u64 bw_bps;
 
-	if (qn->qos.ap_owned)
+	/* Some nodes are managed by another IP block(s) */
+	if (qn->ap_owned)
 		return 0;
 
 	for (rpm_ctx = 0; rpm_ctx < QCOM_SMD_RPM_STATE_NUM; rpm_ctx++) {
@@ -500,7 +496,6 @@ int qnoc_probe(struct platform_device *pdev)
 
 	qp->keep_alive = desc->keep_alive;
 	qp->type = desc->type;
-	qp->qos_offset = desc->qos_offset;
 
 	if (desc->regmap_cfg) {
 		struct resource *res;
@@ -574,15 +569,19 @@ int qnoc_probe(struct platform_device *pdev)
 		for (j = 0; j < qnodes[i]->num_links; j++)
 			icc_link_create(node, qnodes[i]->links[j]);
 
-		/* Set QoS registers (we only need to do it once, generally) */
-		if (qnodes[i]->qos.ap_owned &&
-		    qnodes[i]->qos.qos_mode != NOC_QOS_MODE_INVALID)
-			qcom_icc_qos_set(node);
-
 		data->nodes[i] = node;
 	}
 	data->num_nodes = num_nodes;
 
+	/*
+	 * Set QoS registers (we only need to do it once, generally).
+	 * Porting note: if a node has QoS data, but it's not marked as
+	 * ap_owned, it's likely an erronous artifact of some autogen tools,
+	 * ignore such config entries.
+	 */
+	for (i = 0; i < desc->qos_data_num; i++)
+		qcom_icc_qos_set(qp, desc, i);
+
 	clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks);
 
 	ret = icc_provider_register(provider);
drivers/interconnect/qcom/icc-rpm.h +6 -7
index f4883d43eae4..ecce8f8a75e6 100644
@@ -43,7 +43,6 @@ struct rpm_clk_resource {
  * @num_intf_clks: the total number of intf_clks clk_bulk_data entries
  * @type: the ICC provider type
  * @regmap: regmap for QoS registers read/write access
- * @qos_offset: offset to QoS registers
  * @ab_coeff: a percentage-based coefficient for compensating the AB calculations
  * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations
  * @bus_clk_rate: bus clock rate in Hz
@@ -58,7 +57,6 @@ struct qcom_icc_provider {
 	int num_intf_clks;
 	enum qcom_icc_type type;
 	struct regmap *regmap;
-	unsigned int qos_offset;
 	u16 ab_coeff;
 	u16 ib_coeff;
 	u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM];
@@ -70,20 +68,18 @@ struct qcom_icc_provider {
 };
 
 /**
- * struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters
+ * struct qcom_icc_qos_data - Qualcomm specific interconnect QoS parameters
  * @areq_prio: node requests priority
  * @prio_level: priority level for bus communication
  * @limit_commands: activate/deactivate limiter mode during runtime
- * @ap_owned: indicates if the node is owned by the AP or by the RPM
  * @qos_mode: default qos mode for this node
  * @qos_port: qos port number for finding qos registers of this node
  * @urg_fwd_en: enable urgent forwarding
  */
-struct qcom_icc_qos {
+struct qcom_icc_qos_data {
 	u32 areq_prio;
 	u32 prio_level;
 	bool limit_commands;
-	bool ap_owned;
 	int qos_mode;
 	int qos_port;
 	bool urg_fwd_en;
@@ -106,6 +102,7 @@ struct qcom_icc_qos {
  * @ab_coeff: a percentage-based coefficient for compensating the AB calculations
  * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations
  * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz
+ * @ap_owned: indicates if the AP is expected to manage bandwidth on this node
  */
 struct qcom_icc_node {
 	unsigned char *name;
@@ -119,10 +116,10 @@ struct qcom_icc_node {
 	u64 max_peak[QCOM_SMD_RPM_STATE_NUM];
 	int mas_rpm_id;
 	int slv_rpm_id;
-	struct qcom_icc_qos qos;
 	u16 ab_coeff;
 	u16 ib_coeff;
 	u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM];
+	bool ap_owned;
 };
 
 struct qcom_icc_desc {
@@ -134,6 +131,8 @@ struct qcom_icc_desc {
 	bool keep_alive;
 	enum qcom_icc_type type;
 	const struct regmap_config *regmap_cfg;
+	const struct qcom_icc_qos_data * const qos_data;
+	const u16 qos_data_num;
 	unsigned int qos_offset;
 	u16 ab_coeff;
 	u16 ib_coeff;
drivers/interconnect/qcom/msm8909.c +149 -119

520 lines not on this page · raw message

drivers/interconnect/qcom/msm8916.c +85 -68

291 lines not on this page · raw message

drivers/interconnect/qcom/msm8939.c +84 -73

313 lines not on this page · raw message

drivers/interconnect/qcom/msm8996.c +245 -272

1,195 lines not on this page · raw message

drivers/interconnect/qcom/qcm2290.c +239 -177

395 lines not on this page · raw message

drivers/interconnect/qcom/sdm660.c +188 -205

393 lines not on this page · raw message

drivers/interconnect/qcom/sm6115.c +167 -72

239 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.44.0

Part of the diff is not shown here. View the raw message.

#11 lore raw

Re: [PATCH 4/4] interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

Quoted 39 lines · Konrad Dybcio

Currently, the QoS settings are stored in the node data, even though they're a property of the bus/provider instead. Moreover, they are only needed during the probe step, so they can be easily moved into struct qcom_icc_desc.

Reshuffle things around to make it anywhere near readable & comparable with a reference. As a nice bonus, a lot of bytes are shaved off and a few miliseconds are shaved off here and there.

As an example, bloat-o-meter reports this on sm6115.o:
Total: Before=14799, After=13263, chg -10.38%

---
 drivers/interconnect/qcom/icc-rpm.c | 123 +++++----
 drivers/interconnect/qcom/icc-rpm.h |  13 +-
 drivers/interconnect/qcom/msm8909.c | 268 ++++++++++---------
 drivers/interconnect/qcom/msm8916.c | 153 ++++++-----
 drivers/interconnect/qcom/msm8939.c | 157 ++++++-----
 drivers/interconnect/qcom/msm8996.c | 517 +++++++++++++++++-------------------
 drivers/interconnect/qcom/qcm2290.c | 416 +++++++++++++++++------------
 drivers/interconnect/qcom/sdm660.c  | 393 +++++++++++++--------------
 drivers/interconnect/qcom/sm6115.c  | 239 ++++++++++++-----
 9 files changed, 1224 insertions(+), 1055 deletions(-)

[...]

drivers/interconnect/qcom/icc-rpm.h +1 -2
@@ -70,20 +68,18 @@ struct qcom_icc_provider {
 };
 
 /**
- * struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters
+ * struct qcom_icc_qos_data - Qualcomm specific interconnect QoS parameters
  * @areq_prio: node requests priority
  * @prio_level: priority level for bus communication
  * @limit_commands: activate/deactivate limiter mode during runtime
- * @ap_owned: indicates if the node is owned by the AP or by the RPM
  * @qos_mode: default qos mode for this node
  * @qos_port: qos port number for finding qos registers of this node
  * @urg_fwd_en: enable urgent forwarding

drivers/interconnect/qcom/icc-rpm.h struct qcom_icc_provider { · line 85

Quoted 10 lines
drivers/interconnect/qcom/icc-rpm.h +1 -2
  */
-struct qcom_icc_qos {
+struct qcom_icc_qos_data {
 	u32 areq_prio;
 	u32 prio_level;
 	bool limit_commands;
-	bool ap_owned;
 	int qos_mode;
 	int qos_port;
 	bool urg_fwd_en;

Side note: There is a potential for more micro-optimization here: You could save 4 bytes of padding if you move all bools together at the end of the struct. :D

drivers/interconnect/qcom/icc-rpm.h struct qcom_icc_desc { · line 136

Quoted 8 lines

[...]

drivers/interconnect/qcom/icc-rpm.h +2 -0
@@ -134,6 +131,8 @@ struct qcom_icc_desc {
 	bool keep_alive;
 	enum qcom_icc_type type;
 	const struct regmap_config *regmap_cfg;
+	const struct qcom_icc_qos_data * const qos_data;
+	const u16 qos_data_num;
 	unsigned int qos_offset;

Nitpick: Why is the u16 const when the other (non-pointer) members are not? The u16 also feels a bit like overkill here. The struct would have exactly the same size with a full unsigned int because of padding.

Alternatively, you could consider using an empty last entry as sentinel instead of adding the count (i.e. with NOC_QOS_MODE_INVALID = 0). Not sure what is cleaner here.

I haven't looked closely at the actual conversion of the definitions in the drivers. What is the chance that you made an accidental mistake in there? Or was it scripted? :D

Thanks,
Stephan

#12 lore raw

Re: [PATCH 4/4] interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

Quoted 15 lines · Stephan Gerhold
Quoted 14 lines · Konrad Dybcio

Currently, the QoS settings are stored in the node data, even though they're a property of the bus/provider instead. Moreover, they are only needed during the probe step, so they can be easily moved into struct qcom_icc_desc.

Reshuffle things around to make it anywhere near readable & comparable with a reference. As a nice bonus, a lot of bytes are shaved off and a few miliseconds are shaved off here and there.

As an example, bloat-o-meter reports this on sm6115.o:
Total: Before=14799, After=13263, chg -10.38%

---

[...]

Quoted 3 lines

Nitpick: Why is the u16 const when the other (non-pointer) members are not? The u16 also feels a bit like overkill here. The struct would have exactly the same size with a full unsigned int because of padding.

That's just my brain performing premature (and as you can see invalid) optimizations.. I can change it to u32

Quoted 4 lines

Alternatively, you could consider using an empty last entry as sentinel instead of adding the count (i.e. with NOC_QOS_MODE_INVALID = 0). Not sure what is cleaner here.

Nah, let's keep the counter

Quoted 4 lines

I haven't looked closely at the actual conversion of the definitions in the drivers. What is the chance that you made an accidental mistake in there? Or was it scripted? :D

By hand. After this change, it should hopefully be very easy and convenient to check against downstream.

Konrad

#13 lore raw

Re: [PATCH 4/4] interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

In reply to Konrad Dybcio

Hi Konrad,

Quoted 4 lines · Konrad Dybcio

Currently, the QoS settings are stored in the node data, even though they're a property of the bus/provider instead. Moreover, they are only needed during the probe step, so they can be easily moved into struct qcom_icc_desc.

The QoS settings *are* fundamentally a property of the node. The nodes are 1:1 with the NOC ports. And the QoS settings tune the priority of the data coming out of those ports. So, logically speaking, the QoS data does belong in the node structs along with the rest of the data for that node and port.

Only a subset of NOC ports support configurable QoS, but for those ports that do it's a property of the port itself. Those settings impact just that specific port and nothing else.

The current method of directly embedding the qcom_icc_qos_data struct into qcom_icc_node isn't optimal, since that data is irrelevant for ports that don't support it. So, the size could be optimized by converting qcom_icc_node::qos into a pointer instead. But I don't think we should separate the QoS settings from node struct entirely. It makes it very difficult to understand which QoS settings are impacting which port.

For example...

Quoted 18 lines
drivers/interconnect/qcom/msm8996.c +1 -5
index 788131400cd1..96c8ea8edd7a 100644
@@ -43,11 +43,7 @@ static struct qcom_icc_node mas_pcie_0 = {
 	.buswidth = 8,
 	.mas_rpm_id = 65,
 	.slv_rpm_id = -1,
-	.qos.ap_owned = true,
-	.qos.qos_mode = NOC_QOS_MODE_FIXED,
-	.qos.areq_prio = 1,
-	.qos.prio_level = 1,
-	.qos.qos_port = 0,
+	.ap_owned = true,
 	.num_links = ARRAY_SIZE(mas_a0noc_common_links),
 	.links = mas_a0noc_common_links
 };

[...]

drivers/interconnect/qcom/msm8996.c static struct qcom_icc_node * const a0noc_nodes[] = { · line 1648

Quoted 10 lines
drivers/interconnect/qcom/msm8996.c +9 -0
+static const struct qcom_icc_qos_data a0noc_qos_data[] = {
+	{
+		.qos_port = 0,
+		.qos_mode = NOC_QOS_MODE_FIXED,
+		.areq_prio = 1,
+		.prio_level = 1,
+		.urg_fwd_en = false,
+		.limit_commands = false,
+	}, {

How can I tell that these a0noc_qos_data[0] settings are for the mas_pcie_0 port? It's not possible from the code anymore. *We* could figure it out internally by looking at the NOC SWI to determine the qos_port index. But this should be obvious from the code itself.

Quoted 16 lines
drivers/interconnect/qcom/msm8996.c +16 -0
+		.qos_port = 1,
+		.qos_mode = NOC_QOS_MODE_FIXED,
+		.areq_prio = 1,
+		.prio_level = 1,
+		.urg_fwd_en = false,
+		.limit_commands = false,
+	}, {
+		.qos_port = 2,
+		.qos_mode = NOC_QOS_MODE_FIXED,
+		.areq_prio = 1,
+		.prio_level = 1,
+		.urg_fwd_en = false,
+		.limit_commands = false,
+	},
+};
+
#14 lore raw

Re: [PATCH 4/4] interconnect: qcom: icc-rpm: Remodel how QoS settings are stored

Quoted 18 lines · Mike Tipton

Hi Konrad,

Quoted 4 lines · Konrad Dybcio

Currently, the QoS settings are stored in the node data, even though they're a property of the bus/provider instead. Moreover, they are only needed during the probe step, so they can be easily moved into struct qcom_icc_desc.

The QoS settings *are* fundamentally a property of the node. The nodes are 1:1 with the NOC ports. And the QoS settings tune the priority of the data coming out of those ports. So, logically speaking, the QoS data does belong in the node structs along with the rest of the data for that node and port.

Only a subset of NOC ports support configurable QoS, but for those ports that do it's a property of the port itself. Those settings impact just that specific port and nothing else.

Quoted 7 lines

The current method of directly embedding the qcom_icc_qos_data struct into qcom_icc_node isn't optimal, since that data is irrelevant for ports that don't support it. So, the size could be optimized by converting qcom_icc_node::qos into a pointer instead. But I don't think we should separate the QoS settings from node struct entirely. It makes it very difficult to understand which QoS settings are impacting which port.

I think that would make more sense indeed

[...]

Quoted 15 lines

drivers/interconnect/qcom/msm8996.c static struct qcom_icc_node * const a0noc_nodes[] = { · line 1648

Quoted 10 lines
drivers/interconnect/qcom/msm8996.c +9 -0
+static const struct qcom_icc_qos_data a0noc_qos_data[] = {
+	{
+		.qos_port = 0,
+		.qos_mode = NOC_QOS_MODE_FIXED,
+		.areq_prio = 1,
+		.prio_level = 1,
+		.urg_fwd_en = false,
+		.limit_commands = false,
+	}, {

How can I tell that these a0noc_qos_data[0] settings are for the mas_pcie_0 port? It's not possible from the code anymore. *We* could figure it out internally by looking at the NOC SWI to determine the qos_port index. But this should be obvious from the code itself.

Right

Konrad