Skip to contentSkip to conversation

arm64: dts: marvell: armada-37xx: reserve memory for ATF

PATCH New Miquel Raynal 2 participants 5 messages Apr 21, 2018 – Apr 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: marvell: armada-37xx: reserve memory for ATF

From: Victor Gu <[email protected]>

The PSCI area should be reserved in Linux for PSCI operations such as suspend/resume.

Reserve 2MiB of memory which matches the area used by ATF (BL1, BL2, BL3x, see [1] in ATF source code). This covers all PSCI code and data area and is 2MiB aligned, which is required by Linux for huge pages handling.

[1] plat/marvell/a3700/common/include/platform_def.h

[miquel.raynal at bootlin.com: reword of commit message]
---
 arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +11 -0
index 97207a61bc79..429ce91bfc39 100644
@@ -22,6 +22,17 @@
 		serial1 = &uart1;
 	};
 
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		psci-area at 4000000 {
+			reg = <0 0x4000000 0 0x200000>;
+			no-map;
+		};
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 arm64: dts: marvell: armada-37xx: reserve memory for ATF

Hello,

Quoted 10 lines · Miquel Raynal

From: Victor Gu <[email protected]>

The PSCI area should be reserved in Linux for PSCI operations such as suspend/resume.

Reserve 2MiB of memory which matches the area used by ATF (BL1, BL2, BL3x, see [1] in ATF source code). This covers all PSCI code and data area and is 2MiB aligned, which is required by Linux for huge pages handling.

Quoted 5 lines

[1] plat/marvell/a3700/common/include/platform_def.h

[miquel.raynal at bootlin.com: reword of commit message]

Shouldn't this be done automatically by the bootloader, before passing the DTB to the kernel ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 arm64: dts: marvell: armada-37xx: reserve memory for ATF

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 10 lines · Miquel Raynal

From: Victor Gu <[email protected]>

The PSCI area should be reserved in Linux for PSCI operations such as suspend/resume.

Reserve 2MiB of memory which matches the area used by ATF (BL1, BL2, BL3x, see [1] in ATF source code). This covers all PSCI code and data area and is 2MiB aligned, which is required by Linux for huge pages handling.

Quoted 8 lines
Quoted 5 lines

[1] plat/marvell/a3700/common/include/platform_def.h

[miquel.raynal at bootlin.com: reword of commit message]

Shouldn't this be done automatically by the bootloader, before passing the DTB to the kernel ?

I am working with a 2017.09 mainline U-Boot.

I did not know the bootloader was supposedly in charge of that. But what if it fails doing it? Fixing the bootloader is one thing, I assume very few people would update it. Is it worth keeping this in Linux DT?

Thanks,
Miqu?l

Signature · 3 lines
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 arm64: dts: marvell: armada-37xx: reserve memory for ATF

Hello,

Quoted 6 lines · Miquel Raynal
Quoted 2 lines

Shouldn't this be done automatically by the bootloader, before passing the DTB to the kernel ?

I am working with a 2017.09 mainline U-Boot.

I did not know the bootloader was supposedly in charge of that.

I thought it should be the case, but I indeed see nothing in U-Boot that does that, except for OMAP2 platforms.

Quoted 1 line

But what if it fails doing it?

Well if something fails in the boot process, the platform fails to boot. I find this question a bit weird/silly. It's like "and what if the user used the wrong DT for the wrong platform ?"

Quoted 2 lines

Fixing the bootloader is one thing, I assume very few people would update it. Is it worth keeping this in Linux DT?

The issue I see with having this in the Linux DT is that depending on the bootloader, the memory area that is used to keep the PSCI firmware may very well be different. It's really not a property of the HW itself, but a pure software choice of the bootloader. For example, are you sure the mainline U-Boot puts the PSCI firmware at the same place as the vendor U-Boot ?

What are other platforms doing to solve this problem ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 arm64: dts: marvell: armada-37xx: reserve memory for ATF

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Miquel Raynal
Quoted 2 lines

Shouldn't this be done automatically by the bootloader, before passing the DTB to the kernel ?

I am working with a 2017.09 mainline U-Boot.

I did not know the bootloader was supposedly in charge of that.

Quoted 8 lines

I thought it should be the case, but I indeed see nothing in U-Boot that does that, except for OMAP2 platforms.

Quoted 1 line

But what if it fails doing it?

Well if something fails in the boot process, the platform fails to boot. I find this question a bit weird/silly. It's like "and what if the user used the wrong DT for the wrong platform ?"

Sorry, I meant "what if the bootloader does not do it?", in other
words: currently the bootloader does not do it, let's assume it should, shall we take into account that it does not and add this code to Linux too, or shall we say to people "upgrade your bootloader/ATF"? But from the rest of your answer I assume the latter is the right approach.

Quoted 4 lines
Quoted 3 lines

Fixing the bootloader is one thing, I assume very few people would update it. Is it worth keeping this in Linux DT?

Quoted 8 lines

The issue I see with having this in the Linux DT is that depending on the bootloader, the memory area that is used to keep the PSCI firmware may very well be different. It's really not a property of the HW itself, but a pure software choice of the bootloader. For example, are you sure the mainline U-Boot puts the PSCI firmware at the same place as the vendor U-Boot ?

What are other platforms doing to solve this problem ?

I will also check if it is actually U-Boot or ATF choice. My understanding is that ATF's handle the PSCI firmware but U-Boot should propagate a reserved node (for this firmware) in Linux's DTB. Let me check all of that.

Quoted 4 lines

Best regards,

Thomas

Thanks,
Miqu?l

Signature · 3 lines
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com