Skip to contentSkip to conversation

arm64: dts: qcom: sdm845: Move reserved-memory to devices

PATCH Superseded Bjorn Andersson 2 participants 4 messages Feb 9, 2021 – Feb 10, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm64: dts: qcom: sdm845: Move reserved-memory to devices

The reserved-memory regions used for carrying firmware to be run on the various cores and co-processors in a Qualcomm platform differs in size, placement and presence based on each device's feature set and security configuration.

Rather than providing some basic set that works on the MTP and then piecemeal patch this up on the various devices, push the configuration of these regions out to the individual device dts files.

---
 arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi    | 89 +++++++++++++------
 arch/arm64/boot/dts/qcom/sdm845-db845c.dts    | 85 ++++++++++++++++++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts       | 87 ++++++++++++++++++
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 78 +++++++++++++++-
 .../boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 45 ++++++----
 arch/arm64/boot/dts/qcom/sdm845.dtsi          | 83 -----------------
 .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 86 ++++++++++++++++++
 7 files changed, 428 insertions(+), 125 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +64 -25
index 216a74f0057c..2f44785d1af0 100644
@@ -153,36 +153,66 @@ panel_in_edp: endpoint {
  * all modifications to the memory map (from sdm845.dtsi) in one place.
  */
 
-/*
- * Our mpss_region is 8MB bigger than the default one and that conflicts
- * with venus_mem and cdsp_mem.
- *
- * For venus_mem we'll delete and re-create at a different address.
- *
- * cdsp_mem isn't used on cheza right now so we won't bother re-creating it; but
- * that also means we need to delete cdsp_pas.
- */
-/delete-node/ &venus_mem;
-/delete-node/ &cdsp_mem;
-/delete-node/ &cdsp_pas;
-/delete-node/ &gpu_mem;
-
-/* Increase the size from 120 MB to 128 MB */
-&mpss_region {
-	reg = <0 0x8e000000 0 0x8000000>;
-};
-
-/* Increase the size from 2MB to 8MB */
-&rmtfs_mem {
-	reg = <0 0x88f00000 0 0x800000>;
-};
-
 / {
 	reserved-memory {
+		tz_mem: memory@86200000 {
+			reg = <0 0x86200000 0 0x2d00000>;
+			no-map;
+		};
+
+		rmtfs_mem: memory@88f00000 {
+			compatible = "qcom,rmtfs-mem";
+			reg = <0 0x88f00000 0 0x800000>;
+			no-map;
+
+			qcom,client-id = <1>;
+			qcom,vmid = <15>;
+		};
+
+		ipa_fw_mem: memory@8c400000 {
+			reg = <0 0x8c400000 0 0x10000>;
+			no-map;
+		};
+
+		ipa_gsi_mem: memory@8c410000 {
+			reg = <0 0x8c410000 0 0x5000>;
+			no-map;
+		};
+
+		adsp_mem: memory@8c500000 {
+			reg = <0 0x8c500000 0 0x1a00000>;
+			no-map;
+		};
+
+		wlan_msa_mem: memory@8df00000 {
+			reg = <0 0x8df00000 0 0x100000>;
+			no-map;
+		};
+
+		mpss_region: memory@8e000000 {
+			reg = <0 0x8e000000 0 0x8000000>;
+			no-map;
+		};
+
 		venus_mem: memory@96000000 {
 			reg = <0 0x96000000 0 0x500000>;
 			no-map;
 		};
+
+		mba_region: memory@96500000 {
+			reg = <0 0x96500000 0 0x200000>;
+			no-map;
+		};
+
+		slpi_mem: memory@96700000 {
+			reg = <0 0x96700000 0 0x1400000>;
+			no-map;
+		};
+
+		spss_mem: memory@97b00000 {
+			reg = <0 0x97b00000 0 0x100000>;
+			no-map;
+		};
 	};
 };
 
@@ -206,7 +236,6 @@ flash@0 {
 	};
 };
 
-
 &apps_rsc {
 	pm8998-rpmh-regulators {
 		compatible = "qcom,pm8998-rpmh-regulators";
@@ -645,6 +674,14 @@ &adreno_smmu {
 &mss_pil {
 	iommus = <&apps_smmu 0x781 0x0>,
 		 <&apps_smmu 0x724 0x3>;
+
+	mba {
+		memory-region = <&mba_region>;
+	};
+
+	mpss {
+		memory-region = <&mpss_region>;
+	};
 };
 
 &pm8998_pwrkey {
@@ -850,6 +887,7 @@ &usb_2_qmpphy {
 
 &wifi {
 	status = "okay";
+	memory-region = <&wlan_msa_mem>;
 
 	vdd-0.8-cx-mx-supply = <&src_pp800_l5a >;
 	vdd-1.8-xo-supply = <&pp1800_l7a_wcn3990>;
@@ -1321,6 +1359,7 @@ config {
 };
 
 &venus {
+	memory-region = <&venus_mem>;
 	video-firmware {
 		iommus = <&apps_smmu 0x10b2 0x0>;
 	};
arch/arm64/boot/dts/qcom/sdm845-db845c.dts +85 -0

115 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845-mtp.dts +87 -0

119 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +76 -2

116 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts +30 -15

83 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845.dtsi +0 -83

125 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +86 -0

122 lines not on this page · raw message

Signature · 1 line
2.30.0
#1 lore raw

PATCH 2/2 arm64: dts: qcom: sdm850-yoga: Enable IPA

The ipa_fws.elf found in the Lenovo Yoga C630 isn't packed like the one found in e.g. the MTP, so it doesn't fit in the "standard" ipa_fws memory region. Further more, authentication of ipa_fws at the usual base address is rejected by the Peripheral Authentication Service (in TrustZone), so some shuffling and trial and error was used to come up with acceptable regions.

With this in order, enable the IPA device.

---
 .../boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +13 -13
index 9c2ab377faf1..4dd5820b3b31 100644
@@ -74,28 +74,23 @@ rmtfs_mem: memory@88f00000 {
 			qcom,vmid = <15>;
 		};
 
-		ipa_fw_mem: memory@8c400000 {
-			reg = <0 0x8c400000 0 0x10000>;
+		wlan_msa_mem: memory@8c400000 {
+			reg = <0 0x8c400000 0 0x100000>;
 			no-map;
 		};
 
-		ipa_gsi_mem: memory@8c410000 {
-			reg = <0 0x8c410000 0 0x5000>;
+		gpu_mem: memory@8c515000 {
+			reg = <0 0x8c515000 0 0x2000>;
 			no-map;
 		};
 
-		gpu_mem: memory@8c415000 {
-			reg = <0 0x8c415000 0 0x2000>;
+		ipa_fw_mem: memory@8c517000 {
+			reg = <0 0x8c517000 0 0x5a000>;
 			no-map;
 		};
 
-		adsp_mem: memory@8c500000 {
-			reg = <0 0x8c500000 0 0x1a00000>;
-			no-map;
-		};
-
-		wlan_msa_mem: memory@8df00000 {
-			reg = <0 0x8df00000 0 0x100000>;
+		adsp_mem: memory@8c600000 {
+			reg = <0 0x8c600000 0 0x1a00000>;
 			no-map;
 		};
 
@@ -500,6 +495,11 @@ ecsh: hid@5c {
 	};
 };
 
+&ipa {
+	status = "okay";
+	memory-region = <&ipa_fw_mem>;
+};
+
 &mdss {
 	status = "okay";
 };
Signature · 1 line
2.30.0
#2 lore raw
In reply to Bjorn Andersson

Hi,

Quoted 11 lines · Bjorn Andersson
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -2
index 216a74f0057c..2f44785d1af0 100644
@@ -153,36 +153,66 @@ panel_in_edp: endpoint {
  * all modifications to the memory map (from sdm845.dtsi) in one place.
  */
 
-/*
- * Our mpss_region is 8MB bigger than the default one and that conflicts

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi panel_in_edp: endpoint { · line 167

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -10
- * with venus_mem and cdsp_mem.
- *
- * For venus_mem we'll delete and re-create at a different address.
- *
- * cdsp_mem isn't used on cheza right now so we won't bother re-creating it; but
- * that also means we need to delete cdsp_pas.
- */
-/delete-node/ &venus_mem;
-/delete-node/ &cdsp_mem;
-/delete-node/ &cdsp_pas;

Note to self: on cheza we'll end up with "cdsp_pas" existing now, but that _should_ be OK since it's disabled

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi config { · line 1365

Quoted 8 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +1 -0
@@ -1321,6 +1359,7 @@ config {
 };
 
 &venus {
+       memory-region = <&venus_mem>;
        video-firmware {
                iommus = <&apps_smmu 0x10b2 0x0>;
        };

slight nit: I think it looks ugly not to have a blank line between the property and the sub-node. ;-)

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi adsp_pas: remoteproc-adsp { · line 770

Quoted 6 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -2
@@ -766,8 +697,6 @@ adsp_pas: remoteproc-adsp {
                clocks = <&rpmhcc RPMH_CXO_CLK>;
                clock-names = "xo";
 
-               memory-region = <&adsp_mem>;
-

Note to self: we're losing the above on cheza, but that _should_ be OK since the node is disabled anyway.

Probably not critical at this point, but it makes me wonder whether we could remove adsp_mem on cheza...

---

So I only looked at the cheza and sdm845 changes and they look fine to me and this seems like a good change overall. I'm assuming that folks who focus on the other boards will double-check your work there if they care or just trust that everything is great. ;-)

OK, I lied. I took a quick glance. In "sdm845-db845c" you maybe miss adding the "memory-region" back to the WiFi? Have you tried running something like this before/after:

for f in sdm845*.dtb; do dtc -I dtb -O dts --sort $f > $f.dts; done

You've gotta ignore phandle ID differences but otherwise it'll point out things like this.

-Doug

#3 lore raw
Quoted 13 lines · Doug Anderson

Hi,

Quoted 9 lines · Bjorn Andersson
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -0
index 216a74f0057c..2f44785d1af0 100644
@@ -153,36 +153,66 @@ panel_in_edp: endpoint {
  * all modifications to the memory map (from sdm845.dtsi) in one place.
  */
 
Quoted 16 lines

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi panel_in_edp: endpoint { · line 167

Quoted 12 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -12
-/*
- * Our mpss_region is 8MB bigger than the default one and that conflicts
- * with venus_mem and cdsp_mem.
- *
- * For venus_mem we'll delete and re-create at a different address.
- *
- * cdsp_mem isn't used on cheza right now so we won't bother re-creating it; but
- * that also means we need to delete cdsp_pas.
- */
-/delete-node/ &venus_mem;
-/delete-node/ &cdsp_mem;
-/delete-node/ &cdsp_pas;

Note to self: on cheza we'll end up with "cdsp_pas" existing now, but that _should_ be OK since it's disabled

That was not intentional, but as you say it shouldn't make a difference.

Quoted 4 lines
Quoted 4 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -0
@@ -1321,6 +1359,7 @@ config {
 };
 
Quoted 9 lines

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi config { · line 1365

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +1 -0
 &venus {
+       memory-region = <&venus_mem>;
        video-firmware {
                iommus = <&apps_smmu 0x10b2 0x0>;
        };

slight nit: I think it looks ugly not to have a blank line between the property and the sub-node. ;-)

I agree, will go over and adjust this in v2.

Quoted 5 lines
Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -0
@@ -766,8 +697,6 @@ adsp_pas: remoteproc-adsp {
                clocks = <&rpmhcc RPMH_CXO_CLK>;
                clock-names = "xo";
 
Quoted 9 lines

arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi adsp_pas: remoteproc-adsp { · line 770

Quoted 2 lines
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +0 -2
-               memory-region = <&adsp_mem>;
-

Note to self: we're losing the above on cheza, but that _should_ be OK since the node is disabled anyway.

Probably not critical at this point, but it makes me wonder whether we could remove adsp_mem on cheza...

I noticed this too, but figured that this is an actual change, so it would be better to do in a separate commit - if that's desired.

Quoted 7 lines

---

So I only looked at the cheza and sdm845 changes and they look fine to me and this seems like a good change overall. I'm assuming that folks who focus on the other boards will double-check your work there if they care or just trust that everything is great. ;-)

Quoted 6 lines

OK, I lied. I took a quick glance. In "sdm845-db845c" you maybe miss adding the "memory-region" back to the WiFi? Have you tried running something like this before/after:

for f in sdm845*.dtb; do dtc -I dtb -O dts --sort $f > $f.dts; done

I was not aware of the --sort, so I did this by chaining together some more things in the shell to confirm that I didn't actually change any reserved-memory regions...

Quoted 3 lines

You've gotta ignore phandle ID differences but otherwise it'll point out things like this.

But as the phandles changed all over the place I looked only at the reserved-memory, will fix up the db845c wifi node and double check the rest of the nodes. Thanks for spotting this!

Regards,
Bjorn