Skip to contentSkip to conversation

arm64: dts: ti: k3-am64-main: Add SYSFW reserved ranges in OCRAM

PATCH Superseded Vignesh Raghavendra 4 participants 8 messages Jun 9, 2021 – Jun 14, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

PATCH 1/1 arm64: dts: ti: k3-am64-main: Add SYSFW reserved ranges in OCRAM

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

---
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am64-main.dtsi +4 -0
index f1c42ef05e52..77b88e536534 100644
@@ -16,6 +16,10 @@ oc_sram: sram@70000000 {
 		atf-sram@0 {
 			reg = <0x0 0x1a000>;
 		};
+
+		dmsc-sram@1c0000 {
+			reg = <0x1c0000 0x40000>;
+		};
 	};
 
 	gic500: interrupt-controller@1800000 {
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

You might want to re-base on top of Aswath's patch updating ATF address. Otherwise:

Thanks and regards,
Lokesh

author maintainer
#2 lore raw
Quoted 12 lines · Lokesh Vutla
Quoted 9 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

Quoted 6 lines
Quoted 1 line

You might want to re-base on top of Aswath's patch updating ATF address. Otherwise:

Actually, this patch should go in before Aswath's patch as moving ATF location around exposed issue of drivers getting memory allocations overlapping SYSFW reserved ranges

Regards
Vignesh

maintainer
#3 lore raw
Quoted 17 lines · Vignesh Raghavendra
Quoted 14 lines · Lokesh Vutla
Quoted 10 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

Quoted 8 lines
Quoted 4 lines

You might want to re-base on top of Aswath's patch updating ATF address. Otherwise:

Actually, this patch should go in before Aswath's patch as moving ATF location around exposed issue of drivers getting memory allocations overlapping SYSFW reserved ranges

I have applied Aswath's patch, please rebase. understood this is a bug, but either way, it really was'nt a regression of stuff that was present.

please fix and send asap so that I can pick it up.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
maintainer
#4 lore raw
In reply to Vignesh Raghavendra
Quoted 3 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Are you really sure?? I know that I had set a budget for 16K in sysfw when I did the memory split up for sysfw of which 16k is actually used.

Not sure where this 256K bucket started off from.. am I missing something here?

Quoted 30 lines

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

---
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am64-main.dtsi +4 -0
index f1c42ef05e52..77b88e536534 100644
@@ -16,6 +16,10 @@ oc_sram: sram@70000000 {
 		atf-sram@0 {
 			reg = <0x0 0x1a000>;
 		};
+
+		dmsc-sram@1c0000 {
+			reg = <0x1c0000 0x40000>;
 
+		};
 	};
 

gic500: interrupt-controller@1800000 {

Signature · 1 line
2.31.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
author maintainer
#5 lore raw

+Aswath

Quoted 11 lines · Nishanth Menon
Quoted 3 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Are you really sure?? I know that I had set a budget for 16K in sysfw when I did the memory split up for sysfw of which 16k is actually used.

Not sure where this 256K bucket started off from.. am I missing something here?

Per: http://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am64x/firewalls.html

24 dmsc 0x44060000 0x4407BFFF dmsc,rwcd // alias for 0x701E0000
24 dmsc 0x701FC000 0x701FFFFF sproxy_private,rwcd
24 dmsc 0x4407C000 0x4407FFFF sproxy_private,rwcd
24 dmsc 0x701C0000 0x701DFFFF everyone,rwcd

So it looks like only 128K@0x701E0000 is firewalled off. Will update the patch.

This makes me wonder why ATF is being moved to 0x701a0000-0x701c0000 leaving a hole at 0x701C0000-0x701DFFFF?

Quoted 32 lines
Quoted 31 lines

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

---
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am64-main.dtsi +4 -0
index f1c42ef05e52..77b88e536534 100644
@@ -16,6 +16,10 @@ oc_sram: sram@70000000 {
 		atf-sram@0 {
 			reg = <0x0 0x1a000>;
 		};
+
+		dmsc-sram@1c0000 {
+			reg = <0x1c0000 0x40000>;
 
+		};
 	};
 

gic500: interrupt-controller@1800000 {

Signature · 1 line
2.31.1
#6 lore raw

Hi Vignesh,

Quoted 22 lines · Vignesh Raghavendra

+Aswath

Quoted 11 lines · Nishanth Menon
Quoted 3 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Are you really sure?? I know that I had set a budget for 16K in sysfw when I did the memory split up for sysfw of which 16k is actually used.

Not sure where this 256K bucket started off from.. am I missing something here?

Per: http://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am64x/firewalls.html

24 dmsc 0x44060000 0x4407BFFF dmsc,rwcd // alias for 0x701E0000
24 dmsc 0x701FC000 0x701FFFFF sproxy_private,rwcd
24 dmsc 0x4407C000 0x4407FFFF sproxy_private,rwcd
24 dmsc 0x701C0000 0x701DFFFF everyone,rwcd

Quoted 7 lines

So it looks like only 128K@0x701E0000 is firewalled off. Will update the patch.

This makes me wonder why ATF is being moved to 0x701a0000-0x701c0000 leaving a hole at 0x701C0000-0x701DFFFF?

The reason for leaving the hole at 0x701C0000-0x701DFFFF was because initially there was a bug in SYSFW which lead to the usage of the above region too by it. However, this bug was recently fixed and the the above region can be used for ATF.

Thanks,
Aswath

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines

Without this certain drivers using SRAM as generic shared memory pool may end up being allocated memory from this range and will lead to boot time crash when the reserved range is accessed (due to firewall violation).

---
 arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am64-main.dtsi +4 -0
index f1c42ef05e52..77b88e536534 100644
@@ -16,6 +16,10 @@ oc_sram: sram@70000000 {
 		atf-sram@0 {
 			reg = <0x0 0x1a000>;
 		};
+
+		dmsc-sram@1c0000 {
+			reg = <0x1c0000 0x40000>;
 
+		};
 	};
 

gic500: interrupt-controller@1800000 {

Signature · 1 line
2.31.1
maintainer
#7 lore raw
Quoted 33 lines · Aswath Govindraju

Hi Vignesh,

Quoted 22 lines · Vignesh Raghavendra

+Aswath

Quoted 11 lines · Nishanth Menon
Quoted 3 lines · Vignesh Raghavendra

Last 256K of OCRAM (256K@0x701c0000) is reserved for SYSFW usage. Hence add an entry in DT so that its not used for generic pool memory allocation.

Are you really sure?? I know that I had set a budget for 16K in sysfw when I did the memory split up for sysfw of which 16k is actually used.

Not sure where this 256K bucket started off from.. am I missing something here?

Per: http://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am64x/firewalls.html

24 dmsc 0x44060000 0x4407BFFF dmsc,rwcd // alias for 0x701E0000
24 dmsc 0x701FC000 0x701FFFFF sproxy_private,rwcd
24 dmsc 0x4407C000 0x4407FFFF sproxy_private,rwcd
24 dmsc 0x701C0000 0x701DFFFF everyone,rwcd

Quoted 7 lines

So it looks like only 128K@0x701E0000 is firewalled off. Will update the patch.

This makes me wonder why ATF is being moved to 0x701a0000-0x701c0000 leaving a hole at 0x701C0000-0x701DFFFF?

Quoted 4 lines

The reason for leaving the hole at 0x701C0000-0x701DFFFF was because initially there was a bug in SYSFW which lead to the usage of the above region too by it. However, this bug was recently fixed and the the above region can be used for ATF.

OK. I am going to drop the TF-A update patch from my queue.

NOTE:
a) Default device configuration (if no specific API call[1]) is done assumes last 128K is reserved.
b) if bootloader does invoke optionally a call[1] then only 16K is reserved for communication and remainder of 128K is released for usage with the constraint that TF-A/OPTEE takes control of security resources.
c) This is only a feature in AM64x devices so, handling is device specific.

Hence, on AM64x: (a) should be our default configuration and (b) can be board specific configuration OR overlay depending on bootloader capability.

[1] http://downloads.ti.com/tisci/esd/latest/6_topic_user_guides/security_handover.html#triggering-security-handover

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D