Skip to contentSkip to conversation

net: ipa: use bulk interconnect interfaces

PATCH Superseded Alex Elder 4 participants 14 messages Feb 4, 2022 – Feb 7, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover net: ipa: use bulk interconnect interfaces

The IPA code currently enables and disables interconnects by setting the bandwidth of each to a non-zero value, or to zero. The interconnect API now supports enable/disable functions, so we can use those instead. In addition, the interconnect API provides bulk interfaces that allow all interconnects to be operated on at once.

This series converts the IPA driver to use the bulk enable and disable interfaces. In the process it uses some existing data structures rather than defining new ones.

-Alex

Alex Elder (7):
net: ipa: kill struct ipa_interconnect
net: ipa: use icc_enable() and icc_disable()
net: ipa: use interconnect bulk enable/disable operations
net: ipa: use bulk operations to set up interconnects
net: ipa: use bulk interconnect initialization
net: ipa: embed interconnect array in the power structure
net: ipa: use IPA power device pointer

 drivers/net/ipa/ipa_power.c | 178 +++++++++---------------------------
 1 file changed, 42 insertions(+), 136 deletions(-)
Signature · 1 line
2.32.0
author
#1 lore raw

PATCH 1/7 net: ipa: kill struct ipa_interconnect

The ipa_interconnect structure contains an icc_path pointer, plus an average and peak bandwidth value. Other than the interconnect name, this matches the icc_bulk_data structure exactly.

Use the icc_bulk_data structure in place of the ipa_interconnect structure, and add an initialization of its name field. Then get rid of the now unnecessary ipa_interconnect structure definition.

---
 drivers/net/ipa/ipa_power.c | 39 +++++++++++++------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/net/ipa/ipa_power.c +14 -25
index f2989aac47a62..28be0e45cccfd 100644
@@ -34,18 +34,6 @@
 
 #define IPA_AUTOSUSPEND_DELAY	500	/* milliseconds */
 
-/**
- * struct ipa_interconnect - IPA interconnect information
- * @path:		Interconnect path
- * @average_bandwidth:	Average interconnect bandwidth (KB/second)
- * @peak_bandwidth:	Peak interconnect bandwidth (KB/second)
- */
-struct ipa_interconnect {
-	struct icc_path *path;
-	u32 average_bandwidth;
-	u32 peak_bandwidth;
-};
-
 /**
  * enum ipa_power_flag - IPA power flags
  * @IPA_POWER_FLAG_RESUMED:	Whether resume from suspend has been signaled
@@ -79,11 +67,11 @@ struct ipa_power {
 	spinlock_t spinlock;	/* used with STOPPED/STARTED power flags */
 	DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);
 	u32 interconnect_count;
-	struct ipa_interconnect *interconnect;
+	struct icc_bulk_data *interconnect;
 };
 
 static int ipa_interconnect_init_one(struct device *dev,
-				     struct ipa_interconnect *interconnect,
+				     struct icc_bulk_data *interconnect,
 				     const struct ipa_interconnect_data *data)
 {
 	struct icc_path *path;
@@ -99,13 +87,14 @@ static int ipa_interconnect_init_one(struct device *dev,
 	}
 
 	interconnect->path = path;
-	interconnect->average_bandwidth = data->average_bandwidth;
-	interconnect->peak_bandwidth = data->peak_bandwidth;
+	interconnect->name = data->name;
+	interconnect->avg_bw = data->average_bandwidth;
+	interconnect->peak_bw = data->peak_bandwidth;
 
 	return 0;
 }
 
-static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect)
+static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
 {
 	icc_put(interconnect->path);
 	memset(interconnect, 0, sizeof(*interconnect));
@@ -115,7 +104,7 @@ static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect)
 static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 				 const struct ipa_interconnect_data *data)
 {
-	struct ipa_interconnect *interconnect;
+	struct icc_bulk_data *interconnect;
 	u32 count;
 	int ret;
 
@@ -146,7 +135,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 /* Inverse of ipa_interconnect_init() */
 static void ipa_interconnect_exit(struct ipa_power *power)
 {
-	struct ipa_interconnect *interconnect;
+	struct icc_bulk_data *interconnect;
 
 	interconnect = power->interconnect + power->interconnect_count;
 	while (interconnect-- > power->interconnect)
@@ -158,7 +147,7 @@ static void ipa_interconnect_exit(struct ipa_power *power)
 /* Currently we only use one bandwidth level, so just "enable" interconnects */
 static int ipa_interconnect_enable(struct ipa *ipa)
 {
-	struct ipa_interconnect *interconnect;
+	struct icc_bulk_data *interconnect;
 	struct ipa_power *power = ipa->power;
 	int ret;
 	u32 i;
@@ -166,12 +155,12 @@ static int ipa_interconnect_enable(struct ipa *ipa)
 	interconnect = power->interconnect;
 	for (i = 0; i < power->interconnect_count; i++) {
 		ret = icc_set_bw(interconnect->path,
-				 interconnect->average_bandwidth,
-				 interconnect->peak_bandwidth);
+				 interconnect->avg_bw,
+				 interconnect->peak_bw);
 		if (ret) {
 			dev_err(&ipa->pdev->dev,
 				"error %d enabling %s interconnect\n",
-				ret, icc_get_name(interconnect->path));
+				ret, interconnect->name);
 			goto out_unwind;
 		}
 		interconnect++;
@@ -189,9 +178,9 @@ static int ipa_interconnect_enable(struct ipa *ipa)
 /* To disable an interconnect, we just its bandwidth to 0 */
 static int ipa_interconnect_disable(struct ipa *ipa)
 {
-	struct ipa_interconnect *interconnect;
 	struct ipa_power *power = ipa->power;
 	struct device *dev = &ipa->pdev->dev;
+	struct icc_bulk_data *interconnect;
 	int result = 0;
 	u32 count;
 	int ret;
@@ -203,7 +192,7 @@ static int ipa_interconnect_disable(struct ipa *ipa)
 		ret = icc_set_bw(interconnect->path, 0, 0);
 		if (ret) {
 			dev_err(dev, "error %d disabling %s interconnect\n",
-				ret, icc_get_name(interconnect->path));
+				ret, interconnect->name);
 			/* Try to disable all; record only the first error */
 			if (!result)
 				result = ret;
Signature · 1 line
2.32.0
author
#9 lore raw

PATCH 4/7 net: ipa: use bulk operations to set up interconnects

In reply to Alex Elder

Use of_icc_bulk_get() and icc_bulk_put(), icc_bulk_set_bw(), and icc_bulk_enable() and icc_bulk_disable() to initialize individual IPA interconnects. Those functions already log messages in the event of error so we don't need to.

---
 drivers/net/ipa/ipa_power.c | 40 ++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 25 deletions(-)
drivers/net/ipa/ipa_power.c +15 -25
index 67f76e6a6ae59..c0da1274f5d67 100644
@@ -74,41 +74,31 @@ static int ipa_interconnect_init_one(struct device *dev,
 				     struct icc_bulk_data *interconnect,
 				     const struct ipa_interconnect_data *data)
 {
-	struct icc_path *path;
 	int ret;
 
-	path = of_icc_get(dev, data->name);
-	if (IS_ERR(path)) {
-		ret = PTR_ERR(path);
-		dev_err_probe(dev, ret, "error getting %s interconnect\n",
-			      data->name);
-
-		return ret;
-	}
-
-	/* All interconnects are initially disabled */
-	(void)icc_disable(path);
-
-	/* Set the bandwidth values to be used when enabled */
-	ret = icc_set_bw(path, data->average_bandwidth, data->peak_bandwidth);
-	if (ret) {
-		dev_err(dev, "error %d setting %s interconnect bandwidths\n",
-			ret, data->name);
-
-		return ret;
-	}
-
-	interconnect->path = path;
+	/* interconnect->path is filled in by of_icc_bulk_get() */
 	interconnect->name = data->name;
 	interconnect->avg_bw = data->average_bandwidth;
 	interconnect->peak_bw = data->peak_bandwidth;
 
-	return 0;
+	ret = of_icc_bulk_get(dev, 1, interconnect);
+	if (ret)
+		return ret;
+
+	/* All interconnects are initially disabled */
+	icc_bulk_disable(1, interconnect);
+
+	/* Set the bandwidth values to be used when enabled */
+	ret = icc_bulk_set_bw(1, interconnect);
+	if (ret)
+		icc_bulk_put(1, interconnect);
+
+	return ret;
 }
 
 static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
 {
-	icc_put(interconnect->path);
+	icc_bulk_put(1, interconnect);
 	memset(interconnect, 0, sizeof(*interconnect));
 }
 
Signature · 1 line
2.32.0
author
#2 lore raw

PATCH 2/7 net: ipa: use icc_enable() and icc_disable()

In reply to Alex Elder

The interconnect framework now provides the ability to enable and disable interconnects without having to change their recorded "enabled" bandwidth value. Use this mechanism, rather than setting the bandwidth values to zero and non-zero respectively to disable and enable the IPA interconnects.

Disable each interconnect before setting its "enabled" average and peak bandwidth values. Thereafter, enable and disable interconnects when required rather than setting their bandwidths.

---
 drivers/net/ipa/ipa_power.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/net/ipa/ipa_power.c +17 -7
index 28be0e45cccfd..ec2ebc74edb8b 100644
@@ -75,17 +75,29 @@ static int ipa_interconnect_init_one(struct device *dev,
 				     const struct ipa_interconnect_data *data)
 {
 	struct icc_path *path;
+	int ret;
 
 	path = of_icc_get(dev, data->name);
 	if (IS_ERR(path)) {
-		int ret = PTR_ERR(path);
-
+		ret = PTR_ERR(path);
 		dev_err_probe(dev, ret, "error getting %s interconnect\n",
 			      data->name);
 
 		return ret;
 	}
 
+	/* All interconnects are initially disabled */
+	(void)icc_disable(path);
+
+	/* Set the bandwidth values to be used when enabled */
+	ret = icc_set_bw(path, data->average_bandwidth, data->peak_bandwidth);
+	if (ret) {
+		dev_err(dev, "error %d setting %s interconnect bandwidths\n",
+			ret, data->name);
+
+		return ret;
+	}
+
 	interconnect->path = path;
 	interconnect->name = data->name;
 	interconnect->avg_bw = data->average_bandwidth;
@@ -154,9 +166,7 @@ static int ipa_interconnect_enable(struct ipa *ipa)
 
 	interconnect = power->interconnect;
 	for (i = 0; i < power->interconnect_count; i++) {
-		ret = icc_set_bw(interconnect->path,
-				 interconnect->avg_bw,
-				 interconnect->peak_bw);
+		ret = icc_enable(interconnect->path);
 		if (ret) {
 			dev_err(&ipa->pdev->dev,
 				"error %d enabling %s interconnect\n",
@@ -170,7 +180,7 @@ static int ipa_interconnect_enable(struct ipa *ipa)
 
 out_unwind:
 	while (interconnect-- > power->interconnect)
-		(void)icc_set_bw(interconnect->path, 0, 0);
+		(void)icc_disable(interconnect->path);
 
 	return ret;
 }
@@ -189,7 +199,7 @@ static int ipa_interconnect_disable(struct ipa *ipa)
 	interconnect = power->interconnect + count;
 	while (count--) {
 		interconnect--;
-		ret = icc_set_bw(interconnect->path, 0, 0);
+		ret = icc_disable(interconnect->path);
 		if (ret) {
 			dev_err(dev, "error %d disabling %s interconnect\n",
 				ret, interconnect->name);
Signature · 1 line
2.32.0
author
#11 lore raw

PATCH 5/7 net: ipa: use bulk interconnect initialization

In reply to Alex Elder

The previous patch used bulk interconnect operations to initialize IPA interconnects one at a time. This rearranges things to use the bulk interfaces as intended--on all interconnects together. As a result ipa_interconnect_init_one() and ipa_interconnect_exit_one() are no longer needed.

---
 drivers/net/ipa/ipa_power.c | 66 +++++++++++++------------------------
 1 file changed, 23 insertions(+), 43 deletions(-)
drivers/net/ipa/ipa_power.c +23 -43
index c0da1274f5d67..b1f6978dddadb 100644
@@ -70,38 +70,6 @@ struct ipa_power {
 	struct icc_bulk_data *interconnect;
 };
 
-static int ipa_interconnect_init_one(struct device *dev,
-				     struct icc_bulk_data *interconnect,
-				     const struct ipa_interconnect_data *data)
-{
-	int ret;
-
-	/* interconnect->path is filled in by of_icc_bulk_get() */
-	interconnect->name = data->name;
-	interconnect->avg_bw = data->average_bandwidth;
-	interconnect->peak_bw = data->peak_bandwidth;
-
-	ret = of_icc_bulk_get(dev, 1, interconnect);
-	if (ret)
-		return ret;
-
-	/* All interconnects are initially disabled */
-	icc_bulk_disable(1, interconnect);
-
-	/* Set the bandwidth values to be used when enabled */
-	ret = icc_bulk_set_bw(1, interconnect);
-	if (ret)
-		icc_bulk_put(1, interconnect);
-
-	return ret;
-}
-
-static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
-{
-	icc_bulk_put(1, interconnect);
-	memset(interconnect, 0, sizeof(*interconnect));
-}
-
 /* Initialize interconnects required for IPA operation */
 static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 				 const struct ipa_interconnect_data *data)
@@ -116,18 +84,34 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 		return -ENOMEM;
 	power->interconnect = interconnect;
 
+	/* Initialize our interconnect data array for bulk operations */
 	while (count--) {
-		ret = ipa_interconnect_init_one(dev, interconnect, data++);
-		if (ret)
-			goto out_unwind;
+		/* interconnect->path is filled in by of_icc_bulk_get() */
+		interconnect->name = data->name;
+		interconnect->avg_bw = data->average_bandwidth;
+		interconnect->peak_bw = data->peak_bandwidth;
+		data++;
 		interconnect++;
 	}
 
+	ret = of_icc_bulk_get(dev, power->interconnect_count,
+			      power->interconnect);
+	if (ret)
+		goto err_free;
+
+	/* All interconnects are initially disabled */
+	icc_bulk_disable(power->interconnect_count, power->interconnect);
+
+	/* Set the bandwidth values to be used when enabled */
+	ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect);
+	if (ret)
+		goto err_bulk_put;
+
 	return 0;
 
-out_unwind:
-	while (interconnect-- > power->interconnect)
-		ipa_interconnect_exit_one(interconnect);
+err_bulk_put:
+	icc_bulk_put(power->interconnect_count, power->interconnect);
+err_free:
 	kfree(power->interconnect);
 	power->interconnect = NULL;
 
@@ -137,11 +121,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 /* Inverse of ipa_interconnect_init() */
 static void ipa_interconnect_exit(struct ipa_power *power)
 {
-	struct icc_bulk_data *interconnect;
-
-	interconnect = power->interconnect + power->interconnect_count;
-	while (interconnect-- > power->interconnect)
-		ipa_interconnect_exit_one(interconnect);
+	icc_bulk_put(power->interconnect_count, power->interconnect);
 	kfree(power->interconnect);
 	power->interconnect = NULL;
 }
Signature · 1 line
2.32.0
author
#3 lore raw

PATCH 3/7 net: ipa: use interconnect bulk enable/disable operations

In reply to Alex Elder

The power interconnect array is now an array of icc_bulk_data structures, which is what the interconnect bulk enable and disable functions require.

Get rid of ipa_interconnect_enable() and ipa_interconnect_disable(), and just call icc_bulk_enable() and icc_bulk_disable() instead.

---
 drivers/net/ipa/ipa_power.c | 76 +++++++------------------------------
 1 file changed, 13 insertions(+), 63 deletions(-)
drivers/net/ipa/ipa_power.c +13 -63
index ec2ebc74edb8b..67f76e6a6ae59 100644
@@ -156,86 +156,34 @@ static void ipa_interconnect_exit(struct ipa_power *power)
 	power->interconnect = NULL;
 }
 
-/* Currently we only use one bandwidth level, so just "enable" interconnects */
-static int ipa_interconnect_enable(struct ipa *ipa)
-{
-	struct icc_bulk_data *interconnect;
-	struct ipa_power *power = ipa->power;
-	int ret;
-	u32 i;
-
-	interconnect = power->interconnect;
-	for (i = 0; i < power->interconnect_count; i++) {
-		ret = icc_enable(interconnect->path);
-		if (ret) {
-			dev_err(&ipa->pdev->dev,
-				"error %d enabling %s interconnect\n",
-				ret, interconnect->name);
-			goto out_unwind;
-		}
-		interconnect++;
-	}
-
-	return 0;
-
-out_unwind:
-	while (interconnect-- > power->interconnect)
-		(void)icc_disable(interconnect->path);
-
-	return ret;
-}
-
-/* To disable an interconnect, we just its bandwidth to 0 */
-static int ipa_interconnect_disable(struct ipa *ipa)
-{
-	struct ipa_power *power = ipa->power;
-	struct device *dev = &ipa->pdev->dev;
-	struct icc_bulk_data *interconnect;
-	int result = 0;
-	u32 count;
-	int ret;
-
-	count = power->interconnect_count;
-	interconnect = power->interconnect + count;
-	while (count--) {
-		interconnect--;
-		ret = icc_disable(interconnect->path);
-		if (ret) {
-			dev_err(dev, "error %d disabling %s interconnect\n",
-				ret, interconnect->name);
-			/* Try to disable all; record only the first error */
-			if (!result)
-				result = ret;
-		}
-	}
-
-	return result;
-}
-
 /* Enable IPA power, enabling interconnects and the core clock */
 static int ipa_power_enable(struct ipa *ipa)
 {
+	struct ipa_power *power = ipa->power;
 	int ret;
 
-	ret = ipa_interconnect_enable(ipa);
+	ret = icc_bulk_enable(power->interconnect_count, power->interconnect);
 	if (ret)
 		return ret;
 
-	ret = clk_prepare_enable(ipa->power->core);
+	ret = clk_prepare_enable(power->core);
 	if (ret) {
 		dev_err(&ipa->pdev->dev, "error %d enabling core clock\n", ret);
-		(void)ipa_interconnect_disable(ipa);
+		icc_bulk_disable(power->interconnect_count,
+				 power->interconnect);
 	}
 
 	return ret;
 }
 
 /* Inverse of ipa_power_enable() */
-static int ipa_power_disable(struct ipa *ipa)
+static void ipa_power_disable(struct ipa *ipa)
 {
-	clk_disable_unprepare(ipa->power->core);
+	struct ipa_power *power = ipa->power;
 
-	return ipa_interconnect_disable(ipa);
+	clk_disable_unprepare(power->core);
+
+	icc_bulk_disable(power->interconnect_count, power->interconnect);
 }
 
 static int ipa_runtime_suspend(struct device *dev)
@@ -249,7 +197,9 @@ static int ipa_runtime_suspend(struct device *dev)
 		gsi_suspend(&ipa->gsi);
 	}
 
-	return ipa_power_disable(ipa);
+	ipa_power_disable(ipa);
+
+	return 0;
 }
 
 static int ipa_runtime_resume(struct device *dev)
Signature · 1 line
2.32.0
author
#13 lore raw

PATCH 7/7 net: ipa: use IPA power device pointer

In reply to Alex Elder

The ipa_power structure contains a copy of the IPA device pointer, so there's no need to pass it to ipa_interconnect_init(). We can also use that pointer for an error message in ipa_power_enable().

---
 drivers/net/ipa/ipa_power.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_power.c +4 -4
index 8a564d72799da..16ece27d14d7e 100644
@@ -71,7 +71,7 @@ struct ipa_power {
 };
 
 /* Initialize interconnects required for IPA operation */
-static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
+static int ipa_interconnect_init(struct ipa_power *power,
 				 const struct ipa_interconnect_data *data)
 {
 	struct icc_bulk_data *interconnect;
@@ -89,7 +89,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 		interconnect++;
 	}
 
-	ret = of_icc_bulk_get(dev, power->interconnect_count,
+	ret = of_icc_bulk_get(power->dev, power->interconnect_count,
 			      power->interconnect);
 	if (ret)
 		return ret;
@@ -123,7 +123,7 @@ static int ipa_power_enable(struct ipa *ipa)
 
 	ret = clk_prepare_enable(power->core);
 	if (ret) {
-		dev_err(&ipa->pdev->dev, "error %d enabling core clock\n", ret);
+		dev_err(power->dev, "error %d enabling core clock\n", ret);
 		icc_bulk_disable(power->interconnect_count,
 				 power->interconnect);
 	}
@@ -385,7 +385,7 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data)
 	spin_lock_init(&power->spinlock);
 	power->interconnect_count = data->interconnect_count;
 
-	ret = ipa_interconnect_init(power, dev, data->interconnect_data);
+	ret = ipa_interconnect_init(power, data->interconnect_data);
 	if (ret)
 		goto err_kfree;
 
Signature · 1 line
2.32.0
author
#12 lore raw

PATCH 6/7 net: ipa: embed interconnect array in the power structure

In reply to Alex Elder

Rather than allocating the interconnect array dynamically, represent the interconnects with a variable-length array at the end of the ipa_power structure.

---
 drivers/net/ipa/ipa_power.c | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)
drivers/net/ipa/ipa_power.c +9 -22
index b1f6978dddadb..8a564d72799da 100644
@@ -67,7 +67,7 @@ struct ipa_power {
 	spinlock_t spinlock;	/* used with STOPPED/STARTED power flags */
 	DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);
 	u32 interconnect_count;
-	struct icc_bulk_data *interconnect;
+	struct icc_bulk_data interconnect[];
 };
 
 /* Initialize interconnects required for IPA operation */
@@ -75,17 +75,12 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 				 const struct ipa_interconnect_data *data)
 {
 	struct icc_bulk_data *interconnect;
-	u32 count;
 	int ret;
-
-	count = power->interconnect_count;
-	interconnect = kcalloc(count, sizeof(*interconnect), GFP_KERNEL);
-	if (!interconnect)
-		return -ENOMEM;
-	power->interconnect = interconnect;
+	u32 i;
 
 	/* Initialize our interconnect data array for bulk operations */
-	while (count--) {
+	interconnect = &power->interconnect[0];
+	for (i = 0; i < power->interconnect_count; i++) {
 		/* interconnect->path is filled in by of_icc_bulk_get() */
 		interconnect->name = data->name;
 		interconnect->avg_bw = data->average_bandwidth;
@@ -97,7 +92,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 	ret = of_icc_bulk_get(dev, power->interconnect_count,
 			      power->interconnect);
 	if (ret)
-		goto err_free;
+		return ret;
 
 	/* All interconnects are initially disabled */
 	icc_bulk_disable(power->interconnect_count, power->interconnect);
@@ -105,15 +100,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 	/* Set the bandwidth values to be used when enabled */
 	ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect);
 	if (ret)
-		goto err_bulk_put;
-
-	return 0;
-
-err_bulk_put:
-	icc_bulk_put(power->interconnect_count, power->interconnect);
-err_free:
-	kfree(power->interconnect);
-	power->interconnect = NULL;
+		icc_bulk_put(power->interconnect_count, power->interconnect);
 
 	return ret;
 }
@@ -122,8 +109,6 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
 static void ipa_interconnect_exit(struct ipa_power *power)
 {
 	icc_bulk_put(power->interconnect_count, power->interconnect);
-	kfree(power->interconnect);
-	power->interconnect = NULL;
 }
 
 /* Enable IPA power, enabling interconnects and the core clock */
@@ -372,6 +357,7 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data)
 {
 	struct ipa_power *power;
 	struct clk *clk;
+	size_t size;
 	int ret;
 
 	clk = clk_get(dev, "core");
@@ -388,7 +374,8 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data)
 		goto err_clk_put;
 	}
 
-	power = kzalloc(sizeof(*power), GFP_KERNEL);
+	size = data->interconnect_count * sizeof(power->interconnect[0]);
+	power = kzalloc(sizeof(*power) + size, GFP_KERNEL);
 	if (!power) {
 		ret = -ENOMEM;
 		goto err_clk_put;
Signature · 1 line
2.32.0
#4 lore raw

Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

In reply to Alex Elder
I love your patch! Yet something to improve:

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 41414c9bdbb87cc5fbeee7dfc33137a96710fcac
config: h8300-randconfig-r011-20220130 (https://download.01.org/0day-ci/archive/20220205/202202051206.Fm1qmsg5-lkp(a)intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158 git checkout 64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `ipa_runtime_resume':

>> ipa_power.c:(.text+0xa5): undefined reference to `icc_bulk_enable'
>> h8300-linux-ld: ipa_power.c:(.text+0x15b): undefined reference to `icc_bulk_disable'
   h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L15':
>> ipa_power.c:(.text+0x1cb): undefined reference to `icc_bulk_disable'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#5 lore raw

Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

Hi kbuild bot folks!

I love the report, one question tho ;)

Why is this one sent off list? Because of the uncommon architecture?

Quoted 35 lines · On Sat, 5 Feb 2022 12:10:16 +0800 kernel test robot wrote:

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 41414c9bdbb87cc5fbeee7dfc33137a96710fcac
config: h8300-randconfig-r011-20220130 (https://download.01.org/0day-ci/archive/20220205/202202051206.Fm1qmsg5-lkp(a)intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158 git checkout 64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `ipa_runtime_resume':

Quoted 2 lines
Quoted 2 lines

ipa_power.c:(.text+0xa5): undefined reference to `icc_bulk_enable'
h8300-linux-ld: ipa_power.c:(.text+0x15b): undefined reference to `icc_bulk_disable'

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L15':

Quoted 1 line
Quoted 1 line

ipa_power.c:(.text+0x1cb): undefined reference to `icc_bulk_disable'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#7 lore raw

Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

In reply to Alex Elder
Quoted 8 lines · On Fri, 4 Feb 2022 13:50:40 -0600 Alex Elder wrote:

The power interconnect array is now an array of icc_bulk_data structures, which is what the interconnect bulk enable and disable functions require.

Get rid of ipa_interconnect_enable() and ipa_interconnect_disable(), and just call icc_bulk_enable() and icc_bulk_disable() instead.

We got a kbuild bot complaint here, for some reason off-list. Let me drop it from PW for now.

#10 lore raw

Re: [PATCH net-next 4/7] net: ipa: use bulk operations to set up interconnects

In reply to Alex Elder
I love your patch! Yet something to improve:

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 41414c9bdbb87cc5fbeee7dfc33137a96710fcac
config: h8300-randconfig-r011-20220130 (https://download.01.org/0day-ci/archive/20220205/202202051846.p8WWbMAG-lkp(a)intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/6b72ddf0d02fe0834fb8d8dcac7355900d9e858e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158 git checkout 6b72ddf0d02fe0834fb8d8dcac7355900d9e858e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `ipa_runtime_resume':
ipa_power.c:(.text+0xa5): undefined reference to `icc_bulk_enable'
h8300-linux-ld: ipa_power.c:(.text+0x15b): undefined reference to `icc_bulk_disable'
h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L15':
ipa_power.c:(.text+0x1cb): undefined reference to `icc_bulk_disable'
h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L30':

>> ipa_power.c:(.text+0x2a1): undefined reference to `of_icc_bulk_get'
   h8300-linux-ld: ipa_power.c:(.text+0x2bb): undefined reference to `icc_bulk_disable'
>> h8300-linux-ld: ipa_power.c:(.text+0x2cb): undefined reference to `icc_bulk_set_bw'
>> h8300-linux-ld: ipa_power.c:(.text+0x2ed): undefined reference to `icc_bulk_put'
   h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L28':
>> ipa_power.c:(.text+0x2ff): undefined reference to `icc_bulk_put'

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L67':
ipa_power.c:(.text+0x723): undefined reference to `icc_bulk_put'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author
#8 lore raw

Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 4 Feb 2022 13:50:40 -0600 Alex Elder wrote:

The power interconnect array is now an array of icc_bulk_data structures, which is what the interconnect bulk enable and disable functions require.

Quoted 7 lines
Quoted 4 lines

Get rid of ipa_interconnect_enable() and ipa_interconnect_disable(), and just call icc_bulk_enable() and icc_bulk_disable() instead.

We got a kbuild bot complaint here, for some reason off-list. Let me drop it from PW for now.

OK. I guess the interconnect code isn't ready for COMPILE_TEST. I'll investigate that a little more and if we can get past that I'll send out a new version. Not sure how long that will take though...

Thanks, I retract this series for now.

-Alex

#6 lore raw

Re: [PATCH net-next 3/7] net: ipa: use interconnect bulk enable/disable operations

In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski

Hi kbuild bot folks!

I love the report, one question tho ;)

Why is this one sent off list? Because of the uncommon architecture?

Hi Jakub,

Thanks for the feedback, I checked the related code, we limited the number of email recipients to reduce damage if the bot wrongly send reports to a lot of unrelated people.

But we need to optimize the logic to avoid missing lists now.

Best Regards,
Rong Chen

Quoted 41 lines · On Sat, 5 Feb 2022 12:10:16 +0800 kernel test robot wrote:
Quoted 27 lines

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 41414c9bdbb87cc5fbeee7dfc33137a96710fcac
config: h8300-randconfig-r011-20220130 (https://download.01.org/0day-ci/archive/20220205/202202051206.Fm1qmsg5-lkp(a)intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alex-Elder/net-ipa-use-bulk-interconnect-interfaces/20220205-035158 git checkout 64793c5b8a8f9ad60963c357ffa1a0a92dd0fd5d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `ipa_runtime_resume':

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

ipa_power.c:(.text+0xa5): undefined reference to `icc_bulk_enable'
h8300-linux-ld: ipa_power.c:(.text+0x15b): undefined reference to `icc_bulk_disable'

    h8300-linux-ld: drivers/net/ipa/ipa_power.o: in function `.L15':
Quoted 1 line
Quoted 1 line

ipa_power.c:(.text+0x1cb): undefined reference to `icc_bulk_disable'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org