Skip to contentSkip to conversation

net: ipa: enable IPA v4.7 support

PATCH Applied Alex Elder 7 participants 13 messages Dec 8, 2022 – Dec 30, 2022

Subsystems (5)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover net: ipa: enable IPA v4.7 support

The first patch in this series adds "qcom,sm6350-ipa" as a possible IPA compatible string, for the Qualcomm SM6350 SoC. That SoC uses IPA v4.7

The second patch in this series adds code that enables support for IPA v4.7. DTS updates that make use of these will be merged later.

-Alex

Alex Elder (1):
net: ipa: add IPA v4.7 support

Luca Weiss (1):
dt-bindings: net: qcom,ipa: Add SM6350 compatible

 .../devicetree/bindings/net/qcom,ipa.yaml     |   1 +
 drivers/net/ipa/Makefile                      |   2 +-
 drivers/net/ipa/data/ipa_data-v4.7.c          | 405 ++++++++++++++
 drivers/net/ipa/ipa_data.h                    |   1 +
 drivers/net/ipa/ipa_main.c                    |   4 +
 drivers/net/ipa/ipa_reg.c                     |   2 +
 drivers/net/ipa/ipa_reg.h                     |   1 +
 drivers/net/ipa/ipa_version.h                 |   1 +
 drivers/net/ipa/reg/ipa_reg-v4.7.c            | 507 ++++++++++++++++++
 9 files changed, 923 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ipa/data/ipa_data-v4.7.c
 create mode 100644 drivers/net/ipa/reg/ipa_reg-v4.7.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 dt-bindings: net: qcom,ipa: Add SM6350 compatible

From: Luca Weiss <[email protected]>

Add support for SM6350, which uses IPA v4.7.

---
 Documentation/devicetree/bindings/net/qcom,ipa.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/qcom,ipa.yaml +1 -0
index 9e81b9ec7cfdd..4aeda379726fa 100644
@@ -49,6 +49,7 @@ properties:
       - qcom,sc7280-ipa
       - qcom,sdm845-ipa
       - qcom,sdx55-ipa
+      - qcom,sm6350-ipa
       - qcom,sm8350-ipa
 
   reg:
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: Add SM6350 compatible

In reply to Alex Elder
Quoted 6 lines · Alex Elder

From: Luca Weiss <[email protected]>

Add support for SM6350, which uses IPA v4.7.

Quoted 19 lines
---
 Documentation/devicetree/bindings/net/qcom,ipa.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/qcom,ipa.yaml +1 -1
index 9e81b9ec7cfdd..4aeda379726fa 100644
@@ -49,6 +49,7 @@ properties:
       - qcom,sc7280-ipa
       - qcom,sdm845-ipa
       - qcom,sdx55-ipa
+      - qcom,sm6350-ipa
       - qcom,sm8350-ipa
 
   reg:
--

2.34.1

Signature · 2 lines
Kind Regards,
Caleb (they/them)
author
#4 lore raw

PATCH 2/2 net: ipa: add IPA v4.7 support

In reply to Alex Elder

Add the necessary register and data definitions needed for IPA v4.7, which is found on the SM6350 SoC.

---
 drivers/net/ipa/Makefile             |   2 +-
 drivers/net/ipa/data/ipa_data-v4.7.c | 405 +++++++++++++++++++++
 drivers/net/ipa/ipa_data.h           |   1 +
 drivers/net/ipa/ipa_main.c           |   4 +
 drivers/net/ipa/ipa_reg.c            |   2 +
 drivers/net/ipa/ipa_reg.h            |   1 +
 drivers/net/ipa/ipa_version.h        |   1 +
 drivers/net/ipa/reg/ipa_reg-v4.7.c   | 507 +++++++++++++++++++++++++++
 8 files changed, 922 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ipa/data/ipa_data-v4.7.c
 create mode 100644 drivers/net/ipa/reg/ipa_reg-v4.7.c
drivers/net/ipa/Makefile +1 -1
index 48255fc4b25c3..8cdcaaf58ae34 100644
@@ -2,7 +2,7 @@
 #
 # Makefile for the Qualcomm IPA driver.
 
-IPA_VERSIONS		:=	3.1 3.5.1 4.2 4.5 4.9 4.11
+IPA_VERSIONS		:=	3.1 3.5.1 4.2 4.5 4.7 4.9 4.11
 
 obj-$(CONFIG_QCOM_IPA)	+=	ipa.o
 
drivers/net/ipa/data/ipa_data-v4.7.c new file +405 -0

405 lines not on this page · raw message

drivers/net/ipa/ipa_data.h +1 -0
index 412edbfac7862..818e64114ed50 100644
@@ -246,6 +246,7 @@ extern const struct ipa_data ipa_data_v3_1;
 extern const struct ipa_data ipa_data_v3_5_1;
 extern const struct ipa_data ipa_data_v4_2;
 extern const struct ipa_data ipa_data_v4_5;
+extern const struct ipa_data ipa_data_v4_7;
 extern const struct ipa_data ipa_data_v4_9;
 extern const struct ipa_data ipa_data_v4_11;
 
drivers/net/ipa/ipa_main.c +4 -0
index 8f20825675a1a..4fb92f7719741 100644
@@ -662,6 +662,10 @@ static const struct of_device_id ipa_match[] = {
 		.compatible	= "qcom,sdx55-ipa",
 		.data		= &ipa_data_v4_5,
 	},
+	{
+		.compatible	= "qcom,sm6350-ipa",
+		.data		= &ipa_data_v4_7,
+	},
 	{
 		.compatible	= "qcom,sm8350-ipa",
 		.data		= &ipa_data_v4_9,
drivers/net/ipa/ipa_reg.c +2 -0
index 22f067741d9b2..ddd529153e15c 100644
@@ -86,6 +86,8 @@ static const struct ipa_regs *ipa_regs(enum ipa_version version)
 		return &ipa_regs_v4_2;
 	case IPA_VERSION_4_5:
 		return &ipa_regs_v4_5;
+	case IPA_VERSION_4_7:
+		return &ipa_regs_v4_7;
 	case IPA_VERSION_4_9:
 		return &ipa_regs_v4_9;
 	case IPA_VERSION_4_11:
drivers/net/ipa/ipa_reg.h +1 -0
index 7bf70f70f63fe..ff64b19a4df8b 100644
@@ -658,6 +658,7 @@ extern const struct ipa_regs ipa_regs_v3_1;
 extern const struct ipa_regs ipa_regs_v3_5_1;
 extern const struct ipa_regs ipa_regs_v4_2;
 extern const struct ipa_regs ipa_regs_v4_5;
+extern const struct ipa_regs ipa_regs_v4_7;
 extern const struct ipa_regs ipa_regs_v4_9;
 extern const struct ipa_regs ipa_regs_v4_11;
 
drivers/net/ipa/ipa_version.h +1 -0
index 7889c310e943d..d15821467743a 100644
@@ -48,6 +48,7 @@ static inline bool ipa_version_supported(enum ipa_version version)
 	case IPA_VERSION_3_5_1:
 	case IPA_VERSION_4_2:
 	case IPA_VERSION_4_5:
+	case IPA_VERSION_4_7:
 	case IPA_VERSION_4_9:
 	case IPA_VERSION_4_11:
 	case IPA_VERSION_5_0:
drivers/net/ipa/reg/ipa_reg-v4.7.c new file +507 -0

507 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 7 lines · Alex Elder

Add the necessary register and data definitions needed for IPA v4.7, which is found on the SM6350 SoC.

---

[...]

drivers/net/ipa/data/ipa_data-v4.7.c line 361

Quoted 7 lines
drivers/net/ipa/data/ipa_data-v4.7.c new file +7 -0
+
+/* Memory configuration data for an SoC having IPA v4.7 */
+static const struct ipa_mem_data ipa_mem_data = {
+	.local_count	= ARRAY_SIZE(ipa_mem_local_data),
+	.local		= ipa_mem_local_data,
+	.imem_addr	= 0x146a9000,
+	.imem_size	= 0x00002000,

Should probably be

0x146a8000
0x00003000

with an appropriate change in dt to reserve that region.

Qualcomm does:
ipa@... { qcom,additional-mapping = <0x146a8000 0x146a8000 0x2000>; };

which covers 0x146a8000-0x146a9fff

plus

imem@.. { reg = <0x146aa000 0x1000>; };

which in total gives us 0x146a8000-0x146aafff

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

Konrad

author
#6 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 28 lines · Konrad Dybcio
Quoted 7 lines · Alex Elder

Add the necessary register and data definitions needed for IPA v4.7, which is found on the SM6350 SoC.

---

[...]

drivers/net/ipa/data/ipa_data-v4.7.c line 361

Quoted 7 lines
drivers/net/ipa/data/ipa_data-v4.7.c new file +7 -0
+
+/* Memory configuration data for an SoC having IPA v4.7 */
+static const struct ipa_mem_data ipa_mem_data = {
+	.local_count	= ARRAY_SIZE(ipa_mem_local_data),
+	.local		= ipa_mem_local_data,
+	.imem_addr	= 0x146a9000,
+	.imem_size	= 0x00002000,

Should probably be

0x146a8000
0x00003000

with an appropriate change in dt to reserve that region.

Qualcomm does:
ipa@... { qcom,additional-mapping = <0x146a8000 0x146a8000 0x2000>; };

Quoted 7 lines

which covers 0x146a8000-0x146a9fff

plus

imem@.. { reg = <0x146aa000 0x1000>; };

which in total gives us 0x146a8000-0x146aafff

Can you tell me where you found this information?

Quoted 2 lines

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

This region is used by the modem, but must be set up by the AP.

Quoted 2 lines

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

On SM7250 (sorry, I don't know about 7225, or 6350 for that matter), the IMEM starts at 0x14680000 and has length 0x2c000. However that memory is used by multiple entities. The portion set aside for IPA starts at 0x146a9000 and has size 0x2000.

-Alex

Quoted 1 line

Konrad

#7 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 31 lines · Alex Elder
Quoted 30 lines · Konrad Dybcio
Quoted 7 lines · Alex Elder

Add the necessary register and data definitions needed for IPA v4.7, which is found on the SM6350 SoC.

---

[...]

drivers/net/ipa/data/ipa_data-v4.7.c line 361

Quoted 7 lines
drivers/net/ipa/data/ipa_data-v4.7.c new file +7 -0
+
+/* Memory configuration data for an SoC having IPA v4.7 */
+static const struct ipa_mem_data ipa_mem_data = {
+    .local_count    = ARRAY_SIZE(ipa_mem_local_data),
+    .local        = ipa_mem_local_data,
+    .imem_addr    = 0x146a9000,
+    .imem_size    = 0x00002000,

Should probably be

0x146a8000
0x00003000

with an appropriate change in dt to reserve that region.

Qualcomm does:
ipa@... { qcom,additional-mapping = <0x146a8000 0x146a8000 0x2000>; };

which covers 0x146a8000-0x146a9fff

Quoted 7 lines
Quoted 5 lines

plus

imem@.. { reg = <0x146aa000 0x1000>; };

which in total gives us 0x146a8000-0x146aafff

Can you tell me where you found this information?

[1], [2]

Quoted 7 lines
Quoted 3 lines

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

This region is used by the modem, but must be set up by the AP.

Quoted 8 lines
Quoted 2 lines

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

On SM7250 (sorry, I don't know about 7225, or 6350 for that matter), the IMEM starts at 0x14680000 and has length 0x2c000.  However that memory is used by multiple entities.  The portion set aside for IPA starts at 0x146a9000 and has size 0x2000.

Not sure how 7250 relates to 6350, but I don't think there's much overlap..

Konrad

[1] https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.12.r1/arch/arm64/boot/dts/qcom/lagoon.dtsi#L3698-L3707

[2] https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.12.r1/arch/arm64/boot/dts/qcom/lagoon.dtsi#L1004-L1045

Quoted 4 lines

                    -Alex

Quoted 1 line

Konrad

maintainer
#8 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 15 lines · On Sat, 10 Dec 2022 10:31:14 +0100 Konrad Dybcio wrote:
Quoted 3 lines
Quoted 1 line

which in total gives us 0x146a8000-0x146aafff

Can you tell me where you found this information?

[1], [2]

Quoted 10 lines
Quoted 3 lines

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

This region is used by the modem, but must be set up by the AP.

Quoted 2 lines

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

Quoted 7 lines
Quoted 5 lines

On SM7250 (sorry, I don't know about 7225, or 6350 for that matter), the IMEM starts at 0x14680000 and has length 0x2c000.  However that memory is used by multiple entities.  The portion set aside for IPA starts at 0x146a9000 and has size 0x2000.

Not sure how 7250 relates to 6350, but I don't think there's much overlap..

Dunno if Alex is online, and the patches seem harmless so let me apply as is so that they make 6.2, and we can follow up with corrections.

#9 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 16 lines · Jakub Kicinski
Quoted 2 lines
Quoted 1 line

which in total gives us 0x146a8000-0x146aafff

Can you tell me where you found this information?

[1], [2]

Quoted 12 lines
Quoted 3 lines

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

This region is used by the modem, but must be set up by the AP.

Quoted 2 lines

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

On SM7250 (sorry, I don't know about 7225, or 6350 for that matter), the IMEM starts at 0x14680000 and has length 0x2c000.  However that memory is used by multiple entities.  The portion set aside for IPA starts at 0x146a9000 and has size 0x2000.

This is awesome, thank you!

Yes I think there are a couple of minor corrections to make but I haven't had the time to go do the research yet, so hadn't yet responded.

Nothing is "supported" upstream anyway until there's a system with a DTS that uses it, and that won't happen until after the end of the merge window.

Again, thank you very much, it's a safe thing to take for now.

-Alex

author
#10 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

In reply to Konrad Dybcio
Quoted 7 lines · Konrad Dybcio
Quoted 4 lines · Alex Elder
Quoted 3 lines · Konrad Dybcio

On 8.12.2022 22:15, Alex Elder wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Add the necessary register and data definitions needed for IPA v4.7, which is found on the SM6350 SoC.

---

[...]

I'm finally getting back to this... I'm about to send an update to net-next to address your comment. But before doing that I'm going to explain my thinking on it.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/net/ipa/data/ipa_data-v4.7.c line 361

Quoted 7 lines
drivers/net/ipa/data/ipa_data-v4.7.c new file +7 -0
+
+/* Memory configuration data for an SoC having IPA v4.7 */
+static const struct ipa_mem_data ipa_mem_data = {
+    .local_count    = ARRAY_SIZE(ipa_mem_local_data),
+    .local        = ipa_mem_local_data,
+    .imem_addr    = 0x146a9000,
+    .imem_size    = 0x00002000,

Should probably be

0x146a8000
0x00003000

The IMEM memory region is a distinct from main memory, but is "local" to certain parts of the SoC and is used for specific things for faster access. The size and location of this region differs per-SoC. Previously I believed this to be the same for a given version of IPA, and as such the range was defined in the "config data". But I now know that is not the case, and during this release cycle I intend to get that fixed.

Anyway, for a given SoC, the whole IMEM region is used by different entities. For SM7550, for example, it is divided into 6 parts of various sizes (100KB, 24KB, 32KB, 8KB, 8KB, and 4KB). For IPA on this SoC, the offset is 0x146a9000, with size 0x2000. Hence the range defined above.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

with an appropriate change in dt to reserve that region.

Qualcomm does:
ipa@... { qcom,additional-mapping = <0x146a8000 0x146a8000 0x2000>; };

which covers 0x146a8000-0x146a9fff

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

plus

imem@.. { reg = <0x146aa000 0x1000>; };

which in total gives us 0x146a8000-0x146aafff

Can you tell me where you found this information?

[1], [2]

Following the first link, I see that this Sony device (which uses IPA v4.7) uses MSM7225 as its SoC. I am not able to verify the values shown in the DTS file elsewhere, so in this case, that DTS file is my best source for information.

The first link defines the IPA portion of IMEM at offset 0x146a8000, size 0x2000. That's what I'll use here instead.

The other region you mention (in the second link) appears to be a distinct part, which follows the part set aside for IPA to use. For SM7550, that part is "shared" and immediately follows the IPA part, with size 0x1000. So I believe that is what the qcom,msm-imem@146aa000 is defining in the second link you supply.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

That would also mean all of your writes are kind of skewed, unless you already applied some offsets to them.

Luca tested the code the way I defined it initially and found it worked. It's possible the part of IMEM defined by my patch was just not used for it's intended purpose during his testing and therefore he saw no obvious problems.

My plan is to patch "ipa_data-v4.7.c" to change the IMEM region to have offset 0x146a8000, size 0x2000, as you suggested. I will supply this to Luca for testing (actually I think he already did), and we'll go with that as the final location for the IPA portion of IMEM for IPA v4.7.

Later (sometime soon) the definition of this IPA IMEM area will get done differently--not defined in the "config data" files and instead defined in DTS. There is already an imem node available (for example imem@146a5000 in "sc7280.dtsi"), so the fix *might* involve using that.

-Alex

Quoted 24 lines
Quoted 11 lines

This region is used by the modem, but must be set up by the AP.

Quoted 2 lines

(IMEM on 6350 starts at 0x14680000 and is 0x2e000 long, as per the bootloader memory map)

On SM7250 (sorry, I don't know about 7225, or 6350 for that matter), the IMEM starts at 0x14680000 and has length 0x2c000.  However that memory is used by multiple entities.  The portion set aside for IPA starts at 0x146a9000 and has size 0x2000.

Not sure how 7250 relates to 6350, but I don't think there's much overlap..

Konrad

[1] https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.12.r1/arch/arm64/boot/dts/qcom/lagoon.dtsi#L3698-L3707

[2] https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.9.12.r1/arch/arm64/boot/dts/qcom/lagoon.dtsi#L1004-L1045

Quoted 4 lines

                    -Alex

Quoted 1 line

Konrad

author
#11 lore raw

Re: [PATCH net-next 2/2] net: ipa: add IPA v4.7 support

Quoted 3 lines · Alex Elder

Anyway, for a given SoC, the whole IMEM region is used by different entities.  For SM7550, for example, it is

NOTE: This is a typo. I meant SM7250 above.

Quoted 4 lines

divided into 6 parts of various sizes (100KB, 24KB, 32KB, 8KB, 8KB, and 4KB).  For IPA on this SoC, the offset is 0x146a9000, with size 0x2000.  Hence the range defined above.

Konrad pointed out the error, I just want to be sure it's corrected so it's clear...

-Alex

#12 lore raw
In reply to Alex Elder
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 8 Dec 2022 15:15:27 -0600 you wrote:

The first patch in this series adds "qcom,sm6350-ipa" as a possible IPA compatible string, for the Qualcomm SM6350 SoC. That SoC uses IPA v4.7

The second patch in this series adds code that enables support for IPA v4.7. DTS updates that make use of these will be merged later.

[...]

Here is the summary with links:
- [net-next,1/2] dt-bindings: net: qcom,ipa: Add SM6350 compatible

    https://git.kernel.org/netdev/net-next/c/5071429f8281
  - [net-next,2/2] net: ipa: add IPA v4.7 support
    https://git.kernel.org/netdev/net-next/c/b310de784bac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html