浏览代码

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>
Christoph Hellwig 7 年之前
父节点
当前提交
7549cdf59d
共有 4 个文件被更改,包括 20 次插入11 次删除
  1. 7 7
      arch/riscv/include/asm/csr.h
  2. 6 1
      arch/riscv/include/asm/mmu_context.h
  3. 3 3
      arch/riscv/kernel/head.S
  4. 4 0
      arch/riscv/mm/fault.c

+ 7 - 7
arch/riscv/include/asm/csr.h

@@ -40,15 +40,15 @@
 #define SR_SD   _AC(0x8000000000000000, UL) /* FS/XS dirty */
 #define SR_SD   _AC(0x8000000000000000, UL) /* FS/XS dirty */
 #endif
 #endif
 
 
-/* SPTBR flags */
+/* SATP flags */
 #if __riscv_xlen == 32
 #if __riscv_xlen == 32
-#define SPTBR_PPN     _AC(0x003FFFFF, UL)
-#define SPTBR_MODE_32 _AC(0x80000000, UL)
-#define SPTBR_MODE    SPTBR_MODE_32
+#define SATP_PPN     _AC(0x003FFFFF, UL)
+#define SATP_MODE_32 _AC(0x80000000, UL)
+#define SATP_MODE    SATP_MODE_32
 #else
 #else
-#define SPTBR_PPN     _AC(0x00000FFFFFFFFFFF, UL)
-#define SPTBR_MODE_39 _AC(0x8000000000000000, UL)
-#define SPTBR_MODE    SPTBR_MODE_39
+#define SATP_PPN     _AC(0x00000FFFFFFFFFFF, UL)
+#define SATP_MODE_39 _AC(0x8000000000000000, UL)
+#define SATP_MODE    SATP_MODE_39
 #endif
 #endif
 
 
 /* Interrupt Enable and Interrupt Pending flags */
 /* Interrupt Enable and Interrupt Pending flags */

+ 6 - 1
arch/riscv/include/asm/mmu_context.h

@@ -41,7 +41,12 @@ static inline void destroy_context(struct mm_struct *mm)
 
 
 static inline void set_pgdir(pgd_t *pgd)
 static inline void set_pgdir(pgd_t *pgd)
 {
 {
-	csr_write(sptbr, virt_to_pfn(pgd) | SPTBR_MODE);
+	/*
+	 * Use the old spbtr name instead of using the current satp
+	 * name to support binutils 2.29 which doesn't know about the
+	 * privileged ISA 1.10 yet.
+	 */
+	csr_write(sptbr, virt_to_pfn(next->pgd) | SATP_MODE);
 }
 }
 
 
 /*
 /*

+ 3 - 3
arch/riscv/kernel/head.S

@@ -74,15 +74,15 @@ relocate:
 	sub a1, a1, a0
 	sub a1, a1, a0
 	add ra, ra, a1
 	add ra, ra, a1
 
 
-	/* Point stvec to virtual address of intruction after sptbr write */
+	/* Point stvec to virtual address of intruction after satp write */
 	la a0, 1f
 	la a0, 1f
 	add a0, a0, a1
 	add a0, a0, a1
 	csrw stvec, a0
 	csrw stvec, a0
 
 
-	/* Compute sptbr for kernel page tables, but don't load it yet */
+	/* Compute satp for kernel page tables, but don't load it yet */
 	la a2, swapper_pg_dir
 	la a2, swapper_pg_dir
 	srl a2, a2, PAGE_SHIFT
 	srl a2, a2, PAGE_SHIFT
-	li a1, SPTBR_MODE
+	li a1, SATP_MODE
 	or a2, a2, a1
 	or a2, a2, a1
 
 
 	/*
 	/*

+ 4 - 0
arch/riscv/mm/fault.c

@@ -239,6 +239,10 @@ vmalloc_fault:
 		 * Do _not_ use "tsk->active_mm->pgd" here.
 		 * Do _not_ use "tsk->active_mm->pgd" here.
 		 * We might be inside an interrupt in the middle
 		 * We might be inside an interrupt in the middle
 		 * of a task switch.
 		 * of a task switch.
+		 *
+		 * Note: Use the old spbtr name instead of using the current
+		 * satp name to support binutils 2.29 which doesn't know about
+		 * the privileged ISA 1.10 yet.
 		 */
 		 */
 		index = pgd_index(addr);
 		index = pgd_index(addr);
 		pgd = (pgd_t *)pfn_to_virt(csr_read(sptbr)) + index;
 		pgd = (pgd_t *)pfn_to_virt(csr_read(sptbr)) + index;