Skip to contentSkip to conversation

Allow memblock steal operations to remove memory from anywhere

PATCH New Russell King - ARM Linux 3 participants 3 messages Aug 12, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow memblock steal operations to remove memory from anywhere

Found this with the cubox, which wants to obtain large blocks of RAM for the GPU and VPU devices at boot time. I don't believe any other platforms care where the memory comes from, so I think this is safe.

However, OMAP and iMX folk should check this patch - thanks.

8<===
From: Russell King <[email protected]>
Subject: ARM: Allow arm_memblock_steal() to remove memory from any RAM region

Allow arm_memblock_steal() to remove memory from any RAM region, including highmem areas. This allows memory to be stolen from the very top of declared memory, including highmem areas, rather than our precious lowmem.

---
 arch/arm/mm/init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/init.c +1 -1
index f54d592..04632f3 100644
@@ -324,7 +324,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
 	BUG_ON(!arm_memblock_steal_permitted);
 
-	phys = memblock_alloc(size, align);
+	phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
#1 lore raw

PATCH 1/1 Allow memblock steal operations to remove memory from anywhere

Quoted 11 lines · Russell King - ARM Linux

Found this with the cubox, which wants to obtain large blocks of RAM for the GPU and VPU devices at boot time. I don't believe any other platforms care where the memory comes from, so I think this is safe.

However, OMAP and iMX folk should check this patch - thanks.

8<===
From: Russell King <[email protected]>
Subject: ARM: Allow arm_memblock_steal() to remove memory from any RAM region

Quoted 6 lines

Allow arm_memblock_steal() to remove memory from any RAM region, including highmem areas. This allows memory to be stolen from the very top of declared memory, including highmem areas, rather than our precious lowmem.

There shouldn't be any problems with this on i.MX.

Quoted 18 lines
---
 arch/arm/mm/init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/init.c +1 -1
index f54d592..04632f3 100644
@@ -324,7 +324,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
 	BUG_ON(!arm_memblock_steal_permitted);
 
-	phys = memblock_alloc(size, align);
+	phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
 	memblock_free(phys, size);
 	memblock_remove(phys, size);
 
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

PATCH 1/1 Allow memblock steal operations to remove memory from anywhere

In reply to Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux

Found this with the cubox, which wants to obtain large blocks of RAM for the GPU and VPU devices at boot time. I don't believe any other platforms care where the memory comes from, so I think this is safe.

Agree.

Quoted 2 lines

However, OMAP and iMX folk should check this patch - thanks.

Works for OMAP without any issues.

Quoted 31 lines

8<===
From: Russell King <[email protected]>
Subject: ARM: Allow arm_memblock_steal() to remove memory from any RAM region

Allow arm_memblock_steal() to remove memory from any RAM region, including highmem areas. This allows memory to be stolen from the very top of declared memory, including highmem areas, rather than our precious lowmem.

---
 arch/arm/mm/init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/init.c +1 -2
index f54d592..04632f3 100644
@@ -324,7 +324,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
        BUG_ON(!arm_memblock_steal_permitted);
 
-       phys = memblock_alloc(size, align);
+       phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
        memblock_free(phys, size);
        memblock_remove(phys, size);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html