All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-04  5:26 ` Atish Patra
  0 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-04  5:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Atish Patra, Albert Ou, Anup Patel, Kefeng Wang, linux-riscv,
	Palmer Dabbelt, Paul Walmsley

SBI v0.2 functions can return an error code from SBI implementation.
We are already processing the SBI error code and coverts it to the Linux
error code.

Propagate to the error code to the caller as well. As of now, kvm is the
only user of these error codes.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/include/asm/sbi.h | 10 +++++-----
 arch/riscv/kernel/sbi.c      | 32 ++++++++++++++++----------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index 1b26ec8e6a15..3e7141a7d11f 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -116,13 +116,13 @@ int sbi_console_getchar(void);
 void sbi_set_timer(uint64_t stime_value);
 void sbi_shutdown(void);
 void sbi_clear_ipi(void);
-void sbi_send_ipi(const unsigned long *hart_mask);
-void sbi_remote_fence_i(const unsigned long *hart_mask);
-void sbi_remote_sfence_vma(const unsigned long *hart_mask,
+int sbi_send_ipi(const unsigned long *hart_mask);
+int sbi_remote_fence_i(const unsigned long *hart_mask);
+int sbi_remote_sfence_vma(const unsigned long *hart_mask,
 			   unsigned long start,
 			   unsigned long size);
 
-void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 				unsigned long start,
 				unsigned long size,
 				unsigned long asid);
@@ -163,7 +163,7 @@ static inline unsigned long sbi_minor_version(void)
 
 int sbi_err_map_linux_errno(int err);
 #else /* CONFIG_RISCV_SBI */
-static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
+static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
 static inline void sbi_init(void) {}
 #endif /* CONFIG_RISCV_SBI */
 #endif /* _ASM_RISCV_SBI_H */
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 8d60b2ebcad3..f904af48635d 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -352,7 +352,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask,
  * sbi_set_timer() - Program the timer for next timer event.
  * @stime_value: The value after which next timer event should fire.
  *
- * Return: None
+ * Return: None.
  */
 void sbi_set_timer(uint64_t stime_value)
 {
@@ -363,11 +363,11 @@ void sbi_set_timer(uint64_t stime_value)
  * sbi_send_ipi() - Send an IPI to any hart.
  * @hart_mask: A cpu mask containing all the target harts.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_send_ipi(const unsigned long *hart_mask)
+int sbi_send_ipi(const unsigned long *hart_mask)
 {
-	__sbi_send_ipi(hart_mask);
+	return __sbi_send_ipi(hart_mask);
 }
 EXPORT_SYMBOL(sbi_send_ipi);
 
@@ -375,12 +375,12 @@ EXPORT_SYMBOL(sbi_send_ipi);
  * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
  * @hart_mask: A cpu mask containing all the target harts.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_fence_i(const unsigned long *hart_mask)
+int sbi_remote_fence_i(const unsigned long *hart_mask)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
-		     hart_mask, 0, 0, 0, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
+			    hart_mask, 0, 0, 0, 0);
 }
 EXPORT_SYMBOL(sbi_remote_fence_i);
 
@@ -391,14 +391,14 @@ EXPORT_SYMBOL(sbi_remote_fence_i);
  * @start: Start of the virtual address
  * @size: Total size of the virtual address range.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_sfence_vma(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma(const unsigned long *hart_mask,
 			   unsigned long start,
 			   unsigned long size)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
-		     hart_mask, start, size, 0, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
+			    hart_mask, start, size, 0, 0);
 }
 EXPORT_SYMBOL(sbi_remote_sfence_vma);
 
@@ -411,15 +411,15 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma);
  * @size: Total size of the virtual address range.
  * @asid: The value of address space identifier (ASID).
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 				unsigned long start,
 				unsigned long size,
 				unsigned long asid)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
-		     hart_mask, start, size, asid, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
+			    hart_mask, start, size, asid, 0);
 }
 EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
 
-- 
2.25.1


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

* [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-04  5:26 ` Atish Patra
  0 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-04  5:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Kefeng Wang, Albert Ou, Anup Patel, Atish Patra, Palmer Dabbelt,
	Paul Walmsley, linux-riscv

SBI v0.2 functions can return an error code from SBI implementation.
We are already processing the SBI error code and coverts it to the Linux
error code.

Propagate to the error code to the caller as well. As of now, kvm is the
only user of these error codes.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/include/asm/sbi.h | 10 +++++-----
 arch/riscv/kernel/sbi.c      | 32 ++++++++++++++++----------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index 1b26ec8e6a15..3e7141a7d11f 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -116,13 +116,13 @@ int sbi_console_getchar(void);
 void sbi_set_timer(uint64_t stime_value);
 void sbi_shutdown(void);
 void sbi_clear_ipi(void);
-void sbi_send_ipi(const unsigned long *hart_mask);
-void sbi_remote_fence_i(const unsigned long *hart_mask);
-void sbi_remote_sfence_vma(const unsigned long *hart_mask,
+int sbi_send_ipi(const unsigned long *hart_mask);
+int sbi_remote_fence_i(const unsigned long *hart_mask);
+int sbi_remote_sfence_vma(const unsigned long *hart_mask,
 			   unsigned long start,
 			   unsigned long size);
 
-void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 				unsigned long start,
 				unsigned long size,
 				unsigned long asid);
@@ -163,7 +163,7 @@ static inline unsigned long sbi_minor_version(void)
 
 int sbi_err_map_linux_errno(int err);
 #else /* CONFIG_RISCV_SBI */
-static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
+static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
 static inline void sbi_init(void) {}
 #endif /* CONFIG_RISCV_SBI */
 #endif /* _ASM_RISCV_SBI_H */
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 8d60b2ebcad3..f904af48635d 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -352,7 +352,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask,
  * sbi_set_timer() - Program the timer for next timer event.
  * @stime_value: The value after which next timer event should fire.
  *
- * Return: None
+ * Return: None.
  */
 void sbi_set_timer(uint64_t stime_value)
 {
@@ -363,11 +363,11 @@ void sbi_set_timer(uint64_t stime_value)
  * sbi_send_ipi() - Send an IPI to any hart.
  * @hart_mask: A cpu mask containing all the target harts.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_send_ipi(const unsigned long *hart_mask)
+int sbi_send_ipi(const unsigned long *hart_mask)
 {
-	__sbi_send_ipi(hart_mask);
+	return __sbi_send_ipi(hart_mask);
 }
 EXPORT_SYMBOL(sbi_send_ipi);
 
@@ -375,12 +375,12 @@ EXPORT_SYMBOL(sbi_send_ipi);
  * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
  * @hart_mask: A cpu mask containing all the target harts.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_fence_i(const unsigned long *hart_mask)
+int sbi_remote_fence_i(const unsigned long *hart_mask)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
-		     hart_mask, 0, 0, 0, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
+			    hart_mask, 0, 0, 0, 0);
 }
 EXPORT_SYMBOL(sbi_remote_fence_i);
 
@@ -391,14 +391,14 @@ EXPORT_SYMBOL(sbi_remote_fence_i);
  * @start: Start of the virtual address
  * @size: Total size of the virtual address range.
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_sfence_vma(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma(const unsigned long *hart_mask,
 			   unsigned long start,
 			   unsigned long size)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
-		     hart_mask, start, size, 0, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
+			    hart_mask, start, size, 0, 0);
 }
 EXPORT_SYMBOL(sbi_remote_sfence_vma);
 
@@ -411,15 +411,15 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma);
  * @size: Total size of the virtual address range.
  * @asid: The value of address space identifier (ASID).
  *
- * Return: None
+ * Return: 0 on success, appropriate linux error code otherwise.
  */
-void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
+int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 				unsigned long start,
 				unsigned long size,
 				unsigned long asid)
 {
-	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
-		     hart_mask, start, size, asid, 0);
+	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
+			    hart_mask, start, size, asid, 0);
 }
 EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
 
-- 
2.25.1


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

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
  2021-02-04  5:26 ` Atish Patra
@ 2021-02-05  7:06   ` Palmer Dabbelt
  -1 siblings, 0 replies; 12+ messages in thread
From: Palmer Dabbelt @ 2021-02-05  7:06 UTC (permalink / raw)
  To: Atish Patra
  Cc: linux-kernel, Atish Patra, aou, Anup Patel, wangkefeng.wang,
	linux-riscv, Paul Walmsley

On Wed, 03 Feb 2021 21:26:43 PST (-0800), Atish Patra wrote:
> SBI v0.2 functions can return an error code from SBI implementation.
> We are already processing the SBI error code and coverts it to the Linux
> error code.
>
> Propagate to the error code to the caller as well. As of now, kvm is the
> only user of these error codes.
>
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
>  arch/riscv/include/asm/sbi.h | 10 +++++-----
>  arch/riscv/kernel/sbi.c      | 32 ++++++++++++++++----------------
>  2 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 1b26ec8e6a15..3e7141a7d11f 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -116,13 +116,13 @@ int sbi_console_getchar(void);
>  void sbi_set_timer(uint64_t stime_value);
>  void sbi_shutdown(void);
>  void sbi_clear_ipi(void);
> -void sbi_send_ipi(const unsigned long *hart_mask);
> -void sbi_remote_fence_i(const unsigned long *hart_mask);
> -void sbi_remote_sfence_vma(const unsigned long *hart_mask,
> +int sbi_send_ipi(const unsigned long *hart_mask);
> +int sbi_remote_fence_i(const unsigned long *hart_mask);
> +int sbi_remote_sfence_vma(const unsigned long *hart_mask,
>  			   unsigned long start,
>  			   unsigned long size);
>
> -void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
>  				unsigned long start,
>  				unsigned long size,
>  				unsigned long asid);
> @@ -163,7 +163,7 @@ static inline unsigned long sbi_minor_version(void)
>
>  int sbi_err_map_linux_errno(int err);
>  #else /* CONFIG_RISCV_SBI */
> -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>  static inline void sbi_init(void) {}
>  #endif /* CONFIG_RISCV_SBI */
>  #endif /* _ASM_RISCV_SBI_H */
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 8d60b2ebcad3..f904af48635d 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -352,7 +352,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask,
>   * sbi_set_timer() - Program the timer for next timer event.
>   * @stime_value: The value after which next timer event should fire.
>   *
> - * Return: None
> + * Return: None.
>   */
>  void sbi_set_timer(uint64_t stime_value)
>  {
> @@ -363,11 +363,11 @@ void sbi_set_timer(uint64_t stime_value)
>   * sbi_send_ipi() - Send an IPI to any hart.
>   * @hart_mask: A cpu mask containing all the target harts.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_send_ipi(const unsigned long *hart_mask)
> +int sbi_send_ipi(const unsigned long *hart_mask)
>  {
> -	__sbi_send_ipi(hart_mask);
> +	return __sbi_send_ipi(hart_mask);
>  }
>  EXPORT_SYMBOL(sbi_send_ipi);
>
> @@ -375,12 +375,12 @@ EXPORT_SYMBOL(sbi_send_ipi);
>   * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
>   * @hart_mask: A cpu mask containing all the target harts.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_fence_i(const unsigned long *hart_mask)
> +int sbi_remote_fence_i(const unsigned long *hart_mask)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
> -		     hart_mask, 0, 0, 0, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
> +			    hart_mask, 0, 0, 0, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_fence_i);
>
> @@ -391,14 +391,14 @@ EXPORT_SYMBOL(sbi_remote_fence_i);
>   * @start: Start of the virtual address
>   * @size: Total size of the virtual address range.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_sfence_vma(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma(const unsigned long *hart_mask,
>  			   unsigned long start,
>  			   unsigned long size)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> -		     hart_mask, start, size, 0, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> +			    hart_mask, start, size, 0, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_sfence_vma);
>
> @@ -411,15 +411,15 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma);
>   * @size: Total size of the virtual address range.
>   * @asid: The value of address space identifier (ASID).
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
>  				unsigned long start,
>  				unsigned long size,
>  				unsigned long asid)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> -		     hart_mask, start, size, asid, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> +			    hart_mask, start, size, asid, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);

Thanks, this is on for-next.

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-05  7:06   ` Palmer Dabbelt
  0 siblings, 0 replies; 12+ messages in thread
From: Palmer Dabbelt @ 2021-02-05  7:06 UTC (permalink / raw)
  To: Atish Patra
  Cc: wangkefeng.wang, aou, Anup Patel, linux-kernel, Atish Patra,
	Paul Walmsley, linux-riscv

On Wed, 03 Feb 2021 21:26:43 PST (-0800), Atish Patra wrote:
> SBI v0.2 functions can return an error code from SBI implementation.
> We are already processing the SBI error code and coverts it to the Linux
> error code.
>
> Propagate to the error code to the caller as well. As of now, kvm is the
> only user of these error codes.
>
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
>  arch/riscv/include/asm/sbi.h | 10 +++++-----
>  arch/riscv/kernel/sbi.c      | 32 ++++++++++++++++----------------
>  2 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 1b26ec8e6a15..3e7141a7d11f 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -116,13 +116,13 @@ int sbi_console_getchar(void);
>  void sbi_set_timer(uint64_t stime_value);
>  void sbi_shutdown(void);
>  void sbi_clear_ipi(void);
> -void sbi_send_ipi(const unsigned long *hart_mask);
> -void sbi_remote_fence_i(const unsigned long *hart_mask);
> -void sbi_remote_sfence_vma(const unsigned long *hart_mask,
> +int sbi_send_ipi(const unsigned long *hart_mask);
> +int sbi_remote_fence_i(const unsigned long *hart_mask);
> +int sbi_remote_sfence_vma(const unsigned long *hart_mask,
>  			   unsigned long start,
>  			   unsigned long size);
>
> -void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
>  				unsigned long start,
>  				unsigned long size,
>  				unsigned long asid);
> @@ -163,7 +163,7 @@ static inline unsigned long sbi_minor_version(void)
>
>  int sbi_err_map_linux_errno(int err);
>  #else /* CONFIG_RISCV_SBI */
> -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>  static inline void sbi_init(void) {}
>  #endif /* CONFIG_RISCV_SBI */
>  #endif /* _ASM_RISCV_SBI_H */
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 8d60b2ebcad3..f904af48635d 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -352,7 +352,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask,
>   * sbi_set_timer() - Program the timer for next timer event.
>   * @stime_value: The value after which next timer event should fire.
>   *
> - * Return: None
> + * Return: None.
>   */
>  void sbi_set_timer(uint64_t stime_value)
>  {
> @@ -363,11 +363,11 @@ void sbi_set_timer(uint64_t stime_value)
>   * sbi_send_ipi() - Send an IPI to any hart.
>   * @hart_mask: A cpu mask containing all the target harts.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_send_ipi(const unsigned long *hart_mask)
> +int sbi_send_ipi(const unsigned long *hart_mask)
>  {
> -	__sbi_send_ipi(hart_mask);
> +	return __sbi_send_ipi(hart_mask);
>  }
>  EXPORT_SYMBOL(sbi_send_ipi);
>
> @@ -375,12 +375,12 @@ EXPORT_SYMBOL(sbi_send_ipi);
>   * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
>   * @hart_mask: A cpu mask containing all the target harts.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_fence_i(const unsigned long *hart_mask)
> +int sbi_remote_fence_i(const unsigned long *hart_mask)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
> -		     hart_mask, 0, 0, 0, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
> +			    hart_mask, 0, 0, 0, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_fence_i);
>
> @@ -391,14 +391,14 @@ EXPORT_SYMBOL(sbi_remote_fence_i);
>   * @start: Start of the virtual address
>   * @size: Total size of the virtual address range.
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_sfence_vma(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma(const unsigned long *hart_mask,
>  			   unsigned long start,
>  			   unsigned long size)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> -		     hart_mask, start, size, 0, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> +			    hart_mask, start, size, 0, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_sfence_vma);
>
> @@ -411,15 +411,15 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma);
>   * @size: Total size of the virtual address range.
>   * @asid: The value of address space identifier (ASID).
>   *
> - * Return: None
> + * Return: 0 on success, appropriate linux error code otherwise.
>   */
> -void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> +int sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
>  				unsigned long start,
>  				unsigned long size,
>  				unsigned long asid)
>  {
> -	__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> -		     hart_mask, start, size, asid, 0);
> +	return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> +			    hart_mask, start, size, asid, 0);
>  }
>  EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);

Thanks, this is on for-next.

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

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
  2021-02-04  5:26 ` Atish Patra
@ 2021-02-22 20:22   ` Guenter Roeck
  -1 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2021-02-22 20:22 UTC (permalink / raw)
  To: Atish Patra
  Cc: linux-kernel, Kefeng Wang, Albert Ou, Anup Patel, Palmer Dabbelt,
	Paul Walmsley, linux-riscv

On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> SBI v0.2 functions can return an error code from SBI implementation.
> We are already processing the SBI error code and coverts it to the Linux
> error code.
> 
> Propagate to the error code to the caller as well. As of now, kvm is the
> only user of these error codes.
> 
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
...
>  #else /* CONFIG_RISCV_SBI */
> -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}

Error log:
In file included from arch/riscv/kernel/setup.c:29:
arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void

Guenter

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-22 20:22   ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2021-02-22 20:22 UTC (permalink / raw)
  To: Atish Patra
  Cc: Kefeng Wang, Albert Ou, Anup Patel, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, linux-riscv

On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> SBI v0.2 functions can return an error code from SBI implementation.
> We are already processing the SBI error code and coverts it to the Linux
> error code.
> 
> Propagate to the error code to the caller as well. As of now, kvm is the
> only user of these error codes.
> 
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
...
>  #else /* CONFIG_RISCV_SBI */
> -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}

Error log:
In file included from arch/riscv/kernel/setup.c:29:
arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void

Guenter

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

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
  2021-02-22 20:22   ` Guenter Roeck
@ 2021-02-22 22:38     ` Atish Patra
  -1 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-22 22:38 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Atish Patra, Kefeng Wang, Albert Ou, Anup Patel,
	linux-kernel@vger.kernel.org List, Palmer Dabbelt, Paul Walmsley,
	linux-riscv

On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> > SBI v0.2 functions can return an error code from SBI implementation.
> > We are already processing the SBI error code and coverts it to the Linux
> > error code.
> >
> > Propagate to the error code to the caller as well. As of now, kvm is the
> > only user of these error codes.
> >
> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > ---
> ...
> >  #else /* CONFIG_RISCV_SBI */
> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>
> Error log:
> In file included from arch/riscv/kernel/setup.c:29:
> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
>

Sorry for the oversight. The return statement is missing.

@Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?

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



-- 
Regards,
Atish

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-22 22:38     ` Atish Patra
  0 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-22 22:38 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Kefeng Wang, Albert Ou, Anup Patel,
	linux-kernel@vger.kernel.org List, Atish Patra, Palmer Dabbelt,
	Paul Walmsley, linux-riscv

On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> > SBI v0.2 functions can return an error code from SBI implementation.
> > We are already processing the SBI error code and coverts it to the Linux
> > error code.
> >
> > Propagate to the error code to the caller as well. As of now, kvm is the
> > only user of these error codes.
> >
> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > ---
> ...
> >  #else /* CONFIG_RISCV_SBI */
> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>
> Error log:
> In file included from arch/riscv/kernel/setup.c:29:
> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
>

Sorry for the oversight. The return statement is missing.

@Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?

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



-- 
Regards,
Atish

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

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
  2021-02-22 22:38     ` Atish Patra
@ 2021-02-23  1:52       ` Palmer Dabbelt
  -1 siblings, 0 replies; 12+ messages in thread
From: Palmer Dabbelt @ 2021-02-23  1:52 UTC (permalink / raw)
  To: atishp
  Cc: linux, Atish Patra, wangkefeng.wang, aou, Anup Patel,
	linux-kernel, Paul Walmsley, linux-riscv

On Mon, 22 Feb 2021 14:38:28 PST (-0800), atishp@atishpatra.org wrote:
> On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
>> > SBI v0.2 functions can return an error code from SBI implementation.
>> > We are already processing the SBI error code and coverts it to the Linux
>> > error code.
>> >
>> > Propagate to the error code to the caller as well. As of now, kvm is the
>> > only user of these error codes.
>> >
>> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
>> > ---
>> ...
>> >  #else /* CONFIG_RISCV_SBI */
>> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
>> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>>
>> Error log:
>> In file included from arch/riscv/kernel/setup.c:29:
>> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
>> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
>>
>
> Sorry for the oversight. The return statement is missing.
>
> @Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?

I just fixed it up.

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-23  1:52       ` Palmer Dabbelt
  0 siblings, 0 replies; 12+ messages in thread
From: Palmer Dabbelt @ 2021-02-23  1:52 UTC (permalink / raw)
  To: atishp
  Cc: wangkefeng.wang, aou, Anup Patel, linux-kernel, Atish Patra,
	Paul Walmsley, linux-riscv, linux

On Mon, 22 Feb 2021 14:38:28 PST (-0800), atishp@atishpatra.org wrote:
> On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
>> > SBI v0.2 functions can return an error code from SBI implementation.
>> > We are already processing the SBI error code and coverts it to the Linux
>> > error code.
>> >
>> > Propagate to the error code to the caller as well. As of now, kvm is the
>> > only user of these error codes.
>> >
>> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
>> > ---
>> ...
>> >  #else /* CONFIG_RISCV_SBI */
>> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
>> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
>>
>> Error log:
>> In file included from arch/riscv/kernel/setup.c:29:
>> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
>> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
>>
>
> Sorry for the oversight. The return statement is missing.
>
> @Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?

I just fixed it up.

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

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
  2021-02-23  1:52       ` Palmer Dabbelt
@ 2021-02-23  2:31         ` Atish Patra
  -1 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-23  2:31 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Guenter Roeck, Atish Patra, Kefeng Wang, Albert Ou, Anup Patel,
	linux-kernel@vger.kernel.org List, Paul Walmsley, linux-riscv

On Mon, Feb 22, 2021 at 5:52 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Mon, 22 Feb 2021 14:38:28 PST (-0800), atishp@atishpatra.org wrote:
> > On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >>
> >> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> >> > SBI v0.2 functions can return an error code from SBI implementation.
> >> > We are already processing the SBI error code and coverts it to the Linux
> >> > error code.
> >> >
> >> > Propagate to the error code to the caller as well. As of now, kvm is the
> >> > only user of these error codes.
> >> >
> >> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> >> > ---
> >> ...
> >> >  #else /* CONFIG_RISCV_SBI */
> >> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> >> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
> >>
> >> Error log:
> >> In file included from arch/riscv/kernel/setup.c:29:
> >> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
> >> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
> >>
> >
> > Sorry for the oversight. The return statement is missing.
> >
> > @Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?
>
> I just fixed it up.

Thanks!

-- 
Regards,
Atish

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

* Re: [PATCH] RISC-V: Add a non-void return for sbi v02 functions
@ 2021-02-23  2:31         ` Atish Patra
  0 siblings, 0 replies; 12+ messages in thread
From: Atish Patra @ 2021-02-23  2:31 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Kefeng Wang, Albert Ou, Anup Patel,
	linux-kernel@vger.kernel.org List, Atish Patra, Paul Walmsley,
	linux-riscv, Guenter Roeck

On Mon, Feb 22, 2021 at 5:52 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Mon, 22 Feb 2021 14:38:28 PST (-0800), atishp@atishpatra.org wrote:
> > On Mon, Feb 22, 2021 at 12:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >>
> >> On Wed, Feb 03, 2021 at 09:26:43PM -0800, Atish Patra wrote:
> >> > SBI v0.2 functions can return an error code from SBI implementation.
> >> > We are already processing the SBI error code and coverts it to the Linux
> >> > error code.
> >> >
> >> > Propagate to the error code to the caller as well. As of now, kvm is the
> >> > only user of these error codes.
> >> >
> >> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> >> > ---
> >> ...
> >> >  #else /* CONFIG_RISCV_SBI */
> >> > -static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> >> > +static inline int sbi_remote_fence_i(const unsigned long *hart_mask) {}
> >>
> >> Error log:
> >> In file included from arch/riscv/kernel/setup.c:29:
> >> arch/riscv/include/asm/sbi.h: In function 'sbi_remote_fence_i':
> >> arch/riscv/include/asm/sbi.h:150:1: error: no return statement in function returning non-void
> >>
> >
> > Sorry for the oversight. The return statement is missing.
> >
> > @Palmer Dabbelt : Can you fix it in for-next or should I send a v2 ?
>
> I just fixed it up.

Thanks!

-- 
Regards,
Atish

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

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

end of thread, other threads:[~2021-02-23  2:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  5:26 [PATCH] RISC-V: Add a non-void return for sbi v02 functions Atish Patra
2021-02-04  5:26 ` Atish Patra
2021-02-05  7:06 ` Palmer Dabbelt
2021-02-05  7:06   ` Palmer Dabbelt
2021-02-22 20:22 ` Guenter Roeck
2021-02-22 20:22   ` Guenter Roeck
2021-02-22 22:38   ` Atish Patra
2021-02-22 22:38     ` Atish Patra
2021-02-23  1:52     ` Palmer Dabbelt
2021-02-23  1:52       ` Palmer Dabbelt
2021-02-23  2:31       ` Atish Patra
2021-02-23  2:31         ` Atish Patra

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.