RealView patches for 2.6.33
Subsystems (2)
cover RealView patches for 2.6.33
Hi,
These are mostly RealView patches but the 2nd one re-adds the conditional definition of __virt_to_phys and __phys_to_virt macros. The PBX memory support requires non-linear virtual to physical translation because of the huge gap between the memory blocks (more than 1GB).
Thanks.
Catalin Marinas (3):
RealView: Add default memory configuration
Revert 75f4aa1 (unconditionally define __virt_to_phys and __phys_to_virt)
RealView: Add sparsemem support for the RealView PBX platform
Colin Tuckley (1):
RealView: Remove duplicated #define REALVIEW_SYS_FLAGS* statements
arch/arm/include/asm/memory.h | 2 + arch/arm/mach-realview/Kconfig | 8 ++++- arch/arm/mach-realview/core.c | 42 +++++++++++++++++++++++- arch/arm/mach-realview/core.h | 5 +++ arch/arm/mach-realview/include/mach/memory.h | 46 ++++++++++++++++++++++++++ arch/arm/mach-realview/platsmp.c | 5 +-- arch/arm/mach-realview/realview_eb.c | 1 + arch/arm/mach-realview/realview_pb1176.c | 13 +++++++ arch/arm/mach-realview/realview_pb11mp.c | 1 + arch/arm/mach-realview/realview_pba8.c | 1 + arch/arm/mach-realview/realview_pbx.c | 21 ++++++++++++ 11 files changed, 139 insertions(+), 6 deletions(-)
Signature · 1 line
Catalin
PATCH 1/4 RealView: Add default memory configuration
This patch adds a realview_fixup() function called during booting to set up the memory banks. This way there is no need to pass a "mem=" argument on the kernel command line.
--- arch/arm/mach-realview/core.c | 21 +++++++++++++++++++++ arch/arm/mach-realview/core.h | 5 +++++ arch/arm/mach-realview/realview_eb.c | 1 + arch/arm/mach-realview/realview_pb1176.c | 13 +++++++++++++ arch/arm/mach-realview/realview_pb11mp.c | 1 + arch/arm/mach-realview/realview_pba8.c | 1 + arch/arm/mach-realview/realview_pbx.c | 1 + 7 files changed, 43 insertions(+), 0 deletions(-)
arch/arm/mach-realview/core.c +21 -0
@@ -788,3 +788,24 @@ void __init realview_timer_init(unsigned int timer_irq)realview_clocksource_init ();realview_clockevents_init (timer_irq); } + +/* +* Setup the memory banks. +*/ +void realview_fixup (struct machine_desc *mdesc,struct tag *tags,char **from, +struct meminfo *meminfo) +{ +/* +* Most RealView platforms have 512MB contiguous RAM at 0x70000000. +* Half of this is mirrored at 0. +*/ +#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET + meminfo->bank[0 ].start =0x70000000 ; + meminfo->bank[0 ].size =SZ_512M ; + meminfo->nr_banks =1 ; +#else + meminfo->bank[0 ].start =0 ; + meminfo->bank[0 ].size =SZ_256M ; + meminfo->nr_banks =1 ; +#endif +}
arch/arm/mach-realview/core.h +5 -0
@@ -25,6 +25,7 @@#include <linux/amba/bus.h> #include <linux/io.h> +#include <asm/setup.h> #include <asm/leds.h> #define AMBA_DEVICE (name,busid,base,plat) \
@@ -44,6 +45,8 @@ static struct amba_device name##_device = { \/* .dma = base##_DMA,*/ \ } +struct machine_desc ; +extern struct platform_device realview_flash_device;extern struct platform_device realview_cf_device;extern struct platform_device realview_i2c_device;
@@ -61,5 +64,7 @@ extern void realview_timer_init(unsigned int timer_irq);extern int realview_flash_register (struct resource *res,u32 num);extern int realview_eth_register (const char *name,struct resource *res);extern int realview_usb_register (struct resource *res); +extern void realview_fixup (struct machine_desc *mdesc,struct tag *tags, +char **from,struct meminfo *meminfo);#endif
arch/arm/mach-realview/realview_eb.c +1 -0
@@ -415,6 +415,7 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB") .phys_io = REALVIEW_EB_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_eb_map_io, .init_irq = gic_init_irq, .timer = &realview_eb_timer,
arch/arm/mach-realview/realview_pb1176.c +13 -0
@@ -290,6 +290,18 @@ static struct sys_timer realview_pb1176_timer = { .init = realview_pb1176_timer_init, }; +static void realview_pb1176_fixup (struct machine_desc *mdesc, +struct tag *tags,char **from, +struct meminfo *meminfo) +{ +/* +* RealView PB1176 only has 128MB of RAM mapped at 0. +*/ + meminfo->bank[0 ].start =0 ; + meminfo->bank[0 ].size =SZ_128M ; + meminfo->nr_banks =1 ; +} +static void __init realview_pb1176_init (void ) {int i;
@@ -320,6 +332,7 @@ MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") .phys_io = REALVIEW_PB1176_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PB1176_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_pb1176_fixup, .map_io = realview_pb1176_map_io, .init_irq = gic_init_irq, .timer = &realview_pb1176_timer,
arch/arm/mach-realview/realview_pb11mp.c +1 -0
@@ -331,6 +331,7 @@ MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") .phys_io = REALVIEW_PB11MP_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_pb11mp_map_io, .init_irq = gic_init_irq, .timer = &realview_pb11mp_timer,
arch/arm/mach-realview/realview_pba8.c +1 -0
@@ -298,6 +298,7 @@ MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") .phys_io = REALVIEW_PBA8_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBA8_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_pba8_map_io, .init_irq = gic_init_irq, .timer = &realview_pba8_timer,
arch/arm/mach-realview/realview_pbx.c +1 -0
@@ -345,6 +345,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") .phys_io = REALVIEW_PBX_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, + .fixup = realview_fixup, .map_io = realview_pbx_map_io, .init_irq = gic_init_irq, .timer = &realview_pbx_timer,
PATCH 2/4 RealView: Remove duplicated #define REALVIEW_SYS_FLAGS* statements
In reply to Catalin MarinasFrom: Colin Tuckley <[email protected]>
The platsmp.c file defines the REALVIEW_SYS_FLAGS* macros which are already present in platform.h. Just use the latter.
--- arch/arm/mach-realview/platsmp.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-realview/platsmp.c +1 -4
@@ -146,11 +146,8 @@ static void __init poke_milo(void)* register. The BootMonitor waits for this register to become * non-zero. */ -#define REALVIEW_SYS_FLAGSS_OFFSET 0x30 -#define REALVIEW_SYS_FLAGSC_OFFSET 0x34__raw_writel (BSYM (virt_to_phys (realview_secondary_startup)), -__io_address (REALVIEW_SYS_BASE ) + -REALVIEW_SYS_FLAGSS_OFFSET ); +__io_address (REALVIEW_SYS_FLAGSSET ));mb (); }
PATCH 3/4 Revert 75f4aa1 (unconditionally define __virt_to_phys and __phys_to_virt)
In reply to Catalin MarinasThe SPARSEMEM support for RealView PBX requires non-linear physical to virtual address translation.
--- arch/arm/include/asm/memory.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/include/asm/memory.h +2 -0
@@ -125,8 +125,10 @@* private definitions which should NOT be used outside memory.h * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. */ +#ifndef __virt_to_phys#define __virt_to_phys (x) ((x) - PAGE_OFFSET + PHYS_OFFSET)#define __phys_to_virt (x) ((x) - PHYS_OFFSET + PAGE_OFFSET) +#endif /* * Convert a physical address to a Page Frame Number and back
PATCH 3/4 Revert 75f4aa1 (unconditionally define __virt_to_phys and __phys_to_virt)
Quoted 2 lines · Catalin Marinas
The SPARSEMEM support for RealView PBX requires non-linear physical to virtual address translation.
Since we have two platforms which are wanting this, I think this shouldn't be a separate patch, but merely just a 'git revert' of the original.
PATCH 3/4 Revert 75f4aa1 (unconditionally define __virt_to_phys and __phys_to_virt)
Quoted 6 lines · Russell King - ARM Linux
Quoted 2 lines · Catalin Marinas
The SPARSEMEM support for RealView PBX requires non-linear physical to virtual address translation.
Since we have two platforms which are wanting this, I think this shouldn't be a separate patch, but merely just a 'git revert' of the original.
Well, git revert just generates another commit with a different author and a reverted diff from the original commit. My patch just adds a different comment from the standard one.
Will you revert this commit in your tree? I don't know how to submit "git revert" commands to the patch system :-).
Signature · 1 line
Catalin
PATCH 3/4 Revert 75f4aa1 (unconditionally define __virt_to_phys and __phys_to_virt)
Quoted 11 lines · Catalin Marinas
Quoted 6 lines · Russell King - ARM Linux
Quoted 2 lines · Catalin Marinas
The SPARSEMEM support for RealView PBX requires non-linear physical to virtual address translation.
Since we have two platforms which are wanting this, I think this shouldn't be a separate patch, but merely just a 'git revert' of the original.
Well, git revert just generates another commit with a different author and a reverted diff from the original commit. My patch just adds a different comment from the standard one.
I think it's sensible to keep at least the summary line of a 'git revert' intact rather than inventing our own.
Quoted 2 lines
Will you revert this commit in your tree? I don't know how to submit "git revert" commands to the patch system :-).
Done.
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
In reply to Catalin MarinasThe RealView PBX board has two 512MB blocks of memory - one at 0x70000000 (with 256MB mirror at 0) and another at 0x20000000. Only the block at 0x70000000 (or the mirror at 0) may be used for DMA (e.g. framebuffer). This patch adds the sparsemem definitions to allow the use of all the memory split as follows:
256MB @ 0x00000000 (ZONE_DMA)
512MB @ 0x20000000 (ZONE_NORMAL)
256MB @ 0x80000000 (ZONE_NORMAL)
--- arch/arm/mach-realview/Kconfig | 8 ++++- arch/arm/mach-realview/core.c | 21 +++++++++++- arch/arm/mach-realview/include/mach/memory.h | 46 ++++++++++++++++++++++++++ arch/arm/mach-realview/realview_pbx.c | 22 ++++++++++++ 4 files changed, 94 insertions(+), 3 deletions(-)
arch/arm/mach-realview/Kconfig +7 -1
@@ -70,12 +70,14 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM + select ARCH_SPARSEMEM_ENABLE if CPU_V7 + select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform. config REALVIEW_HIGH_PHYS_OFFSET bool "High physical base address for the RealView platform" - depends on MMU && !MACH_REALVIEW_PB1176 + depends on MMU && !MACH_REALVIEW_PB1176 && !SPARSEMEM default y help RealView boards other than PB1176 have the RAM available at
@@ -84,4 +86,8 @@ config REALVIEW_HIGH_PHYS_OFFSET memory to be accessed contiguously at the high physical offset. +config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE + endmenu
arch/arm/mach-realview/core.c +20 -1
@@ -59,6 +59,25 @@/* used by entry-macro.S and platsmp.c */ void __iomem *gic_cpu_base_addr; +#ifdef CONFIG_ZONE_DMA +/* +* Adjust the zones if there are restrictions for DMA access. +*/ +void __init realview_adjust_zones (int node,unsigned long *size, +unsigned long *hole) +{ +unsigned long dma_size =SZ_256M >>PAGE_SHIFT ; + +if (!machine_is_realview_pbx () || node || (size[0 ] <= dma_size)) +return ; + + size[ZONE_NORMAL ] = size[0 ] - dma_size; + size[ZONE_DMA ] = dma_size; + hole[ZONE_NORMAL ] = hole[0 ]; + hole[ZONE_DMA ] =0 ; +} +#endif +/* * This is the RealView sched_clock implementation. This has * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -543,7 +562,7 @@ static int realview_clcd_setup(struct clcd_fb *fb) fb->panel =realview_clcd_panel (); fb->fb.screen_base =dma_alloc_writecombine (&fb->dev->dev, framesize, - &dma,GFP_KERNEL ); + &dma,GFP_KERNEL |GFP_DMA );if (!fb->fb.screen_base) {printk (KERN_ERR "CLCD: unable to map framebuffer\n" );return -ENOMEM ;
arch/arm/mach-realview/include/mach/memory.h +46 -0
50 lines not on this page · raw message
arch/arm/mach-realview/realview_pbx.c +21 -1
@@ -304,6 +304,26 @@ static struct sys_timer realview_pbx_timer = { .init = realview_pbx_timer_init, }; +static void realview_pbx_fixup (struct machine_desc *mdesc,struct tag *tags, +char **from,struct meminfo *meminfo) +{ +#ifdef CONFIG_SPARSEMEM +/* +* Memory configuration with SPARSEMEM enabled on RealView PBX (see +* asm/mach/memory.h for more information). +*/ + meminfo->bank[0 ].start =0 ; + meminfo->bank[0 ].size =SZ_256M ; + meminfo->bank[1 ].start =0x20000000 ; + meminfo->bank[1 ].size =SZ_512M ; + meminfo->bank[2 ].start =0x80000000 ; + meminfo->bank[2 ].size =SZ_256M ; + meminfo->nr_banks =3 ; +#else +realview_fixup (mdesc, tags, from, meminfo); +#endif +} +static void __init realview_pbx_init (void ) {int i;
@@ -345,7 +365,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") .phys_io = REALVIEW_PBX_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, - .fixup = realview_fixup, + .fixup = realview_pbx_fixup, .map_io = realview_pbx_map_io, .init_irq = gic_init_irq, .timer = &realview_pbx_timer,
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 7 lines · Catalin Marinas
arch/arm/mach-realview/core.c +7
-0+#ifdef CONFIG_ZONE_DMA +/* +* Adjust the zones if there are restrictions for DMA access. +*/ +void __init realview_adjust_zones (int node,unsigned long *size, +unsigned long *hole) +{
arch/arm/mach-realview/core.c line 78
Quoted 10 lines
arch/arm/mach-realview/core.c +10
-0+unsigned long dma_size =SZ_256M >>PAGE_SHIFT ; + +if (!machine_is_realview_pbx () || node || (size[0 ] <= dma_size)) +return ; + + size[ZONE_NORMAL ] = size[0 ] - dma_size; + size[ZONE_DMA ] = dma_size; + hole[ZONE_NORMAL ] = hole[0 ]; + hole[ZONE_DMA ] =0 ; +}
You also need to set ISA_DMA_THRESHOLD and MAX_DMA_ADDRESS:
#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
so that other bits of code know what to expect from a GFP_DMA-type allocation.
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 21 lines · Russell King - ARM Linux
Quoted 7 lines · Catalin Marinas
(quoted diff) +7
-0+#ifdef CONFIG_ZONE_DMA +/* + * Adjust the zones if there are restrictions for DMA access. + */ +void __init realview_adjust_zones(int node, unsigned long *size, + unsigned long *hole) +{Review
Quoted 10 lines
(quoted diff) +10
-0+ unsigned long dma_size = SZ_256M >> PAGE_SHIFT; + + if (!machine_is_realview_pbx() || node || (size[0] <= dma_size)) + return; + + size[ZONE_NORMAL] = size[0] - dma_size; + size[ZONE_DMA] = dma_size; + hole[ZONE_NORMAL] = hole[0]; + hole[ZONE_DMA] = 0; +}You also need to set
ISA_DMA_THRESHOLDandMAX_DMA_ADDRESS:
Quoted 5 lines
#define
ISA_DMA_THRESHOLD(PHYS_OFFSET+SZ_256M- 1)
#defineMAX_DMA_ADDRESS(PAGE_OFFSET+SZ_256M)so that other bits of code know what to expect from a GFP_DMA-type allocation.
Thanks. Here's the updated patch:
RealView: Add sparsemem support for the RealView PBX platform
From: Catalin Marinas <[email protected]>
The RealView PBX board has two 512MB blocks of memory - one at 0x70000000 (with 256MB mirror at 0) and another at 0x20000000. Only the block at 0x70000000 (or the mirror at 0) may be used for DMA (e.g. framebuffer). This patch adds the sparsemem definitions to allow the use of all the memory split as follows:
256MB @ 0x00000000 (ZONE_DMA)
512MB @ 0x20000000 (ZONE_NORMAL)
256MB @ 0x80000000 (ZONE_NORMAL)
--- arch/arm/mach-realview/Kconfig | 8 ++++ arch/arm/mach-realview/core.c | 21 +++++++++++ arch/arm/mach-realview/include/mach/memory.h | 49 ++++++++++++++++++++++++++ arch/arm/mach-realview/realview_pbx.c | 22 +++++++++++- 4 files changed, 97 insertions(+), 3 deletions(-)
arch/arm/mach-realview/Kconfig +7 -1
@@ -70,12 +70,14 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM + select ARCH_SPARSEMEM_ENABLE if CPU_V7 + select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform. config REALVIEW_HIGH_PHYS_OFFSET bool "High physical base address for the RealView platform" - depends on MMU && !MACH_REALVIEW_PB1176 + depends on MMU && !MACH_REALVIEW_PB1176 && !SPARSEMEM default y help RealView boards other than PB1176 have the RAM available at
@@ -84,4 +86,8 @@ config REALVIEW_HIGH_PHYS_OFFSET memory to be accessed contiguously at the high physical offset. +config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE + endmenu
arch/arm/mach-realview/core.c +20 -1
@@ -59,6 +59,25 @@/* used by entry-macro.S and platsmp.c */ void __iomem *gic_cpu_base_addr; +#ifdef CONFIG_ZONE_DMA +/* +* Adjust the zones if there are restrictions for DMA access. +*/ +void __init realview_adjust_zones (int node,unsigned long *size, +unsigned long *hole) +{ +unsigned long dma_size =SZ_256M >>PAGE_SHIFT ; + +if (!machine_is_realview_pbx () || node || (size[0 ] <= dma_size)) +return ; + + size[ZONE_NORMAL ] = size[0 ] - dma_size; + size[ZONE_DMA ] = dma_size; + hole[ZONE_NORMAL ] = hole[0 ]; + hole[ZONE_DMA ] =0 ; +} +#endif +/* * This is the RealView sched_clock implementation. This has * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -543,7 +562,7 @@ static int realview_clcd_setup(struct clcd_fb *fb) fb->panel =realview_clcd_panel (); fb->fb.screen_base =dma_alloc_writecombine (&fb->dev->dev, framesize, - &dma,GFP_KERNEL ); + &dma,GFP_KERNEL |GFP_DMA );if (!fb->fb.screen_base) {printk (KERN_ERR "CLCD: unable to map framebuffer\n" );return -ENOMEM ;
arch/arm/mach-realview/include/mach/memory.h +49 -0
53 lines not on this page · raw message
arch/arm/mach-realview/realview_pbx.c +21 -1
@@ -304,6 +304,26 @@ static struct sys_timer realview_pbx_timer = { .init = realview_pbx_timer_init, }; +static void realview_pbx_fixup (struct machine_desc *mdesc,struct tag *tags, +char **from,struct meminfo *meminfo) +{ +#ifdef CONFIG_SPARSEMEM +/* +* Memory configuration with SPARSEMEM enabled on RealView PBX (see +* asm/mach/memory.h for more information). +*/ + meminfo->bank[0 ].start =0 ; + meminfo->bank[0 ].size =SZ_256M ; + meminfo->bank[1 ].start =0x20000000 ; + meminfo->bank[1 ].size =SZ_512M ; + meminfo->bank[2 ].start =0x80000000 ; + meminfo->bank[2 ].size =SZ_256M ; + meminfo->nr_banks =3 ; +#else +realview_fixup (mdesc, tags, from, meminfo); +#endif +} +static void __init realview_pbx_init (void ) {int i;
@@ -345,7 +365,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") .phys_io = REALVIEW_PBX_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, - .fixup = realview_fixup, + .fixup = realview_pbx_fixup, .map_io = realview_pbx_map_io, .init_irq = gic_init_irq, .timer = &realview_pbx_timer,
Signature · 1 line
Catalin
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
In reply to Catalin MarinasQuoted 21 lines · Catalin Marinas
arch/arm/mach-realview/Kconfig +3
-1@@ -70,12 +70,14 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM + select ARCH_SPARSEMEM_ENABLE if CPU_V7 + select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform. config REALVIEW_HIGH_PHYS_OFFSET bool "High physical base address for the RealView platform" - depends on MMU && !MACH_REALVIEW_PB1176 + depends on MMU && !MACH_REALVIEW_PB1176 && !SPARSEMEM default y help RealView boards other than PB1176 have the RAM available at
arch/arm/mach-realview/Kconfig config REALVIEW_HIGH_PHYS_OFFSET · line 92
Quoted 7 lines
arch/arm/mach-realview/Kconfig +4
-0@@ -84,4 +86,8 @@ config REALVIEW_HIGH_PHYS_OFFSET memory to be accessed contiguously at the high physical offset. +config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE +
I seem to have missed this. Why do we want to enable flatmem support for _everything_ which enables sparsemem?
In fact, why do you even have this at all?
Not pulling your latest pull request due to this.
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 25 lines · Russell King - ARM Linux
Quoted 24 lines · Catalin Marinas
arch/arm/mach-realview/Kconfig +3
-1@@ -70,12 +70,14 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM + select ARCH_SPARSEMEM_ENABLE if CPU_V7 + select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform. config REALVIEW_HIGH_PHYS_OFFSET bool "High physical base address for the RealView platform" - depends on MMU && !MACH_REALVIEW_PB1176 + depends on MMU && !MACH_REALVIEW_PB1176 && !SPARSEMEM default y help RealView boards other than PB1176 have the RAM available at@@ -84,4 +86,8 @@ config REALVIEW_HIGH_PHYS_OFFSET memory to be accessed contiguously at the high physical offset.
Quoted 7 lines
arch/arm/mach-realview/Kconfig config REALVIEW_HIGH_PHYS_OFFSET · line 92
Quoted 4 lines
arch/arm/mach-realview/Kconfig +4
-0+config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE +I seem to have missed this. Why do we want to enable flatmem support for _everything_ which enables sparsemem?
Just to have the option of selecting either flatmem or sparsemem with PBX (though I don't have a strong opinion about this). This can also be done transparently via REALVIEW_HIGH_PHYS_OFFSET.
If you like the approach below, I'll push it to the for-rmk branch:
RealView: Add sparsemem support for the RealView PBX platform
From: Catalin Marinas <[email protected]>
The RealView PBX board has two 512MB blocks of memory - one at 0x70000000 (with 256MB mirror at 0) and another at 0x20000000. Only the block at 0x70000000 (or the mirror at 0) may be used for DMA (e.g. framebuffer). This patch adds the sparsemem definitions to allow the use of all the memory split as follows:
256MB @ 0x00000000 (ZONE_DMA)
512MB @ 0x20000000 (ZONE_NORMAL)
256MB @ 0x80000000 (ZONE_NORMAL)
--- arch/arm/mach-realview/Kconfig | 5 ++- arch/arm/mach-realview/core.c | 21 +++++++++++ arch/arm/mach-realview/include/mach/memory.h | 49 ++++++++++++++++++++++++++ arch/arm/mach-realview/realview_pbx.c | 22 +++++++++++- 4 files changed, 94 insertions(+), 3 deletions(-)
arch/arm/mach-realview/Kconfig +4 -1
@@ -70,6 +70,8 @@ config MACH_REALVIEW_PBX bool "Support RealView/PBX platform" select ARM_GIC select HAVE_PATA_PLATFORM + select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !HIGH_PHYS_OFFSET + select ZONE_DMA if SPARSEMEM help Include support for the ARM(R) RealView PBX platform.
@@ -82,6 +84,7 @@ config REALVIEW_HIGH_PHYS_OFFSET 0x70000000, 256MB of which being mirrored at 0x00000000. If the board supports 512MB of RAM, this option allows the memory to be accessed contiguously at the high physical - offset. + offset. On the PBX board, disabling this option allows 1GB of + RAM to be used with SPARSEMEM. endmenu
arch/arm/mach-realview/core.c +20 -1
@@ -59,6 +59,25 @@/* used by entry-macro.S and platsmp.c */ void __iomem *gic_cpu_base_addr; +#ifdef CONFIG_ZONE_DMA +/* +* Adjust the zones if there are restrictions for DMA access. +*/ +void __init realview_adjust_zones (int node,unsigned long *size, +unsigned long *hole) +{ +unsigned long dma_size =SZ_256M >>PAGE_SHIFT ; + +if (!machine_is_realview_pbx () || node || (size[0 ] <= dma_size)) +return ; + + size[ZONE_NORMAL ] = size[0 ] - dma_size; + size[ZONE_DMA ] = dma_size; + hole[ZONE_NORMAL ] = hole[0 ]; + hole[ZONE_DMA ] =0 ; +} +#endif +/* * This is the RealView sched_clock implementation. This has * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -543,7 +562,7 @@ static int realview_clcd_setup(struct clcd_fb *fb) fb->panel =realview_clcd_panel (); fb->fb.screen_base =dma_alloc_writecombine (&fb->dev->dev, framesize, - &dma,GFP_KERNEL ); + &dma,GFP_KERNEL |GFP_DMA );if (!fb->fb.screen_base) {printk (KERN_ERR "CLCD: unable to map framebuffer\n" );return -ENOMEM ;
arch/arm/mach-realview/include/mach/memory.h +49 -0
53 lines not on this page · raw message
arch/arm/mach-realview/realview_pbx.c +21 -1
@@ -304,6 +304,26 @@ static struct sys_timer realview_pbx_timer = { .init = realview_pbx_timer_init, }; +static void realview_pbx_fixup (struct machine_desc *mdesc,struct tag *tags, +char **from,struct meminfo *meminfo) +{ +#ifdef CONFIG_SPARSEMEM +/* +* Memory configuration with SPARSEMEM enabled on RealView PBX (see +* asm/mach/memory.h for more information). +*/ + meminfo->bank[0 ].start =0 ; + meminfo->bank[0 ].size =SZ_256M ; + meminfo->bank[1 ].start =0x20000000 ; + meminfo->bank[1 ].size =SZ_512M ; + meminfo->bank[2 ].start =0x80000000 ; + meminfo->bank[2 ].size =SZ_256M ; + meminfo->nr_banks =3 ; +#else +realview_fixup (mdesc, tags, from, meminfo); +#endif +} +static void __init realview_pbx_init (void ) {int i;
@@ -345,7 +365,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") .phys_io = REALVIEW_PBX_UART0_BASE, .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, .boot_params = PHYS_OFFSET + 0x00000100, - .fixup = realview_fixup, + .fixup = realview_pbx_fixup, .map_io = realview_pbx_map_io, .init_irq = gic_init_irq, .timer = &realview_pbx_timer,
Signature · 1 line
Catalin
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 10 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Review
Quoted 4 lines · Catalin Marinas
(quoted diff) +4
-0+config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE +I seem to have missed this. Why do we want to enable flatmem support for _everything_ which enables sparsemem?
Quoted 3 lines
Just to have the option of selecting either flatmem or sparsemem with PBX (though I don't have a strong opinion about this). This can also be done transparently via
REALVIEW_HIGH_PHYS_OFFSET.
If you want to do this, put ARCH_FLATMEM_ENABLE into arch/arm/Kconfig, and arrange for the platform(s) where this is optional _and_ not the default to select this symbol, in precisely the same way that ARCH_SPARSEMEM_ENABLE is handled today.
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Review
Quoted 4 lines · Catalin Marinas
(quoted diff) +4
-0+config ARCH_FLATMEM_ENABLE + bool + default y if ARCH_SPARSEMEM_ENABLE +I seem to have missed this. Why do we want to enable flatmem support for _everything_ which enables sparsemem?
Quoted 8 lines
Quoted 3 lines
Just to have the option of selecting either flatmem or sparsemem with PBX (though I don't have a strong opinion about this). This can also be done transparently via
REALVIEW_HIGH_PHYS_OFFSET.If you want to do this, put
ARCH_FLATMEM_ENABLEintoarch/arm/Kconfig, and arrange for the platform(s) where this is optional _and_ not the default to select this symbol, in precisely the same way thatARCH_SPARSEMEM_ENABLEis handled today.
I don't think it's worth the hassle anyway. If you have REALVIEW_HIGH_PHYS_OFFSET disabled and FLATMEM, you end up with only 256MB of RAM available, I don't really see a point in this configuration. With the new patch, if you don't like SPARSEMEM (maybe for benchmarking reasons), just enable REALVIEW_HIGH_PHYS_OFFSET.
So, are you OK with the latest patch?
Signature · 1 line
Catalin
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 7 lines · Catalin Marinas
I don't think it's worth the hassle anyway. If you have
REALVIEW_HIGH_PHYS_OFFSETdisabled and FLATMEM, you end up with only 256MB of RAM available, I don't really see a point in this configuration. With the new patch, if you don't like SPARSEMEM (maybe for benchmarking reasons), just enableREALVIEW_HIGH_PHYS_OFFSET.So, are you OK with the latest patch?
In that case, yes.
PATCH 4/4 RealView: Add sparsemem support for the RealView PBX platform
Quoted 10 lines · Russell King - ARM Linux
Quoted 7 lines · Catalin Marinas
I don't think it's worth the hassle anyway. If you have
REALVIEW_HIGH_PHYS_OFFSETdisabled and FLATMEM, you end up with only 256MB of RAM available, I don't really see a point in this configuration. With the new patch, if you don't like SPARSEMEM (maybe for benchmarking reasons), just enableREALVIEW_HIGH_PHYS_OFFSET.So, are you OK with the latest patch?
In that case, yes.
OK, I updated the for-rmk branch.
Thanks.
Signature · 1 line
Catalin