All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: fix pfn_to_virt err in do_page_fault().
@ 2020-09-17  7:25 ` liush
  0 siblings, 0 replies; 10+ messages in thread
From: liush @ 2020-09-17  7:25 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, akpm, peterx, walken, daniel.m.jordan,
	vbabka, rppt
  Cc: liush, linux-riscv, linux-kernel

The argument to pfn_to_virt() should be pfn not the value of CSR_SATP.

Signed-off-by: liush <liush@allwinnertech.com>
---
 arch/riscv/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 716d64e..9b4e088 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -212,7 +212,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 		 * of a task switch.
 		 */
 		index = pgd_index(addr);
-		pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index;
+		pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP) & SATP_PPN) + index;
 		pgd_k = init_mm.pgd + index;
 
 		if (!pgd_present(*pgd_k))
-- 
2.7.4


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-22 21:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17  7:25 [PATCH] riscv: fix pfn_to_virt err in do_page_fault() liush
2020-09-17  7:25 ` liush
2020-09-17  7:59 ` Anup Patel
2020-09-17  7:59   ` Anup Patel
2020-09-17 15:25 ` Christoph Hellwig
2020-09-17 15:25   ` Christoph Hellwig
2020-09-18  7:43   ` 回复:[PATCH] " 刘邵华BTD
2020-09-18  7:43     ` 刘邵华BTD
2020-09-28  9:31     ` fuyao
2020-09-28  9:31       ` fuyao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.