History

RISC-V: Move all address space definition macros to one place

We get the following compilation error if CONFIG_SPARSEMEM_VMEMMAP is set. --------------------------------------------------------------- ./arch/riscv/include/asm/pgtable-64.h: In function ‘pud_page’: ./include/asm-generic/memory_model.h:54:29: error: ‘vmemmap’ undeclared (first use in this function); did you mean ‘mem_map’? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^~~~~~~ ./include/asm-generic/memory_model.h:82:21: note: in expansion of macro ‘__pfn_to_page’ #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ ./arch/riscv/include/asm/pgtable-64.h:70:9: note: in expansion of macro ‘pfn_to_page’ return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT); --------------------------------------------------------------- Fix the compliation errors by moving all the address space definition macros before including pgtable-64.h. Fixes: 8ad8b72721d0 (riscv: Add KASAN support)

Atish Patra committed 6 years ago

Commit 2191b4f1 parent bd6f2031 file · +41 −37Browse files

Unified · Split

arch/riscv/include/asm/pgtable.h+41−37
@@ -19,6 +19,47 @@ · 18 unmodified lines
19#include <asm/tlbflush.h>19#include <asm/tlbflush.h>
20#include <linux/mm_types.h>20#include <linux/mm_types.h>
21 21
22#ifdef CONFIG_MMU
23
24#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
25#define VMALLOC_END (PAGE_OFFSET - 1)
26#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
27
28#define BPF_JIT_REGION_SIZE (SZ_128M)
29#define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE)
30#define BPF_JIT_REGION_END (VMALLOC_END)
31
32/*
33 * Roughly size the vmemmap space to be large enough to fit enough
34 * struct pages to map half the virtual address space. Then
35 * position vmemmap directly below the VMALLOC region.
36 */
37#define VMEMMAP_SHIFT \
38 (CONFIG_VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT)
39#define VMEMMAP_SIZE BIT(VMEMMAP_SHIFT)
40#define VMEMMAP_END (VMALLOC_START - 1)
41#define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE)
42
43/*
44 * Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel
45 * is configured with CONFIG_SPARSEMEM_VMEMMAP enabled.
46 */
47#define vmemmap ((struct page *)VMEMMAP_START)
48
49#define PCI_IO_SIZE SZ_16M
50#define PCI_IO_END VMEMMAP_START
51#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)
52
53#define FIXADDR_TOP PCI_IO_START
54#ifdef CONFIG_64BIT
55#define FIXADDR_SIZE PMD_SIZE
56#else
57#define FIXADDR_SIZE PGDIR_SIZE
58#endif
59#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
60
61#endif
62
22#ifdef CONFIG_64BIT63#ifdef CONFIG_64BIT
23#include <asm/pgtable-64.h>64#include <asm/pgtable-64.h>
24#else65#else
@@ -90,31 +131,6 @@ extern pgd_t swapper_pg_dir[]; · 65 unmodified lines
90#define __S110 PAGE_SHARED_EXEC131#define __S110 PAGE_SHARED_EXEC
91#define __S111 PAGE_SHARED_EXEC132#define __S111 PAGE_SHARED_EXEC
92 133
93#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
94#define VMALLOC_END (PAGE_OFFSET - 1)
95#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
96
97#define BPF_JIT_REGION_SIZE (SZ_128M)
98#define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE)
99#define BPF_JIT_REGION_END (VMALLOC_END)
100
101/*
102 * Roughly size the vmemmap space to be large enough to fit enough
103 * struct pages to map half the virtual address space. Then
104 * position vmemmap directly below the VMALLOC region.
105 */
106#define VMEMMAP_SHIFT \
107 (CONFIG_VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT)
108#define VMEMMAP_SIZE BIT(VMEMMAP_SHIFT)
109#define VMEMMAP_END (VMALLOC_START - 1)
110#define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE)
111
112/*
113 * Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel
114 * is configured with CONFIG_SPARSEMEM_VMEMMAP enabled.
115 */
116#define vmemmap ((struct page *)VMEMMAP_START)
117
118static inline int pmd_present(pmd_t pmd)134static inline int pmd_present(pmd_t pmd)
119{135{
120 return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE));136 return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE));
@@ -432,18 +448,6 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, · 311 unmodified lines
432#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })448#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
433#define __swp_entry_to_pte(x) ((pte_t) { (x).val })449#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
434 450
435#define PCI_IO_SIZE SZ_16M
436#define PCI_IO_END VMEMMAP_START
437#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)
438
439#define FIXADDR_TOP PCI_IO_START
440#ifdef CONFIG_64BIT
441#define FIXADDR_SIZE PMD_SIZE
442#else
443#define FIXADDR_SIZE PGDIR_SIZE
444#endif
445#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
446
447/*451/*
448 * Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32.452 * Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32.
449 * Note that PGDIR_SIZE must evenly divide TASK_SIZE.453 * Note that PGDIR_SIZE must evenly divide TASK_SIZE.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t