Commit 4bb87563 authored by Atish Patra's avatar Atish Patra Committed by Palmer Dabbelt

RISC-V: Add a non-void return for sbi v02 functions

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: default avatarAtish Patra <atish.patra@wdc.com>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent 65d4b9c5
...@@ -100,13 +100,13 @@ int sbi_console_getchar(void); ...@@ -100,13 +100,13 @@ int sbi_console_getchar(void);
void sbi_set_timer(uint64_t stime_value); void sbi_set_timer(uint64_t stime_value);
void sbi_shutdown(void); void sbi_shutdown(void);
void sbi_clear_ipi(void); void sbi_clear_ipi(void);
void sbi_send_ipi(const unsigned long *hart_mask); int sbi_send_ipi(const unsigned long *hart_mask);
void sbi_remote_fence_i(const unsigned long *hart_mask); int sbi_remote_fence_i(const unsigned long *hart_mask);
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 start,
unsigned long size); 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 start,
unsigned long size, unsigned long size,
unsigned long asid); unsigned long asid);
...@@ -147,7 +147,7 @@ static inline unsigned long sbi_minor_version(void) ...@@ -147,7 +147,7 @@ static inline unsigned long sbi_minor_version(void)
int sbi_err_map_linux_errno(int err); int sbi_err_map_linux_errno(int err);
#else /* CONFIG_RISCV_SBI */ #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) { return -1; }
static inline void sbi_init(void) {} static inline void sbi_init(void) {}
#endif /* CONFIG_RISCV_SBI */ #endif /* CONFIG_RISCV_SBI */
#endif /* _ASM_RISCV_SBI_H */ #endif /* _ASM_RISCV_SBI_H */
...@@ -351,7 +351,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask, ...@@ -351,7 +351,7 @@ static int __sbi_rfence_v02(int fid, const unsigned long *hart_mask,
* sbi_set_timer() - Program the timer for next timer event. * sbi_set_timer() - Program the timer for next timer event.
* @stime_value: The value after which next timer event should fire. * @stime_value: The value after which next timer event should fire.
* *
* Return: None * Return: None.
*/ */
void sbi_set_timer(uint64_t stime_value) void sbi_set_timer(uint64_t stime_value)
{ {
...@@ -362,11 +362,11 @@ void sbi_set_timer(uint64_t stime_value) ...@@ -362,11 +362,11 @@ void sbi_set_timer(uint64_t stime_value)
* sbi_send_ipi() - Send an IPI to any hart. * sbi_send_ipi() - Send an IPI to any hart.
* @hart_mask: A cpu mask containing all the target harts. * @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); EXPORT_SYMBOL(sbi_send_ipi);
...@@ -374,11 +374,11 @@ EXPORT_SYMBOL(sbi_send_ipi); ...@@ -374,11 +374,11 @@ EXPORT_SYMBOL(sbi_send_ipi);
* sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts. * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
* @hart_mask: A cpu mask containing all the target 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, return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_FENCE_I,
hart_mask, 0, 0, 0, 0); hart_mask, 0, 0, 0, 0);
} }
EXPORT_SYMBOL(sbi_remote_fence_i); EXPORT_SYMBOL(sbi_remote_fence_i);
...@@ -390,13 +390,13 @@ EXPORT_SYMBOL(sbi_remote_fence_i); ...@@ -390,13 +390,13 @@ EXPORT_SYMBOL(sbi_remote_fence_i);
* @start: Start of the virtual address * @start: Start of the virtual address
* @size: Total size of the virtual address range. * @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 start,
unsigned long size) unsigned long size)
{ {
__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA, return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
hart_mask, start, size, 0, 0); hart_mask, start, size, 0, 0);
} }
EXPORT_SYMBOL(sbi_remote_sfence_vma); EXPORT_SYMBOL(sbi_remote_sfence_vma);
...@@ -410,14 +410,14 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma); ...@@ -410,14 +410,14 @@ EXPORT_SYMBOL(sbi_remote_sfence_vma);
* @size: Total size of the virtual address range. * @size: Total size of the virtual address range.
* @asid: The value of address space identifier (ASID). * @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 start,
unsigned long size, unsigned long size,
unsigned long asid) unsigned long asid)
{ {
__sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID, return __sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
hart_mask, start, size, asid, 0); hart_mask, start, size, asid, 0);
} }
EXPORT_SYMBOL(sbi_remote_sfence_vma_asid); EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment