riscv: fix pfn_to_virt err in do_page_fault().
PATCH 1/1 riscv: fix pfn_to_virt err in do_page_fault().
The argument to pfn_to_virt() should be pfn not the value of CSR_SATP.
--- arch/riscv/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/fault.c +1 -1
@@ -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))
Signature · 1 line
2.7.4
Quoted 22 lines · liush
The argument to
pfn_to_virt()should be pfn not the value ofCSR_SATP.Signed-off-by liush <[email protected]>--- arch/riscv/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/mm/fault.c +1
-2@@ -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)) --
Quoted 2 lines
2.7.4
Looks good to me.
Regards,
Anup
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 12 lines · liush
The argument to
pfn_to_virt()should be pfn not the value ofCSR_SATP.Signed-off-by liush <[email protected]>--- arch/riscv/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/mm/fault.c +0
-0
arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 215
Quoted 5 lines
arch/riscv/mm/fault.c +1
-1@@ -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;
This adds a crazy long line. One nice way to clean this up would be to add a local pfn variable, as it would also make the code more readable.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Christoph,
Quoted 8 lines · liush
Quoted 7 lines
The argument to
pfn_to_virt()should be pfn not the value ofCSR_SATP.Signed-off-by liush <[email protected]>--- arch/riscv/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 215
Quoted 10 lines
arch/riscv/mm/fault.c +1
-1@@ -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;This adds a crazy long line. One nice way to clean this up would be to add a local pfn variable, as it would also make the code more readable.
Thanks, i'll modify it in next revision
fuyao
Tested-by [email protected]Quoted 23 lines · 刘邵华BTD
Hi Christoph,
Quoted 8 lines · liush
Quoted 7 lines
The argument to
pfn_to_virt()should be pfn not the value ofCSR_SATP.Signed-off-by liush <[email protected]>--- arch/riscv/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 215
Quoted 10 lines
arch/riscv/mm/fault.c +1
-1@@ -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;This adds a crazy long line. One nice way to clean this up would be to add a local pfn variable, as it would also make the code more readable.
Quoted 1 line
Thanks, i'll modify it in next revision
Signature · 1 line
<http://www.allwinnertech.com> Allwinnertech Technology