All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid}
@ 2020-03-06  8:44 Bin Meng
  2020-03-06  8:44 ` [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi() Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bin Meng @ 2020-03-06  8:44 UTC (permalink / raw)
  To: u-boot

Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
to SBI at all, which is semantically incorrect.

This keeps in sync with Linux kernel commit:
  a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/riscv/include/asm/sbi.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index ced57de..d5081f9 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -20,22 +20,27 @@
 #define SBI_REMOTE_SFENCE_VMA_ASID 7
 #define SBI_SHUTDOWN 8
 
-#define SBI_CALL(which, arg0, arg1, arg2) ({			\
+#define SBI_CALL(which, arg0, arg1, arg2, arg3) ({		\
 	register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);	\
 	register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);	\
 	register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);	\
+	register uintptr_t a3 asm ("a3") = (uintptr_t)(arg3);	\
 	register uintptr_t a7 asm ("a7") = (uintptr_t)(which);	\
 	asm volatile ("ecall"					\
 		      : "+r" (a0)				\
-		      : "r" (a1), "r" (a2), "r" (a7)		\
+		      : "r" (a1), "r" (a2), "r" (a3), "r" (a7)	\
 		      : "memory");				\
 	a0;							\
 })
 
 /* Lazy implementations until SBI is finalized */
-#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0)
-#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0)
-#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0)
+#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0, 0)
+#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0, 0)
+#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0, 0)
+#define SBI_CALL_3(which, arg0, arg1, arg2) \
+		SBI_CALL(which, arg0, arg1, arg2, 0)
+#define SBI_CALL_4(which, arg0, arg1, arg2, arg3) \
+		SBI_CALL(which, arg0, arg1, arg2, arg3)
 
 static inline void sbi_console_putchar(int ch)
 {
@@ -80,7 +85,7 @@ static inline void sbi_remote_sfence_vma(const unsigned long *hart_mask,
 					 unsigned long start,
 					 unsigned long size)
 {
-	SBI_CALL_1(SBI_REMOTE_SFENCE_VMA, hart_mask);
+	SBI_CALL_3(SBI_REMOTE_SFENCE_VMA, hart_mask, start, size);
 }
 
 static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
@@ -88,7 +93,7 @@ static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 					      unsigned long size,
 					      unsigned long asid)
 {
-	SBI_CALL_1(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask);
+	SBI_CALL_4(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask, start, size, asid);
 }
 
 #endif
-- 
2.7.4

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

* [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi()
  2020-03-06  8:44 [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
@ 2020-03-06  8:44 ` Bin Meng
  2020-03-11 21:54   ` Lukas Auer
  2020-03-10  1:53 ` [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
  2020-03-11 21:54 ` Lukas Auer
  2 siblings, 1 reply; 6+ messages in thread
From: Bin Meng @ 2020-03-06  8:44 UTC (permalink / raw)
  To: u-boot

There is no need for S-mode U-Boot to call sbi_clear_ipi() as it
can be cleared directly from S-mode. This saves some cycles.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/riscv/lib/sbi_ipi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/lib/sbi_ipi.c b/arch/riscv/lib/sbi_ipi.c
index 9a698ce..abafca9 100644
--- a/arch/riscv/lib/sbi_ipi.c
+++ b/arch/riscv/lib/sbi_ipi.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/encoding.h>
 #include <asm/sbi.h>
 
 int riscv_send_ipi(int hart)
@@ -19,7 +20,7 @@ int riscv_send_ipi(int hart)
 
 int riscv_clear_ipi(int hart)
 {
-	sbi_clear_ipi();
+	csr_clear(CSR_SIP, SIP_SSIP);
 
 	return 0;
 }
-- 
2.7.4

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

* [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid}
  2020-03-06  8:44 [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
  2020-03-06  8:44 ` [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi() Bin Meng
@ 2020-03-10  1:53 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46E25F8@ATCPCS16.andestech.com>
  2020-03-11 21:54 ` Lukas Auer
  2 siblings, 1 reply; 6+ messages in thread
From: Bin Meng @ 2020-03-10  1:53 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Fri, Mar 6, 2020 at 4:44 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
> to SBI at all, which is semantically incorrect.
>
> This keeps in sync with Linux kernel commit:
>   a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/riscv/include/asm/sbi.h | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
>

Ping?

I think these 2 patches in this series should be in v2020.04

Regards,
Bin

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

* [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid}
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46E25F8@ATCPCS16.andestech.com>
@ 2020-03-10  6:41     ` Rick Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Rick Chen @ 2020-03-10  6:41 UTC (permalink / raw)
  To: u-boot

Hi Bin

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Tuesday, March 10, 2020 9:54 AM
> To: Lukas Auer; Rick Jian-Zhi Chen(???); U-Boot Mailing List
> Subject: Re: [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid}
>
> Hi Rick,
>
> On Fri, Mar 6, 2020 at 4:44 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
> > to SBI at all, which is semantically incorrect.
> >
> > This keeps in sync with Linux kernel commit:
> >   a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/riscv/include/asm/sbi.h | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> >
>
> Ping?
>
> I think these 2 patches in this series should be in v2020.04

OK, no problem.
I will review and pull it later.

Thanks,
Rick

>
> Regards,
> Bin

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

* [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid}
  2020-03-06  8:44 [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
  2020-03-06  8:44 ` [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi() Bin Meng
  2020-03-10  1:53 ` [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
@ 2020-03-11 21:54 ` Lukas Auer
  2 siblings, 0 replies; 6+ messages in thread
From: Lukas Auer @ 2020-03-11 21:54 UTC (permalink / raw)
  To: u-boot

On Fri, 2020-03-06 at 00:44 -0800, Bin Meng wrote:
> Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
> to SBI at all, which is semantically incorrect.
> 
> This keeps in sync with Linux kernel commit:
>   a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  arch/riscv/include/asm/sbi.h | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 

Reviewed-by: Lukas Auer <lukas@auer.io>

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

* [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi()
  2020-03-06  8:44 ` [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi() Bin Meng
@ 2020-03-11 21:54   ` Lukas Auer
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Auer @ 2020-03-11 21:54 UTC (permalink / raw)
  To: u-boot

On Fri, 2020-03-06 at 00:44 -0800, Bin Meng wrote:
> There is no need for S-mode U-Boot to call sbi_clear_ipi() as it
> can be cleared directly from S-mode. This saves some cycles.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  arch/riscv/lib/sbi_ipi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Reviewed-by: Lukas Auer <lukas@auer.io>

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

end of thread, other threads:[~2020-03-11 21:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06  8:44 [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
2020-03-06  8:44 ` [PATCH 2/2] riscv: Avoid calling sbi_clear_ipi() Bin Meng
2020-03-11 21:54   ` Lukas Auer
2020-03-10  1:53 ` [PATCH 1/2] riscv: Fix sbi_remote_sfence_vma{,_asid} Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46E25F8@ATCPCS16.andestech.com>
2020-03-10  6:41     ` Rick Chen
2020-03-11 21:54 ` Lukas Auer

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.