Skip to content

Commit ba9c4f8

Browse files
Steven J. Magnanimichalsimek
authored andcommitted
microblaze: Allow PAGE_SIZE configuration
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>
1 parent 0d9ec76 commit ba9c4f8

6 files changed

Lines changed: 50 additions & 11 deletions

File tree

‎arch/microblaze/Kconfig‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,36 @@ config TASK_SIZE
223223
hex "Size of user task space" if TASK_SIZE_BOOL
224224
default "0x80000000"
225225

226+
choice
227+
prompt "Page size"
228+
default MICROBLAZE_4K_PAGES
229+
depends on ADVANCED_OPTIONS && !MMU
230+
help
231+
Select the kernel logical page size. Increasing the page size
232+
will reduce software overhead at each page boundary, allow
233+
hardware prefetch mechanisms to be more effective, and allow
234+
larger dma transfers increasing IO efficiency and reducing
235+
overhead. However the utilization of memory will increase.
236+
For example, each cached file will using a multiple of the
237+
page size to hold its contents and the difference between the
238+
end of file and the end of page is wasted.
239+
240+
If unsure, choose 4K_PAGES.
241+
242+
config MICROBLAZE_4K_PAGES
243+
bool "4k page size"
244+
245+
config MICROBLAZE_8K_PAGES
246+
bool "8k page size"
247+
248+
config MICROBLAZE_16K_PAGES
249+
bool "16k page size"
250+
251+
config MICROBLAZE_32K_PAGES
252+
bool "32k page size"
253+
254+
endchoice
255+
226256
endmenu
227257

228258
source "mm/Kconfig"

‎arch/microblaze/include/asm/elf.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
7777
#define ELF_DATA ELFDATA2MSB
7878
#endif
7979

80-
#define ELF_EXEC_PAGESIZE 4096
80+
#define ELF_EXEC_PAGESIZE PAGE_SIZE
8181

8282

8383
#define ELF_CORE_COPY_REGS(_dest, _regs) \

‎arch/microblaze/include/asm/page.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@
2323
#ifdef __KERNEL__
2424

2525
/* PAGE_SHIFT determines the page size */
26-
#define PAGE_SHIFT (12)
27-
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
26+
#if defined(CONFIG_MICROBLAZE_32K_PAGES)
27+
#define PAGE_SHIFT 15
28+
#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
29+
#define PAGE_SHIFT 14
30+
#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
31+
#define PAGE_SHIFT 13
32+
#else
33+
#define PAGE_SHIFT 12
34+
#endif
35+
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
2836
#define PAGE_MASK (~(PAGE_SIZE-1))
2937

3038
#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))

‎arch/microblaze/kernel/cpu/mb.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
126126
cpuinfo.pvr_user1,
127127
cpuinfo.pvr_user2);
128128

129+
count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
129130
return 0;
130131
}
131132

‎arch/microblaze/kernel/head.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
.global empty_zero_page
4444
.align 12
4545
empty_zero_page:
46-
.space 4096
46+
.space PAGE_SIZE
4747
.global swapper_pg_dir
4848
swapper_pg_dir:
49-
.space 4096
49+
.space PAGE_SIZE
5050

5151
#endif /* CONFIG_MMU */
5252

‎arch/microblaze/kernel/vmlinux.lds.S‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ SECTIONS {
5555
*/
5656
.sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) {
5757
_ssrw = .;
58-
. = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */
58+
. = ALIGN(PAGE_SIZE); /* page aligned when MMU used */
5959
*(.sdata2)
6060
. = ALIGN(8);
6161
_essrw = .;
@@ -70,7 +70,7 @@ SECTIONS {
7070
/* Reserve some low RAM for r0 based memory references */
7171
. = ALIGN(0x4) ;
7272
r0_ram = . ;
73-
. = . + 4096; /* a page should be enough */
73+
. = . + PAGE_SIZE; /* a page should be enough */
7474

7575
/* Under the microblaze ABI, .sdata and .sbss must be contiguous */
7676
. = ALIGN(8);
@@ -120,7 +120,7 @@ SECTIONS {
120120

121121
__init_end_before_initramfs = .;
122122

123-
.init.ramfs ALIGN(4096) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
123+
.init.ramfs ALIGN(PAGE_SIZE) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
124124
__initramfs_start = .;
125125
*(.init.ramfs)
126126
__initramfs_end = .;
@@ -132,11 +132,11 @@ SECTIONS {
132132
* so that __init_end == __bss_start. This will make image.elf
133133
* consistent with the image.bin
134134
*/
135-
/* . = ALIGN(4096); */
135+
/* . = ALIGN(PAGE_SIZE); */
136136
}
137137
__init_end = .;
138138

139-
.bss ALIGN (4096) : AT(ADDR(.bss) - LOAD_OFFSET) {
139+
.bss ALIGN (PAGE_SIZE) : AT(ADDR(.bss) - LOAD_OFFSET) {
140140
/* page aligned when MMU used */
141141
__bss_start = . ;
142142
*(.bss*)
@@ -145,7 +145,7 @@ SECTIONS {
145145
__bss_stop = . ;
146146
_ebss = . ;
147147
}
148-
. = ALIGN(4096);
148+
. = ALIGN(PAGE_SIZE);
149149
_end = .;
150150

151151
DISCARDS

0 commit comments

Comments
 (0)