Skip to content

Commit 5bf4e52

Browse files
greentimepaul-walmsley-sifive
authored andcommitted
RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START
This patch fixes the virtual address layout in pgtable.h. The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped. Fixes: d95f1a5 ("RISC-V: Implement sparsemem") Signed-off-by: Greentime Hu <[email protected]> Reviewed-by: Anup Patel <[email protected]> [[email protected]: fixed patch description] Signed-off-by: Paul Walmsley <[email protected]>
1 parent 4c8eb19 commit 5bf4e52

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[];
8787
#define VMALLOC_END (PAGE_OFFSET - 1)
8888
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
8989

90-
#define FIXADDR_TOP VMALLOC_START
91-
#ifdef CONFIG_64BIT
92-
#define FIXADDR_SIZE PMD_SIZE
93-
#else
94-
#define FIXADDR_SIZE PGDIR_SIZE
95-
#endif
96-
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
97-
9890
/*
9991
* Roughly size the vmemmap space to be large enough to fit enough
10092
* struct pages to map half the virtual address space. Then
@@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[];
108100

109101
#define vmemmap ((struct page *)VMEMMAP_START)
110102

103+
#define FIXADDR_TOP (VMEMMAP_START)
104+
#ifdef CONFIG_64BIT
105+
#define FIXADDR_SIZE PMD_SIZE
106+
#else
107+
#define FIXADDR_SIZE PGDIR_SIZE
108+
#endif
109+
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
110+
111111
/*
112112
* ZERO_PAGE is a global shared page that is always zero,
113113
* used for zero-mapped memory areas, etc.

0 commit comments

Comments
 (0)