Skip to contentSkip to conversation

ARM: dts: exynos4212-tab3: limit usable memory range

PATCH Applied Artur Weber 3 participants 8 messages Feb 17, 2024 – Mar 26, 2024

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

PATCH 1/1 ARM: dts: exynos4212-tab3: limit usable memory range

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
 arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +6 -0
index e5254e32aa8f..9bc05961577d 100644
@@ -45,6 +45,12 @@ chosen {
 		/* Default S-BOOT bootloader loads initramfs here */
 		linux,initrd-start = <0x42000000>;
 		linux,initrd-end = <0x42800000>;
+
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;
 	};
 
 	firmware@204f000 {

---
base-commit: 0f1dd5e91e2ba3990143645faff2bcce2d99778e
change-id: 20240217-tab3-limit-usable-memory-range-1d1ffa8dc44d

Best regards,

Signature · 1 line
Artur Weber <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw

Hi Artur,

Quoted 15 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
 arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +0 -0
index e5254e32aa8f..9bc05961577d 100644

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 9 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +6 -0
@@ -45,6 +45,12 @@ chosen {
 		/* Default S-BOOT bootloader loads initramfs here */
 		linux,initrd-start = <0x42000000>;
 		linux,initrd-end = <0x42800000>;
+
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Maybe it would make sense to set the memory reg to
<0x40000000 0x60000000> (1.5 GiB) and move the comment about last 512(/516) MiB being weird/broken here instead. It looks a bit weird that the memory range and usable-memory-range are identical, and device tree should describe hardware, which technically has 1.5 GiB RAM.

From a functional point of view it does not really matter, so in any case:

Quoted 12 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +0 -1
 	};
 
 	firmware@204f000 {
 
---

base-commit: 0f1dd5e91e2ba3990143645faff2bcce2d99778e
change-id: 20240217-tab3-limit-usable-memory-range-1d1ffa8dc44d

Best regards,

Signature · 1 line
Artur Weber <[email protected]>
#2 lore raw
In reply to Artur Weber
Quoted 15 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
 arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +0 -0
index e5254e32aa8f..9bc05961577d 100644

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 9 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +6 -0
@@ -45,6 +45,12 @@ chosen {
 		/* Default S-BOOT bootloader loads initramfs here */
 		linux,initrd-start = <0x42000000>;
 		linux,initrd-end = <0x42800000>;
+
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Applied and dropped:
chosen: linux,usable-memory-range:0: [4611686019496935424] is too short

Does not look you tested the bindings.

Please observe that we have dedicated subsystem profile since a release:
https://www.kernel.org/doc/html/latest/process/maintainers.html#arm-samsung-s3c-s5p-and-exynos-arm-architectures

Best regards,
Krzysztof

#3 lore raw
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
  arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
  1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +1 -0
index e5254e32aa8f..9bc05961577d 100644
@@ -45,6 +45,12 @@ chosen {
  		/* Default S-BOOT bootloader loads initramfs here */
  		linux,initrd-start = <0x42000000>;
  		linux,initrd-end = <0x42800000>;
+
Quoted 8 lines

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 5 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +5 -0
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Applied and dropped:
chosen: linux,usable-memory-range:0: [4611686019496935424] is too short

This seems to be a binding issue; the DT schema expects a 64-bit memory address and size, and doesn't allow a 32-bit range. I've tested the DTS on my device and this property seems to be handled fine, so I think this should allow 32-bit values as well.

I've opened a PR[1] against devicetree-org/dt-schema (where the schema for the chosen node is stored) to try and fix this. If my approach is incorrect, feel free to comment there as well.

Best regards
Artur

[1] https://github.com/devicetree-org/dt-schema/pull/128

Quoted 9 lines

Does not look you tested the bindings.

Please observe that we have dedicated subsystem profile since a release:
https://www.kernel.org/doc/html/latest/process/maintainers.html#arm-samsung-s3c-s5p-and-exynos-arm-architectures

Best regards,
Krzysztof

#4 lore raw
Quoted 30 lines · Artur Weber
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
  arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
  1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +1 -0
index e5254e32aa8f..9bc05961577d 100644
@@ -45,6 +45,12 @@ chosen {
  		/* Default S-BOOT bootloader loads initramfs here */
  		linux,initrd-start = <0x42000000>;
  		linux,initrd-end = <0x42800000>;
+
Quoted 8 lines

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 5 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +5 -0
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Applied and dropped:
chosen: linux,usable-memory-range:0: [4611686019496935424] is too short

Quoted 4 lines

This seems to be a binding issue; the DT schema expects a 64-bit memory address and size, and doesn't allow a 32-bit range. I've tested the DTS on my device and this property seems to be handled fine, so I think this should allow 32-bit values as well.

Regardless where is the issue: please test before sending.

Quoted 4 lines

I've opened a PR[1] against devicetree-org/dt-schema (where the schema for the chosen node is stored) to try and fix this. If my approach is incorrect, feel free to comment there as well.

According to Rob's comments, the DTS is the issue.

Best regards,
Krzysztof

#5 lore raw
Quoted 39 lines · Krzysztof Kozlowski
Quoted 30 lines · Artur Weber
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
  arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
  1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +1 -0
index e5254e32aa8f..9bc05961577d 100644
@@ -45,6 +45,12 @@ chosen {
  		/* Default S-BOOT bootloader loads initramfs here */
  		linux,initrd-start = <0x42000000>;
  		linux,initrd-end = <0x42800000>;
+
Quoted 8 lines

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 5 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +5 -0
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Applied and dropped:
chosen: linux,usable-memory-range:0: [4611686019496935424] is too short

Quoted 4 lines

This seems to be a binding issue; the DT schema expects a 64-bit memory address and size, and doesn't allow a 32-bit range. I've tested the DTS on my device and this property seems to be handled fine, so I think this should allow 32-bit values as well.

Regardless where is the issue: please test before sending.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

I've opened a PR[1] against devicetree-org/dt-schema (where the schema for the chosen node is stored) to try and fix this. If my approach is incorrect, feel free to comment there as well.

According to Rob's comments, the DTS is the issue.

With updated dtschema I still see the same warning. Is something else missing?

Best regards,
Krzysztof

#6 lore raw
Quoted 45 lines · Krzysztof Kozlowski
Quoted 44 lines · Krzysztof Kozlowski
Quoted 30 lines · Artur Weber
Quoted 27 lines · Krzysztof Kozlowski
Quoted 15 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

---
   arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 6 ++++++
   1 file changed, 6 insertions(+)
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +0 -0
index e5254e32aa8f..9bc05961577d 100644

arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi chosen { · line 53

Quoted 9 lines
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +6 -0
@@ -45,6 +45,12 @@ chosen {
   		/* Default S-BOOT bootloader loads initramfs here */
   		linux,initrd-start = <0x42000000>;
   		linux,initrd-end = <0x42800000>;
+
+		/*
+		 * Stock bootloader provides incorrect memory size in ATAG_MEM;
+		 * override it here
+		 */
+		linux,usable-memory-range = <0x40000000 0x3fc00000>;

Applied and dropped:

Quoted 1 line
   chosen: linux,usable-memory-range:0: [4611686019496935424] is too short
Quoted 4 lines

This seems to be a binding issue; the DT schema expects a 64-bit memory address and size, and doesn't allow a 32-bit range. I've tested the DTS on my device and this property seems to be handled fine, so I think this should allow 32-bit values as well.

Regardless where is the issue: please test before sending.

Quoted 4 lines

I've opened a PR[1] against devicetree-org/dt-schema (where the schema for the chosen node is stored) to try and fix this. If my approach is incorrect, feel free to comment there as well.

Quoted 4 lines
Quoted 1 line

According to Rob's comments, the DTS is the issue.

With updated dtschema I still see the same warning. Is something else missing?

My bad, turns out I didn't test my dt-schemas patch correctly... looks like this has been *properly* fixed now in latest dt-schema[1][2], and I no longer get warnings about the linux,usable-memory-range property. (There are some new warnings though, for some nodes in exynos4.dtsi that have 2 reg values, but that's out of scope for this patch.)

Sorry for the general confusion, I'll make sure to double-check my patches next time...

Best regards
Artur

[1] https://github.com/devicetree-org/dt-schema/commit/08eff8e6167e9e0bc1694af6c298b4584105a057
[2] https://github.com/devicetree-org/dt-schema/commit/c95c9ad63c51f8d9cfb258e6f17a8001efab6d64

#7 lore raw
In reply to Artur Weber
Quoted 6 lines · Artur Weber

The stock bootloader on the Samsung Galaxy Tab 3 8.0 provides an incorrect available memory range over ATAG_MEM. Limit the usable memory in the DTS to prevent it from doing so, without having to disable ATAG support.

Applied, thanks!

[1/1] ARM: dts: exynos4212-tab3: limit usable memory range

      https://git.kernel.org/krzk/linux/c/7bff1d35c1294c011b0269b8eaeb8f930df386fe

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>