Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscv: rename sptbr to satp

satp is the name used by the current privileged spec 1.10, use it
instead of the old name. The most recent release binutils release
(2.29) doesn't know about the satp name yet, so stick to the name from
the previous privileged ISA release and comment on the fact.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>

authored by

Christoph Hellwig and committed by
Palmer Dabbelt
7549cdf5 372def1f

+20 -11
+7 -7
arch/riscv/include/asm/csr.h
··· 40 40 #define SR_SD _AC(0x8000000000000000, UL) /* FS/XS dirty */ 41 41 #endif 42 42 43 - /* SPTBR flags */ 43 + /* SATP flags */ 44 44 #if __riscv_xlen == 32 45 - #define SPTBR_PPN _AC(0x003FFFFF, UL) 46 - #define SPTBR_MODE_32 _AC(0x80000000, UL) 47 - #define SPTBR_MODE SPTBR_MODE_32 45 + #define SATP_PPN _AC(0x003FFFFF, UL) 46 + #define SATP_MODE_32 _AC(0x80000000, UL) 47 + #define SATP_MODE SATP_MODE_32 48 48 #else 49 - #define SPTBR_PPN _AC(0x00000FFFFFFFFFFF, UL) 50 - #define SPTBR_MODE_39 _AC(0x8000000000000000, UL) 51 - #define SPTBR_MODE SPTBR_MODE_39 49 + #define SATP_PPN _AC(0x00000FFFFFFFFFFF, UL) 50 + #define SATP_MODE_39 _AC(0x8000000000000000, UL) 51 + #define SATP_MODE SATP_MODE_39 52 52 #endif 53 53 54 54 /* Interrupt Enable and Interrupt Pending flags */
+6 -1
arch/riscv/include/asm/mmu_context.h
··· 41 41 42 42 static inline void set_pgdir(pgd_t *pgd) 43 43 { 44 - csr_write(sptbr, virt_to_pfn(pgd) | SPTBR_MODE); 44 + /* 45 + * Use the old spbtr name instead of using the current satp 46 + * name to support binutils 2.29 which doesn't know about the 47 + * privileged ISA 1.10 yet. 48 + */ 49 + csr_write(sptbr, virt_to_pfn(next->pgd) | SATP_MODE); 45 50 } 46 51 47 52 /*
+3 -3
arch/riscv/kernel/head.S
··· 74 74 sub a1, a1, a0 75 75 add ra, ra, a1 76 76 77 - /* Point stvec to virtual address of intruction after sptbr write */ 77 + /* Point stvec to virtual address of intruction after satp write */ 78 78 la a0, 1f 79 79 add a0, a0, a1 80 80 csrw stvec, a0 81 81 82 - /* Compute sptbr for kernel page tables, but don't load it yet */ 82 + /* Compute satp for kernel page tables, but don't load it yet */ 83 83 la a2, swapper_pg_dir 84 84 srl a2, a2, PAGE_SHIFT 85 - li a1, SPTBR_MODE 85 + li a1, SATP_MODE 86 86 or a2, a2, a1 87 87 88 88 /*
+4
arch/riscv/mm/fault.c
··· 239 239 * Do _not_ use "tsk->active_mm->pgd" here. 240 240 * We might be inside an interrupt in the middle 241 241 * of a task switch. 242 + * 243 + * Note: Use the old spbtr name instead of using the current 244 + * satp name to support binutils 2.29 which doesn't know about 245 + * the privileged ISA 1.10 yet. 242 246 */ 243 247 index = pgd_index(addr); 244 248 pgd = (pgd_t *)pfn_to_virt(csr_read(sptbr)) + index;