Re: [PATCH net-next v3 3/3] net: ipa: Grab IMEM slice base/size from DTS
From: Alex Elder
Date: Tue Feb 17 2026 - 13:03:44 EST
On 2/17/26 7:30 AM, Konrad Dybcio wrote:
From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxx>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
I know I already provided Reviewed-by, but I have two
minor comments. (You can keep my tag even if you don't
incorporate what I suggest below.)
---
drivers/net/ipa/ipa_data.h | 4 ++++
drivers/net/ipa/ipa_mem.c | 21 ++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h
index 2fd03f0799b2..5fe164981083 100644
--- a/drivers/net/ipa/ipa_data.h
+++ b/drivers/net/ipa/ipa_data.h
@@ -185,8 +185,12 @@ struct ipa_resource_data {
struct ipa_mem_data {
u32 local_count;
const struct ipa_mem *local;
+
+ /* DEPRECATED (now passed via DT) fallback data,
+ * varies per chip and not per IPA version */
u32 imem_addr;
u32 imem_size;
Both the address and size are deprecated, and although you add
white space, I feel like you could be more explicit about saying
both are deprecated. For example, maybe more like this?
/* 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..583aea625709 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,23 @@ 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) {
+ ret = of_address_to_resource(ipa_slice_np, 0, res);
+ of_node_put(ipa_slice_np);
+ if (ret)
+ return ret;
+
+ imem_base = res->start;
+ imem_size = resource_size(res);
+ } else {
+ /* Backwards compatibility for DTs lacking
+ * an explicit reference */
I think netdev style says the end-of-comment should go on
the line below.
-Alex
+ 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;