public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT
@ 2026-03-02 15:58 Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode Konrad Dybcio
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-03-02 15:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Alex Elder
  Cc: Marijn Suijten, linux-arm-msm, devicetree, linux-kernel, netdev,
	Konrad Dybcio, Krzysztof Kozlowski, Alex Elder, Dmitry Baryshkov,
	Simon Horman, Krzysztof Kozlowski

This adds the necessary driver change to migrate over from
hardcoded-per-IPA-version-but-varying-per-implementation numbers, while
unfortunately keeping them in there for backwards compatibility.

The DT changes will be submitted in a separate series, this one is OK
to merge independently.

Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
Changes in v6:
- Refrain from corrupting the resource representing IPA pdev's
  "ipa-shared" reg region
- Rebase on next-20260227 (NOP)
- Link to v5: https://lore.kernel.org/r/20260224-topic-ipa_imem-v5-0-015bf09e123e@oss.qualcomm.com

Changes in v5:
- Rebase on next-20260223 (NOP)
- Resend after the merge window formally closed..
- Link to v4: https://lore.kernel.org/r/20260219-topic-ipa_imem-v4-0-189d91dbee84@oss.qualcomm.com

Changes in v4:
- Fix a memmap() leak
- Adjust comment style, take Alex's suggestion about very explicit
  DEPRECATION notices
- Pick up tags
- Link to v3: https://lore.kernel.org/r/20260217-topic-ipa_imem-v3-0-d6d8ed1dfb67@oss.qualcomm.com

Changes in v3:
- Pick up tags, rebase (effectively a NOP)
- Add actual binding constraints for modem-tables, drop Alex's r-b
- Better describe the purpose of this region, as much as I can anyway
- Link to v2: https://lore.kernel.org/r/20250527-topic-ipa_imem-v2-0-6d1aad91b841@oss.qualcomm.com

Changes in v2:
- Actually pass the retrieved data to the target function
- Re-wrap comments to match net/ style
- Mention next-next in the mail subjects
- Pick up tags
- Link to v1: https://lore.kernel.org/r/20250523-topic-ipa_imem-v1-0-b5d536291c7f@oss.qualcomm.com

---
Konrad Dybcio (3):
      dt-bindings: sram: qcom,imem: Allow modem-tables subnode
      dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice
      net: ipa: Grab IMEM slice base/size from DTS

 .../devicetree/bindings/net/qcom,ipa.yaml          |  7 +++++++
 .../devicetree/bindings/sram/qcom,imem.yaml        | 14 +++++++++++++
 drivers/net/ipa/ipa_data.h                         |  9 ++++++--
 drivers/net/ipa/ipa_mem.c                          | 24 +++++++++++++++++++++-
 4 files changed, 51 insertions(+), 3 deletions(-)
---
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
change-id: 20250523-topic-ipa_imem-def66cca88e5

Best regards,
-- 
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next v6 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode
  2026-03-02 15:58 [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
@ 2026-03-02 15:58 ` Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice Konrad Dybcio
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-03-02 15:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Alex Elder
  Cc: Marijn Suijten, linux-arm-msm, devicetree, linux-kernel, netdev,
	Konrad Dybcio, Krzysztof Kozlowski, Alex Elder

From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

The IP Accelerator hardware/firmware owns a sizeable region within the
IMEM, named 'modem-tables', containing various packet processing
configuration data.

It's not actually accessed by the OS, although we have to IOMMU-map it
with the IPA device, so that presumably the firmware can act upon it.

Allow it as a subnode of IMEM.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 Documentation/devicetree/bindings/sram/qcom,imem.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/sram/qcom,imem.yaml b/Documentation/devicetree/bindings/sram/qcom,imem.yaml
index 6a627c57ae2f..c63026904061 100644
--- a/Documentation/devicetree/bindings/sram/qcom,imem.yaml
+++ b/Documentation/devicetree/bindings/sram/qcom,imem.yaml
@@ -67,6 +67,20 @@ properties:
     $ref: /schemas/power/reset/syscon-reboot-mode.yaml#
 
 patternProperties:
+  "^modem-tables@[0-9a-f]+$":
+    type: object
+    description:
+      Region containing packet processing configuration for the IP Accelerator.
+
+    properties:
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+
+    additionalProperties: false
+
   "^pil-reloc@[0-9a-f]+$":
     $ref: /schemas/remoteproc/qcom,pil-info.yaml#
     description: Peripheral image loader relocation region

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v6 2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice
  2026-03-02 15:58 [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode Konrad Dybcio
@ 2026-03-02 15:58 ` Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 3/3] net: ipa: Grab IMEM slice base/size from DTS Konrad Dybcio
  2026-03-04  1:30 ` [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-03-02 15:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Alex Elder
  Cc: Marijn Suijten, linux-arm-msm, devicetree, linux-kernel, netdev,
	Konrad Dybcio, Alex Elder, Krzysztof Kozlowski

From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

The IPA driver currently grabs a slice of IMEM through hardcoded
addresses. Not only is that ugly and against the principles of DT,
but it also creates a situation where two distinct platforms
implementing the same version of IPA would need to be hardcoded
together and matched at runtime.

Instead, do the sane thing and accept a handle to said region directly.

Don't make it required on purpose, as it's not there on ancient
implementations (currently unsupported) and we're not yet done with
filling the data across al DTs.

Reviewed-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 Documentation/devicetree/bindings/net/qcom,ipa.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml
index c7f5f2ef7452..4237e74041ef 100644
--- a/Documentation/devicetree/bindings/net/qcom,ipa.yaml
+++ b/Documentation/devicetree/bindings/net/qcom,ipa.yaml
@@ -165,6 +165,13 @@ properties:
       initializing IPA hardware.  Optional, and only used when
       Trust Zone performs early initialization.
 
+  sram:
+    maxItems: 1
+    description:
+      A reference to an additional region residing in IMEM (special
+      on-chip SRAM), which is accessed by the IPA firmware and needs
+      to be IOMMU-mapped from the OS.
+
 required:
   - compatible
   - iommus

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v6 3/3] net: ipa: Grab IMEM slice base/size from DTS
  2026-03-02 15:58 [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode Konrad Dybcio
  2026-03-02 15:58 ` [PATCH net-next v6 2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice Konrad Dybcio
@ 2026-03-02 15:58 ` Konrad Dybcio
  2026-03-04  1:30 ` [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-03-02 15:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Alex Elder
  Cc: Marijn Suijten, linux-arm-msm, devicetree, linux-kernel, netdev,
	Konrad Dybcio, Alex Elder, Dmitry Baryshkov, Simon Horman

From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

This is a detail that differ per chip, and not per IPA version (and
there are cases of the same IPA versions being implemented across very
very very different SoCs).

This region isn't actually used by the driver, but we most definitely
want to iommu-map it, so that IPA can poke at the data within.

Reviewed-by: Alex Elder <elder@riscstar.com>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 drivers/net/ipa/ipa_data.h |  9 +++++++--
 drivers/net/ipa/ipa_mem.c  | 24 +++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h
index 2fd03f0799b2..f3bdc64cef05 100644
--- a/drivers/net/ipa/ipa_data.h
+++ b/drivers/net/ipa/ipa_data.h
@@ -185,8 +185,13 @@ struct ipa_resource_data {
 struct ipa_mem_data {
 	u32 local_count;
 	const struct ipa_mem *local;
-	u32 imem_addr;
-	u32 imem_size;
+
+	/* These values are now passed via DT, but to support
+	 * older systems we must allow this to be specified here.
+	 */
+	u32 imem_addr; /* DEPRECATED */
+	u32 imem_size; /* DEPRECATED */
+
 	u32 smem_size;
 };
 
diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
index 835a3c9c1fd4..078d32a18dbf 100644
--- a/drivers/net/ipa/ipa_mem.c
+++ b/drivers/net/ipa/ipa_mem.c
@@ -7,6 +7,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/iommu.h>
+#include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 
@@ -617,7 +618,9 @@ static void ipa_smem_exit(struct ipa *ipa)
 int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev,
 		 const struct ipa_mem_data *mem_data)
 {
+	struct device_node *ipa_slice_np;
 	struct device *dev = &pdev->dev;
+	u32 imem_base, imem_size;
 	struct resource *res;
 	int ret;
 
@@ -656,7 +659,26 @@ int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev,
 	ipa->mem_addr = res->start;
 	ipa->mem_size = resource_size(res);
 
-	ret = ipa_imem_init(ipa, mem_data->imem_addr, mem_data->imem_size);
+	ipa_slice_np = of_parse_phandle(dev->of_node, "sram", 0);
+	if (ipa_slice_np) {
+		struct resource sram_res;
+
+		ret = of_address_to_resource(ipa_slice_np, 0, &sram_res);
+		of_node_put(ipa_slice_np);
+		if (ret)
+			goto err_unmap;
+
+		imem_base = sram_res.start;
+		imem_size = resource_size(&sram_res);
+	} else {
+		/* Backwards compatibility for DTs lacking
+		 * an explicit reference
+		 */
+		imem_base = mem_data->imem_addr;
+		imem_size = mem_data->imem_size;
+	}
+
+	ret = ipa_imem_init(ipa, imem_base, imem_size);
 	if (ret)
 		goto err_unmap;
 

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT
  2026-03-02 15:58 [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
                   ` (2 preceding siblings ...)
  2026-03-02 15:58 ` [PATCH net-next v6 3/3] net: ipa: Grab IMEM slice base/size from DTS Konrad Dybcio
@ 2026-03-04  1:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-04  1:30 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: robh, krzk+dt, conor+dt, andersson, andrew+netdev, davem,
	edumazet, kuba, pabeni, elder, marijn.suijten, linux-arm-msm,
	devicetree, linux-kernel, netdev, konrad.dybcio,
	krzysztof.kozlowski, elder, dmitry.baryshkov, horms, krzk

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 02 Mar 2026 16:58:42 +0100 you wrote:
> This adds the necessary driver change to migrate over from
> hardcoded-per-IPA-version-but-varying-per-implementation numbers, while
> unfortunately keeping them in there for backwards compatibility.
> 
> The DT changes will be submitted in a separate series, this one is OK
> to merge independently.
> 
> [...]

Here is the summary with links:
  - [net-next,v6,1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode
    https://git.kernel.org/netdev/net-next/c/ca4c7771a059
  - [net-next,v6,2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice
    https://git.kernel.org/netdev/net-next/c/f5a598abfdd9
  - [net-next,v6,3/3] net: ipa: Grab IMEM slice base/size from DTS
    https://git.kernel.org/netdev/net-next/c/6f82cb4ecdb4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-04  1:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 15:58 [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
2026-03-02 15:58 ` [PATCH net-next v6 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode Konrad Dybcio
2026-03-02 15:58 ` [PATCH net-next v6 2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice Konrad Dybcio
2026-03-02 15:58 ` [PATCH net-next v6 3/3] net: ipa: Grab IMEM slice base/size from DTS Konrad Dybcio
2026-03-04  1:30 ` [net-next PATCH v6 0/3] Grab IPA IMEM slice through DT patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox