* [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: linux-riscv, linux-kernel, liush
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [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
* Re: [PATCH] riscv: fix pfn_to_virt err in do_page_fault().
2020-09-17 7:25 ` liush
@ 2020-09-17 7:59 ` Anup Patel
-1 siblings, 0 replies; 10+ messages in thread
From: Anup Patel @ 2020-09-17 7:59 UTC (permalink / raw)
To: liush
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Andrew Morton, peterx,
walken, daniel.m.jordan, vbabka, Mike Rapoport, linux-riscv,
linux-kernel@vger.kernel.org List
On Thu, Sep 17, 2020 at 12:56 PM liush <liush@allwinnertech.com> wrote:
>
> 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
>
Looks good to me.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] riscv: fix pfn_to_virt err in do_page_fault().
@ 2020-09-17 7:59 ` Anup Patel
0 siblings, 0 replies; 10+ messages in thread
From: Anup Patel @ 2020-09-17 7:59 UTC (permalink / raw)
To: liush
Cc: Albert Ou, linux-kernel@vger.kernel.org List, peterx,
daniel.m.jordan, Palmer Dabbelt, Mike Rapoport, Paul Walmsley,
Andrew Morton, walken, linux-riscv, vbabka
On Thu, Sep 17, 2020 at 12:56 PM liush <liush@allwinnertech.com> wrote:
>
> 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
>
Looks good to me.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] riscv: fix pfn_to_virt err in do_page_fault().
2020-09-17 7:25 ` liush
@ 2020-09-17 15:25 ` Christoph Hellwig
-1 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-09-17 15:25 UTC (permalink / raw)
To: liush
Cc: paul.walmsley, palmer, aou, akpm, peterx, walken,
daniel.m.jordan, vbabka, rppt, linux-riscv, linux-kernel
On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> 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;
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] riscv: fix pfn_to_virt err in do_page_fault().
@ 2020-09-17 15:25 ` Christoph Hellwig
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-09-17 15:25 UTC (permalink / raw)
To: liush
Cc: aou, linux-kernel, peterx, daniel.m.jordan, palmer, rppt,
paul.walmsley, akpm, walken, linux-riscv, vbabka
On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> 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;
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
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复:[PATCH] riscv: fix pfn_to_virt err in do_page_fault().
2020-09-17 15:25 ` Christoph Hellwig
@ 2020-09-18 7:43 ` 刘邵华BTD
-1 siblings, 0 replies; 10+ messages in thread
From: 刘邵华BTD @ 2020-09-18 7:43 UTC (permalink / raw)
To: Christoph Hellwig
Cc: paul.walmsley, palmer, aou, akpm, peterx, walken,
daniel.m.jordan, vbabka, rppt, linux-riscv, linux-kernel
Hi Christoph,
> On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> > 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;
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复:[PATCH] riscv: fix pfn_to_virt err in do_page_fault().
@ 2020-09-18 7:43 ` 刘邵华BTD
0 siblings, 0 replies; 10+ messages in thread
From: 刘邵华BTD @ 2020-09-18 7:43 UTC (permalink / raw)
To: Christoph Hellwig
Cc: aou, linux-kernel, peterx, daniel.m.jordan, palmer, rppt,
paul.walmsley, akpm, walken, linux-riscv, vbabka
Hi Christoph,
> On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> > 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;
> 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 回复:[PATCH] riscv: fix pfn_to_virt err in do_page_fault().
2020-09-18 7:43 ` 刘邵华BTD
@ 2020-09-28 9:31 ` fuyao
-1 siblings, 0 replies; 10+ messages in thread
From: fuyao @ 2020-09-28 9:31 UTC (permalink / raw)
To: 刘邵华BTD
Cc: Christoph Hellwig, paul.walmsley, palmer, aou, akpm, peterx,
walken, daniel.m.jordan, vbabka, rppt, linux-riscv, linux-kernel
On Fri, Sep 18, 2020 at 03:43:39PM +0800, 刘邵华BTD wrote:
> Hi Christoph,
> > On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> > > 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;
>
> > 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
Tested-by: fuayo@allwinnertech.com
--
<http://www.allwinnertech.com> Allwinnertech Technology
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 回复:[PATCH] riscv: fix pfn_to_virt err in do_page_fault().
@ 2020-09-28 9:31 ` fuyao
0 siblings, 0 replies; 10+ messages in thread
From: fuyao @ 2020-09-28 9:31 UTC (permalink / raw)
To: 刘邵华BTD
Cc: aou, linux-kernel, peterx, daniel.m.jordan, Christoph Hellwig,
palmer, rppt, paul.walmsley, akpm, walken, linux-riscv, vbabka
On Fri, Sep 18, 2020 at 03:43:39PM +0800, 刘邵华BTD wrote:
> Hi Christoph,
> > On Thu, Sep 17, 2020 at 03:25:49PM +0800, liush wrote:
> > > 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;
>
> > 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
Tested-by: fuayo@allwinnertech.com
--
<http://www.allwinnertech.com> Allwinnertech Technology
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [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.