Skip to contentSkip to conversation

ARM: zynq: Reserve correct amount of non-DMA RAM

PATCH Applied Kyle Roeschley 3 participants 4 messages Oct 31, 2016 – Nov 14, 2016 1 message not in the archive

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

PATCH 1/1 ARM: zynq: Reserve correct amount of non-DMA RAM

On Zynq, we haven't been reserving the correct amount of DMA-incapable RAM to keep DMA away from it (per the Zynq TRM Section 4.1, it should be the first 512k). In older kernels, this was masked by the memblock_reserve call in arm_memblock_init(). Now, reserve the correct amount excplicitly rather than relying on swapper_pg_dir, which is an address and not a size anyway.

Fixes 46f5b96 ("ARM: zynq: Reserve not DMAable space in front of the

kernel")

---
Found when migrating from 4.1 to 4.6.

 arch/arm/mach-zynq/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-zynq/common.c +1 -1
index 6cefdb8..75885bc 100644
@@ -59,7 +59,7 @@ void __iomem *zynq_scu_base;
 static void __init zynq_memory_init(void)
 {
 	if (!__pa(PAGE_OFFSET))
-		memblock_reserve(__pa(PAGE_OFFSET), __pa(swapper_pg_dir));
+		memblock_reserve(__pa(PAGE_OFFSET), 0x80000);
 }
 
 static struct platform_device zynq_cpuidle_device = {
Signature · 1 line
2.9.3

A message that is not in the archive (sent off-list or not yet received): CAHTX3d+8kBYQwcUUcL1Z71Geij4EU3pjcv29=r8ndqSLW8iZDw@mail.gmail.com

Tested-by
#2 lore raw
Quoted 15 lines · Michal Simek

+ Nathan

2016-10-31 17:26 GMT+01:00 Kyle Roeschley <[email protected]>:

Quoted 12 lines

On Zynq, we haven't been reserving the correct amount of DMA-incapable RAM to keep DMA away from it (per the Zynq TRM Section 4.1, it should be the first 512k). In older kernels, this was masked by the memblock_reserve call in arm_memblock_init(). Now, reserve the correct amount excplicitly rather than relying on swapper_pg_dir, which is an address and not a size anyway.

Fixes 46f5b96 ("ARM: zynq: Reserve not DMAable space in front of the

kernel")

For reference this causes problems with DEBUG_RODATA (which changed to default yes for CPU_V7 in v4.6) due to padding memory between .head.text and .text, allowing memory below 0x80000 to be available for allocation as non-reserved memory.

Regards,
Nathan

Quoted 37 lines
Quoted 23 lines

---
Found when migrating from 4.1 to 4.6.

 arch/arm/mach-zynq/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-zynq/common.c +1 -2
index 6cefdb8..75885bc 100644
@@ -59,7 +59,7 @@ void __iomem *zynq_scu_base;
 static void __init zynq_memory_init(void)
 {
        if (!__pa(PAGE_OFFSET))
-               memblock_reserve(__pa(PAGE_OFFSET), __pa(swapper_pg_dir));
+               memblock_reserve(__pa(PAGE_OFFSET), 0x80000);
 }
 
 static struct platform_device zynq_cpuidle_device = {
--

2.9.3

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform

#3 lore raw
Quoted 12 lines · Nathan Rossi
Quoted 11 lines · Michal Simek

+ Nathan

2016-10-31 17:26 GMT+01:00 Kyle Roeschley <[email protected]>:

Quoted 8 lines

On Zynq, we haven't been reserving the correct amount of DMA-incapable RAM to keep DMA away from it (per the Zynq TRM Section 4.1, it should be the first 512k). In older kernels, this was masked by the memblock_reserve call in arm_memblock_init(). Now, reserve the correct amount excplicitly rather than relying on swapper_pg_dir, which is an address and not a size anyway.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Fixes 46f5b96 ("ARM: zynq: Reserve not DMAable space in front of the

kernel")

For reference this causes problems with DEBUG_RODATA (which changed to

Sorry typo -> s/causes/caused/, as in "... this [incorrect reserving of the lower 512K] caused ...".

Regards,
Nathan

Quoted 44 lines

default yes for CPU_V7 in v4.6) due to padding memory between .head.text and .text, allowing memory below 0x80000 to be available for allocation as non-reserved memory.

Regards,
Nathan

Quoted 37 lines
Quoted 23 lines

---
Found when migrating from 4.1 to 4.6.

 arch/arm/mach-zynq/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-zynq/common.c +1 -2
index 6cefdb8..75885bc 100644
@@ -59,7 +59,7 @@ void __iomem *zynq_scu_base;
 static void __init zynq_memory_init(void)
 {
        if (!__pa(PAGE_OFFSET))
-               memblock_reserve(__pa(PAGE_OFFSET), __pa(swapper_pg_dir));
+               memblock_reserve(__pa(PAGE_OFFSET), 0x80000);
 }
 
 static struct platform_device zynq_cpuidle_device = {
--

2.9.3

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform

Applied
#4 lore raw
Quoted 20 lines · Nathan Rossi
Quoted 19 lines · Nathan Rossi
Quoted 15 lines · Michal Simek

+ Nathan

2016-10-31 17:26 GMT+01:00 Kyle Roeschley <[email protected]>:

Quoted 12 lines

On Zynq, we haven't been reserving the correct amount of DMA-incapable RAM to keep DMA away from it (per the Zynq TRM Section 4.1, it should be the first 512k). In older kernels, this was masked by the memblock_reserve call in arm_memblock_init(). Now, reserve the correct amount excplicitly rather than relying on swapper_pg_dir, which is an address and not a size anyway.

Fixes 46f5b96 ("ARM: zynq: Reserve not DMAable space in front of the

kernel")

Quoted 11 lines
Quoted 1 line

For reference this causes problems with DEBUG_RODATA (which changed to

Sorry typo -> s/causes/caused/, as in "... this [incorrect reserving of the lower 512K] caused ...".

Regards,
Nathan

Quoted 3 lines

default yes for CPU_V7 in v4.6) due to padding memory between .head.text and .text, allowing memory below 0x80000 to be available for allocation as non-reserved memory.

Applied to zynq/soc
https://github.com/Xilinx/linux-xlnx/commits/zynq/soc

Thanks,
Michal

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161114/08ba1daa/attachment.sig>