microblaze: Allow PAGE_SIZE configuration
authorSteven J. Magnani <steve@digidescorp.com>
Thu, 13 May 2010 15:48:27 +0000 (10:48 -0500)
committerMichal Simek <monstr@monstr.eu>
Wed, 4 Aug 2010 08:22:34 +0000 (10:22 +0200)
Allow developer to configure memory page size at compile time.
Larger pages can improve performance on some workloads.

Based on PowerPC code.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/Kconfig
arch/microblaze/include/asm/elf.h
arch/microblaze/include/asm/page.h
arch/microblaze/kernel/cpu/mb.c
arch/microblaze/kernel/head.S
arch/microblaze/kernel/vmlinux.lds.S

index 505a08592423dbd17b7168a2782247c2d401f52e..a51742190c12486bba2fa01766ef3da01901656e 100644 (file)
@@ -223,6 +223,36 @@ config TASK_SIZE
        hex "Size of user task space" if TASK_SIZE_BOOL
        default "0x80000000"
 
+choice
+       prompt "Page size"
+       default MICROBLAZE_4K_PAGES
+       depends on ADVANCED_OPTIONS && !MMU
+       help
+         Select the kernel logical page size. Increasing the page size
+         will reduce software overhead at each page boundary, allow
+         hardware prefetch mechanisms to be more effective, and allow
+         larger dma transfers increasing IO efficiency and reducing
+         overhead. However the utilization of memory will increase.
+         For example, each cached file will using a multiple of the
+         page size to hold its contents and the difference between the
+         end of file and the end of page is wasted.
+
+         If unsure, choose 4K_PAGES.
+
+config MICROBLAZE_4K_PAGES
+       bool "4k page size"
+
+config MICROBLAZE_8K_PAGES
+       bool "8k page size"
+
+config MICROBLAZE_16K_PAGES
+       bool "16k page size"
+
+config MICROBLAZE_32K_PAGES
+       bool "32k page size"
+
+endchoice
+
 endmenu
 
 source "mm/Kconfig"
index 7d4acf2b278e2061c9d73d9ef4b86faf09620e8a..732caf1be741fc1ede77bbfe14972a19c3044eb0 100644 (file)
@@ -77,7 +77,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 #define ELF_DATA       ELFDATA2MSB
 #endif
 
-#define ELF_EXEC_PAGESIZE      4096
+#define ELF_EXEC_PAGESIZE      PAGE_SIZE
 
 
 #define ELF_CORE_COPY_REGS(_dest, _regs)                       \
index 464ff32bee3d29139cebead6a21be92207016a36..c12c6dfafd9f9bc503b16be2fe7bd026539930db 100644 (file)
 #ifdef __KERNEL__
 
 /* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT     (12)
-#define PAGE_SIZE      (_AC(1, UL) << PAGE_SHIFT)
+#if defined(CONFIG_MICROBLAZE_32K_PAGES)
+#define PAGE_SHIFT             15
+#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
+#define PAGE_SHIFT             14
+#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
+#define PAGE_SHIFT             13
+#else
+#define PAGE_SHIFT             12
+#endif
+#define PAGE_SIZE      (ASM_CONST(1) << PAGE_SHIFT)
 #define PAGE_MASK      (~(PAGE_SIZE-1))
 
 #define LOAD_OFFSET    ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
index 4216eb1eaa326a84e4fa2d776ad522d001217d29..7086e356428163bc77d9ddaee75b2f7565249a12 100644 (file)
@@ -126,6 +126,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                        cpuinfo.pvr_user1,
                        cpuinfo.pvr_user2);
 
+       count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
        return 0;
 }
 
index 1bf7398882607ba805b64866f0d6501f4849b033..42434008209eaffdeb3db74518db24d2d088512b 100644 (file)
 .global empty_zero_page
 .align 12
 empty_zero_page:
-       .space  4096
+       .space  PAGE_SIZE
 .global swapper_pg_dir
 swapper_pg_dir:
-       .space  4096
+       .space  PAGE_SIZE
 
 #endif /* CONFIG_MMU */
 
index db72d71246022eec5e40c05aac2624a67ee646e5..b0de1a6b551325d42e434af52023aa10938e43ee 100644 (file)
@@ -55,7 +55,7 @@ SECTIONS {
         */
        .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) {
                _ssrw = .;
-               . = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */
+               . = ALIGN(PAGE_SIZE); /* page aligned when MMU used */
                *(.sdata2)
        . = ALIGN(8);
        _essrw = .;
@@ -70,7 +70,7 @@ SECTIONS {
        /* Reserve some low RAM for r0 based memory references */
        . = ALIGN(0x4) ;
        r0_ram = . ;
-       . = . +  4096;  /* a page should be enough */
+       . = . +  PAGE_SIZE;     /* a page should be enough */
 
        /* Under the microblaze ABI, .sdata and .sbss must be contiguous */
        . = ALIGN(8);
@@ -120,7 +120,7 @@ SECTIONS {
 
        __init_end_before_initramfs = .;
 
-       .init.ramfs ALIGN(4096) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
+       .init.ramfs ALIGN(PAGE_SIZE) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
                __initramfs_start = .;
                *(.init.ramfs)
                __initramfs_end = .;
@@ -132,11 +132,11 @@ SECTIONS {
  * so that __init_end == __bss_start. This will make image.elf
  * consistent with the image.bin
  */
-               /* . = ALIGN(4096); */
+               /* . = ALIGN(PAGE_SIZE); */
        }
        __init_end = .;
 
-       .bss ALIGN (4096) : AT(ADDR(.bss) - LOAD_OFFSET) {
+       .bss ALIGN (PAGE_SIZE) : AT(ADDR(.bss) - LOAD_OFFSET) {
                /* page aligned when MMU used */
                __bss_start = . ;
                        *(.bss*)
@@ -145,7 +145,7 @@ SECTIONS {
                __bss_stop = . ;
                _ebss = . ;
        }
-       . = ALIGN(4096);
+       . = ALIGN(PAGE_SIZE);
        _end = .;
 
        DISCARDS