Skip to contentSkip to conversation

hwmon: (xgene-hwmon) Simplify PCC shared memory region handling

PATCH In review Sudeep Holla 2 participants 3 messages Apr 11, 2025 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (xgene-hwmon) Simplify PCC shared memory region handling

The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this xgene hwmon driver did handling of those mappings like several other PCC mailbox client drivers.

There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem.

Just use the mapped shmem and remove all redundant operations from this driver.

---
 drivers/hwmon/xgene-hwmon.c | 39 ++++---------------------------------
 1 file changed, 4 insertions(+), 35 deletions(-)

Hi,

This is just resend of the same patch that was part of a series [1]. Only core PCC mailbox changes were merged during v6.15 merge window. So dropping all the maintainer acks and reposting it so that it can be picked up for v6.16 via maintainers tree.

Regards,
Sudeep

[1] https://lore.kernel.org/all/[email protected]/

drivers/hwmon/xgene-hwmon.c +4 -35
index 2cdbd5f107a2..11c5d80428cd 100644
@@ -103,8 +103,6 @@ struct xgene_hwmon_dev {
 	struct device		*hwmon_dev;
 	bool			temp_critical_alarm;
 
-	phys_addr_t		comm_base_addr;
-	void			*pcc_comm_addr;
 	unsigned int		usecs_lat;
 };
 
@@ -125,7 +123,8 @@ static u16 xgene_word_tst_and_clr(u16 *addr, u16 mask)
 
 static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
 {
-	struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
+	struct acpi_pcct_shared_memory __iomem *generic_comm_base =
+							ctx->pcc_chan->shmem;
 	u32 *ptr = (void *)(generic_comm_base + 1);
 	int rc, i;
 	u16 val;
@@ -523,7 +522,8 @@ static void xgene_hwmon_rx_cb(struct mbox_client *cl, void *msg)
 static void xgene_hwmon_pcc_rx_cb(struct mbox_client *cl, void *msg)
 {
 	struct xgene_hwmon_dev *ctx = to_xgene_hwmon_dev(cl);
-	struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
+	struct acpi_pcct_shared_memory __iomem *generic_comm_base =
+							ctx->pcc_chan->shmem;
 	struct slimpro_resp_msg amsg;
 
 	/*
@@ -649,7 +649,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
 	} else {
 		struct pcc_mbox_chan *pcc_chan;
 		const struct acpi_device_id *acpi_id;
-		int version;
 
 		acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
 					    &pdev->dev);
@@ -658,8 +657,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
 			goto out_mbox_free;
 		}
 
-		version = (int)acpi_id->driver_data;
-
 		if (device_property_read_u32(&pdev->dev, "pcc-channel",
 					     &ctx->mbox_idx)) {
 			dev_err(&pdev->dev, "no pcc-channel property\n");
@@ -685,34 +682,6 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
 			goto out;
 		}
 
-		/*
-		 * This is the shared communication region
-		 * for the OS and Platform to communicate over.
-		 */
-		ctx->comm_base_addr = pcc_chan->shmem_base_addr;
-		if (ctx->comm_base_addr) {
-			if (version == XGENE_HWMON_V2)
-				ctx->pcc_comm_addr = (void __force *)devm_ioremap(&pdev->dev,
-								  ctx->comm_base_addr,
-								  pcc_chan->shmem_size);
-			else
-				ctx->pcc_comm_addr = devm_memremap(&pdev->dev,
-								   ctx->comm_base_addr,
-								   pcc_chan->shmem_size,
-								   MEMREMAP_WB);
-		} else {
-			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
-			rc = -ENODEV;
-			goto out;
-		}
-
-		if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) {
-			dev_err(&pdev->dev,
-				"Failed to ioremap PCC comm region\n");
-			rc = -ENOMEM;
-			goto out;
-		}
-
 		/*
 		 * pcc_chan->latency is just a Nominal value. In reality
 		 * the remote processor could be much slower to reply.
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 20 lines · Sudeep Holla

The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this xgene hwmon driver did handling of those mappings like several other PCC mailbox client drivers.

There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem.

Just use the mapped shmem and remove all redundant operations from this driver.

---
  drivers/hwmon/xgene-hwmon.c | 39 ++++---------------------------------
  1 file changed, 4 insertions(+), 35 deletions(-)
Quoted 5 lines

Hi,

This is just resend of the same patch that was part of a series [1]. Only core PCC mailbox changes were merged during v6.15 merge window. So dropping all the maintainer acks and reposting it so that it can

Why drop my Ack ? To have me review it again ?

FWIW, I had expected that the patch will be picked up with the series.

Anyway, applied.

Guenter

#2 lore raw
Quoted 21 lines · Guenter Roeck
Quoted 20 lines · Sudeep Holla

The PCC driver now handles mapping and unmapping of shared memory areas as part of pcc_mbox_{request,free}_channel(). Without these before, this xgene hwmon driver did handling of those mappings like several other PCC mailbox client drivers.

There were redundant operations, leading to unnecessary code. Maintaining the consistency across these driver was harder due to scattered handling of shmem.

Just use the mapped shmem and remove all redundant operations from this driver.

---
  drivers/hwmon/xgene-hwmon.c | 39 ++++---------------------------------
  1 file changed, 4 insertions(+), 35 deletions(-)
Quoted 8 lines
Quoted 5 lines

Hi,

This is just resend of the same patch that was part of a series [1]. Only core PCC mailbox changes were merged during v6.15 merge window. So dropping all the maintainer acks and reposting it so that it can

Why drop my Ack ? To have me review it again ?

I should have explained why. I assumed you would apply and hence would sign off anyway. I was just trying to avoid you having to drop that when applying with some tool. I wasn't expecting you to review again, sorry for not making that clear.

Quoted 2 lines

FWIW, I had expected that the patch will be picked up with the series.

Yes, me too. But Jassi applied only mailbox changes and I noticed that only in his pull request.

Quoted 2 lines

Anyway, applied.

Thanks!

Signature · 2 lines
Regards,
Sudeep