|
11 | 11 |
|
12 | 12 | #include <asm/pgtable-bits.h>
|
13 | 13 |
|
14 |
| -#ifndef __ASSEMBLY__ |
| 14 | +#ifndef CONFIG_MMU |
| 15 | +#define KERNEL_LINK_ADDR PAGE_OFFSET |
| 16 | +#else |
15 | 17 |
|
16 |
| -/* Page Upper Directory not used in RISC-V */ |
17 |
| -#include <asm-generic/pgtable-nopud.h> |
18 |
| -#include <asm/page.h> |
19 |
| -#include <asm/tlbflush.h> |
20 |
| -#include <linux/mm_types.h> |
| 18 | +#define ADDRESS_SPACE_END (UL(-1)) |
21 | 19 |
|
22 |
| -#ifdef CONFIG_MMU |
| 20 | +#ifdef CONFIG_64BIT |
| 21 | +/* Leave 2GB for kernel and BPF at the end of the address space */ |
| 22 | +#define KERNEL_LINK_ADDR (ADDRESS_SPACE_END - SZ_2G + 1) |
| 23 | +#else |
| 24 | +#define KERNEL_LINK_ADDR PAGE_OFFSET |
| 25 | +#endif |
23 | 26 |
|
24 | 27 | #define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
|
25 | 28 | #define VMALLOC_END (PAGE_OFFSET - 1)
|
26 | 29 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
|
27 | 30 |
|
28 | 31 | #define BPF_JIT_REGION_SIZE (SZ_128M)
|
| 32 | +#ifdef CONFIG_64BIT |
| 33 | +/* KASLR should leave at least 128MB for BPF after the kernel */ |
| 34 | +#define BPF_JIT_REGION_START PFN_ALIGN((unsigned long)&_end) |
| 35 | +#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE) |
| 36 | +#else |
29 | 37 | #define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE)
|
30 | 38 | #define BPF_JIT_REGION_END (VMALLOC_END)
|
| 39 | +#endif |
| 40 | + |
| 41 | +/* Modules always live before the kernel */ |
| 42 | +#ifdef CONFIG_64BIT |
| 43 | +#define MODULES_VADDR (PFN_ALIGN((unsigned long)&_end) - SZ_2G) |
| 44 | +#define MODULES_END (PFN_ALIGN((unsigned long)&_start)) |
| 45 | +#endif |
31 | 46 |
|
32 | 47 | /*
|
33 | 48 | * Roughly size the vmemmap space to be large enough to fit enough
|
|
57 | 72 | #define FIXADDR_SIZE PGDIR_SIZE
|
58 | 73 | #endif
|
59 | 74 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
|
60 |
| - |
61 | 75 | #endif
|
62 | 76 |
|
| 77 | +#ifndef __ASSEMBLY__ |
| 78 | + |
| 79 | +/* Page Upper Directory not used in RISC-V */ |
| 80 | +#include <asm-generic/pgtable-nopud.h> |
| 81 | +#include <asm/page.h> |
| 82 | +#include <asm/tlbflush.h> |
| 83 | +#include <linux/mm_types.h> |
| 84 | + |
63 | 85 | #ifdef CONFIG_64BIT
|
64 | 86 | #include <asm/pgtable-64.h>
|
65 | 87 | #else
|
@@ -484,6 +506,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
|
484 | 506 |
|
485 | 507 | #define kern_addr_valid(addr) (1) /* FIXME */
|
486 | 508 |
|
| 509 | +extern char _start[]; |
487 | 510 | extern void *dtb_early_va;
|
488 | 511 | extern uintptr_t dtb_early_pa;
|
489 | 512 | void setup_bootmem(void);
|
|
0 commit comments