Few v0.1 SBI calls are being replaced by new SBI calls that follows
v0.2 calling convention. The specification changes can be found at
riscv/riscv-sbi-doc#27
Implement the replacement extensions and few additional new SBI
function calls that makes way for a better SBI interface in future.
Signed-off-by: Atish Patra <[email protected]>
---
arch/riscv/include/asm/sbi.h | 35 +++++++
arch/riscv/kernel/sbi.c | 197 ++++++++++++++++++++++++++++++++++-
2 files changed, 229 insertions(+), 3 deletions(-)
diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index cc82ae63f8e0..54ba9eebec11 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -22,6 +22,9 @@ enum sbi_ext_id {
SBI_EXT_0_1_SHUTDOWN = 0x8,
#endif
SBI_EXT_BASE = 0x10,
+ SBI_EXT_TIME = 0x54494D45,
+ SBI_EXT_IPI = 0x735049,
+ SBI_EXT_RFENCE = 0x52464E43,
};
enum sbi_ext_base_fid {
@@ -34,6 +37,24 @@ enum sbi_ext_base_fid {
SBI_BASE_GET_MIMPID,
};
+enum sbi_ext_time_fid {
+ SBI_EXT_TIME_SET_TIMER = 0,
+};
+
+enum sbi_ext_ipi_fid {
+ SBI_EXT_IPI_SEND_IPI = 0,
+};
+
+enum sbi_ext_rfence_fid {
+ SBI_EXT_RFENCE_REMOTE_FENCE_I = 0,
+ SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
+ SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
+};
+
#define SBI_SPEC_VERSION_DEFAULT 0x1
#define SBI_SPEC_VERSION_MAJOR_OFFSET 24
#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
@@ -74,6 +95,20 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
unsigned long start,
unsigned long size,
unsigned long asid);
+int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size);
+int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size,
+ unsigned long vmid);
+int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size);
+int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size,
+ unsigned long asid);
int sbi_probe_extension(long ext);
/* Check if current SBI specification version is 0.1 or not */
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 8574de1074c4..74b3155b570f 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -205,6 +205,101 @@ static int __sbi_rfence_v01(unsigned long ext, unsigned long fid,
}
#endif /* CONFIG_RISCV_SBI_V01 */
+static void __sbi_set_timer_v02(uint64_t stime_value)
+{
+#if __riscv_xlen == 32
+ sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
+ stime_value >> 32, 0, 0, 0, 0);
+#else
+ sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0,
+ 0, 0, 0, 0);
+#endif
+}
+
+static int __sbi_send_ipi_v02(const unsigned long *hart_mask)
+{
+ unsigned long hmask_val;
+ struct sbiret ret = {0};
+ int result;
+
+ if (!hart_mask)
+ hmask_val = *(cpumask_bits(cpu_online_mask));
+ else
+ hmask_val = *hart_mask;
+
+ ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hmask_val,
+ 0, 0, 0, 0, 0);
+ if (ret.error) {
+ pr_err("%s: failed with error [%d]\n", __func__,
+ sbi_err_map_linux_errno(ret.error));
+ result = ret.error;
+ } else
+ result = ret.value;
+
+ return result;
+}
+
+static int __sbi_rfence_v02(unsigned long extid, unsigned long fid,
+ const unsigned long *hart_mask,
+ unsigned long hbase, unsigned long start,
+ unsigned long size, unsigned long arg4,
+ unsigned long arg5)
+{
+ unsigned long hmask_val;
+ struct sbiret ret = {0};
+ int result;
+ unsigned long ext = SBI_EXT_RFENCE;
+
+ if (!hart_mask)
+ hmask_val = *(cpumask_bits(cpu_online_mask));
+ else
+ hmask_val = *hart_mask;
+
+ switch (fid) {
+ case SBI_EXT_RFENCE_REMOTE_FENCE_I:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, 0, 0, 0, 0);
+ break;
+ case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, 0, 0);
+ break;
+ case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, arg4, 0);
+ break;
+ /*TODO: Handle non zero hbase cases */
+ case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, 0, 0);
+ break;
+ case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, arg4, 0);
+ break;
+ case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, 0, 0);
+ break;
+ case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
+ ret = sbi_ecall(ext, fid, hmask_val, 0, start,
+ size, arg4, 0);
+ break;
+ default:
+ pr_err("unknown function ID [%lu] for SBI extension [%lu]\n",
+ fid, ext);
+ result = -EINVAL;
+ }
+
+ if (ret.error) {
+ pr_err("%s: failed with error [%d]\n", __func__,
+ sbi_err_map_linux_errno(ret.error));
+ result = ret.error;
+ } else
+ result = ret.value;
+
+ return result;
+}
+
/**
* sbi_set_timer() - Program the timer for next timer event.
* @stime_value: The value after which next timer event should fire.
@@ -237,7 +332,7 @@ EXPORT_SYMBOL(sbi_send_ipi);
*/
void sbi_remote_fence_i(const unsigned long *hart_mask)
{
- __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, 0,
+ __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, SBI_EXT_RFENCE_REMOTE_FENCE_I,
hart_mask, 0, 0, 0, 0, 0);
}
EXPORT_SYMBOL(sbi_remote_fence_i);
@@ -255,7 +350,8 @@ void sbi_remote_sfence_vma(const unsigned long *hart_mask,
unsigned long start,
unsigned long size)
{
- __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA, 0,
+ __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA,
+ SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
hart_mask, 0, start, size, 0, 0);
}
EXPORT_SYMBOL(sbi_remote_sfence_vma);
@@ -276,11 +372,93 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
unsigned long size,
unsigned long asid)
{
- __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, 0,
+ __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID,
+ SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
hart_mask, 0, start, size, asid, 0);
}
EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
+/**
+ * sbi_remote_hfence_gvma() - Execute HFENCE.GVMA instructions on given remote
+ * harts for the specified guest physical address range.
+ * @hart_mask: A cpu mask containing all the target harts.
+ * @start: Start of the guest physical address
+ * @size: Total size of the guest physical address range.
+ *
+ * Return: None
+ */
+int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size)
+{
+ return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
+ hart_mask, 0, start, size, 0, 0);
+}
+EXPORT_SYMBOL_GPL(sbi_remote_hfence_gvma);
+
+/**
+ * sbi_remote_hfence_gvma_vmid() - Execute HFENCE.GVMA instructions on given
+ * remote harts for a guest physical address range belonging to a specific VMID.
+ *
+ * @hart_mask: A cpu mask containing all the target harts.
+ * @start: Start of the guest physical address
+ * @size: Total size of the guest physical address range.
+ * @vmid: The value of guest ID (VMID).
+ *
+ * Return: 0 if success, Error otherwise.
+ */
+int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size,
+ unsigned long vmid)
+{
+ return __sbi_rfence(SBI_EXT_RFENCE,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
+ hart_mask, 0, start, size, vmid, 0);
+}
+EXPORT_SYMBOL(sbi_remote_hfence_gvma_vmid);
+
+/**
+ * sbi_remote_hfence_vvma() - Execute HFENCE.VVMA instructions on given remote
+ * harts for the current guest virtual address range.
+ * @hart_mask: A cpu mask containing all the target harts.
+ * @start: Start of the current guest virtual address
+ * @size: Total size of the current guest virtual address range.
+ *
+ * Return: None
+ */
+int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size)
+{
+ return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
+ hart_mask, 0, start, size, 0, 0);
+}
+EXPORT_SYMBOL(sbi_remote_hfence_vvma);
+
+/**
+ * sbi_remote_hfence_vvma_asid() - Execute HFENCE.VVMA instructions on given
+ * remote harts for current guest virtual address range belonging to a specific
+ * ASID.
+ *
+ * @hart_mask: A cpu mask containing all the target harts.
+ * @start: Start of the current guest virtual address
+ * @size: Total size of the current guest virtual address range.
+ * @asid: The value of address space identifier (ASID).
+ *
+ * Return: None
+ */
+int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
+ unsigned long start,
+ unsigned long size,
+ unsigned long asid)
+{
+ return __sbi_rfence(SBI_EXT_RFENCE,
+ SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
+ hart_mask, 0, start, size, asid, 0);
+}
+EXPORT_SYMBOL(sbi_remote_hfence_vvma_asid);
+
/**
* sbi_probe_extension() - Check if an SBI extension ID is supported or not.
* @extid: The extension ID to be probed.
@@ -361,6 +539,19 @@ int __init sbi_init(void)
} else {
pr_info("SBI implementation ID=0x%lx Version=0x%lx\n",
sbi_get_firmware_id(), sbi_get_firmware_version());
+ if (sbi_probe_extension(SBI_EXT_TIME) > 0)
+ __sbi_set_timer = __sbi_set_timer_v02;
+ else
+ __sbi_set_timer = __sbi_set_timer_dummy_warn;
+ if (sbi_probe_extension(SBI_EXT_IPI) > 0)
+ __sbi_send_ipi = __sbi_send_ipi_v02;
+ else
+ __sbi_send_ipi = __sbi_send_ipi_dummy_warn;
+ if (sbi_probe_extension(SBI_EXT_RFENCE) > 0)
+ __sbi_rfence = __sbi_rfence_v02;
+ else
+ __sbi_rfence = __sbi_rfence_dummy_warn;
+
}
return 0;
--
2.23.0
On Tue, Nov 26, 2019 at 8:50 AM Atish Patra <[email protected]> wrote:
>
> Few v0.1 SBI calls are being replaced by new SBI calls that follows
> v0.2 calling convention. The specification changes can be found at
>
> riscv/riscv-sbi-doc#27
>
> Implement the replacement extensions and few additional new SBI
> function calls that makes way for a better SBI interface in future.
>
> Signed-off-by: Atish Patra <[email protected]>
> ---
> arch/riscv/include/asm/sbi.h | 35 +++++++
> arch/riscv/kernel/sbi.c | 197 ++++++++++++++++++++++++++++++++++-
> 2 files changed, 229 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index cc82ae63f8e0..54ba9eebec11 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -22,6 +22,9 @@ enum sbi_ext_id {
> SBI_EXT_0_1_SHUTDOWN = 0x8,
> #endif
> SBI_EXT_BASE = 0x10,
> + SBI_EXT_TIME = 0x54494D45,
> + SBI_EXT_IPI = 0x735049,
> + SBI_EXT_RFENCE = 0x52464E43,
> };
>
> enum sbi_ext_base_fid {
> @@ -34,6 +37,24 @@ enum sbi_ext_base_fid {
> SBI_BASE_GET_MIMPID,
> };
>
> +enum sbi_ext_time_fid {
> + SBI_EXT_TIME_SET_TIMER = 0,
> +};
> +
> +enum sbi_ext_ipi_fid {
> + SBI_EXT_IPI_SEND_IPI = 0,
> +};
> +
> +enum sbi_ext_rfence_fid {
> + SBI_EXT_RFENCE_REMOTE_FENCE_I = 0,
> + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
> +};
> +
> #define SBI_SPEC_VERSION_DEFAULT 0x1
> #define SBI_SPEC_VERSION_MAJOR_OFFSET 24
> #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
> @@ -74,6 +95,20 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> unsigned long start,
> unsigned long size,
> unsigned long asid);
> +int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size);
> +int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size,
> + unsigned long vmid);
> +int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size);
> +int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size,
> + unsigned long asid);
> int sbi_probe_extension(long ext);
>
> /* Check if current SBI specification version is 0.1 or not */
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 8574de1074c4..74b3155b570f 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -205,6 +205,101 @@ static int __sbi_rfence_v01(unsigned long ext, unsigned long fid,
> }
> #endif /* CONFIG_RISCV_SBI_V01 */
>
> +static void __sbi_set_timer_v02(uint64_t stime_value)
> +{
> +#if __riscv_xlen == 32
> + sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
> + stime_value >> 32, 0, 0, 0, 0);
> +#else
> + sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0,
> + 0, 0, 0, 0);
> +#endif
> +}
> +
> +static int __sbi_send_ipi_v02(const unsigned long *hart_mask)
> +{
> + unsigned long hmask_val;
> + struct sbiret ret = {0};
> + int result;
> +
> + if (!hart_mask)
> + hmask_val = *(cpumask_bits(cpu_online_mask));
> + else
> + hmask_val = *hart_mask;
> +
> + ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hmask_val,
> + 0, 0, 0, 0, 0);
> + if (ret.error) {
> + pr_err("%s: failed with error [%d]\n", __func__,
> + sbi_err_map_linux_errno(ret.error));
> + result = ret.error;
> + } else
> + result = ret.value;
> +
> + return result;
> +}
> +
> +static int __sbi_rfence_v02(unsigned long extid, unsigned long fid,
> + const unsigned long *hart_mask,
> + unsigned long hbase, unsigned long start,
> + unsigned long size, unsigned long arg4,
> + unsigned long arg5)
> +{
> + unsigned long hmask_val;
> + struct sbiret ret = {0};
> + int result;
> + unsigned long ext = SBI_EXT_RFENCE;
> +
> + if (!hart_mask)
> + hmask_val = *(cpumask_bits(cpu_online_mask));
> + else
> + hmask_val = *hart_mask;
> +
> + switch (fid) {
> + case SBI_EXT_RFENCE_REMOTE_FENCE_I:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, 0, 0, 0, 0);
> + break;
> + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, 0, 0);
> + break;
> + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, arg4, 0);
> + break;
> + /*TODO: Handle non zero hbase cases */
> + case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, 0, 0);
> + break;
> + case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, arg4, 0);
> + break;
> + case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, 0, 0);
> + break;
> + case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
> + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> + size, arg4, 0);
> + break;
> + default:
> + pr_err("unknown function ID [%lu] for SBI extension [%lu]\n",
> + fid, ext);
> + result = -EINVAL;
> + }
> +
> + if (ret.error) {
> + pr_err("%s: failed with error [%d]\n", __func__,
> + sbi_err_map_linux_errno(ret.error));
> + result = ret.error;
> + } else
> + result = ret.value;
> +
> + return result;
> +}
> +
> /**
> * sbi_set_timer() - Program the timer for next timer event.
> * @stime_value: The value after which next timer event should fire.
> @@ -237,7 +332,7 @@ EXPORT_SYMBOL(sbi_send_ipi);
> */
> void sbi_remote_fence_i(const unsigned long *hart_mask)
> {
> - __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, 0,
> + __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, SBI_EXT_RFENCE_REMOTE_FENCE_I,
> hart_mask, 0, 0, 0, 0, 0);
> }
> EXPORT_SYMBOL(sbi_remote_fence_i);
> @@ -255,7 +350,8 @@ void sbi_remote_sfence_vma(const unsigned long *hart_mask,
> unsigned long start,
> unsigned long size)
> {
> - __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA, 0,
> + __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA,
> + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> hart_mask, 0, start, size, 0, 0);
> }
> EXPORT_SYMBOL(sbi_remote_sfence_vma);
> @@ -276,11 +372,93 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
> unsigned long size,
> unsigned long asid)
> {
> - __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, 0,
> + __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID,
> + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> hart_mask, 0, start, size, asid, 0);
> }
> EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
>
> +/**
> + * sbi_remote_hfence_gvma() - Execute HFENCE.GVMA instructions on given remote
> + * harts for the specified guest physical address range.
> + * @hart_mask: A cpu mask containing all the target harts.
> + * @start: Start of the guest physical address
> + * @size: Total size of the guest physical address range.
> + *
> + * Return: None
> + */
> +int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size)
> +{
> + return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
> + hart_mask, 0, start, size, 0, 0);
> +}
> +EXPORT_SYMBOL_GPL(sbi_remote_hfence_gvma);
> +
> +/**
> + * sbi_remote_hfence_gvma_vmid() - Execute HFENCE.GVMA instructions on given
> + * remote harts for a guest physical address range belonging to a specific VMID.
> + *
> + * @hart_mask: A cpu mask containing all the target harts.
> + * @start: Start of the guest physical address
> + * @size: Total size of the guest physical address range.
> + * @vmid: The value of guest ID (VMID).
> + *
> + * Return: 0 if success, Error otherwise.
> + */
> +int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size,
> + unsigned long vmid)
> +{
> + return __sbi_rfence(SBI_EXT_RFENCE,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
> + hart_mask, 0, start, size, vmid, 0);
> +}
> +EXPORT_SYMBOL(sbi_remote_hfence_gvma_vmid);
> +
> +/**
> + * sbi_remote_hfence_vvma() - Execute HFENCE.VVMA instructions on given remote
> + * harts for the current guest virtual address range.
> + * @hart_mask: A cpu mask containing all the target harts.
> + * @start: Start of the current guest virtual address
> + * @size: Total size of the current guest virtual address range.
> + *
> + * Return: None
> + */
> +int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size)
> +{
> + return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
> + hart_mask, 0, start, size, 0, 0);
> +}
> +EXPORT_SYMBOL(sbi_remote_hfence_vvma);
> +
> +/**
> + * sbi_remote_hfence_vvma_asid() - Execute HFENCE.VVMA instructions on given
> + * remote harts for current guest virtual address range belonging to a specific
> + * ASID.
> + *
> + * @hart_mask: A cpu mask containing all the target harts.
> + * @start: Start of the current guest virtual address
> + * @size: Total size of the current guest virtual address range.
> + * @asid: The value of address space identifier (ASID).
> + *
> + * Return: None
> + */
> +int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
> + unsigned long start,
> + unsigned long size,
> + unsigned long asid)
> +{
> + return __sbi_rfence(SBI_EXT_RFENCE,
> + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
> + hart_mask, 0, start, size, asid, 0);
> +}
> +EXPORT_SYMBOL(sbi_remote_hfence_vvma_asid);
> +
> /**
> * sbi_probe_extension() - Check if an SBI extension ID is supported or not.
> * @extid: The extension ID to be probed.
> @@ -361,6 +539,19 @@ int __init sbi_init(void)
> } else {
> pr_info("SBI implementation ID=0x%lx Version=0x%lx\n",
> sbi_get_firmware_id(), sbi_get_firmware_version());
> + if (sbi_probe_extension(SBI_EXT_TIME) > 0)
> + __sbi_set_timer = __sbi_set_timer_v02;
> + else
> + __sbi_set_timer = __sbi_set_timer_dummy_warn;
> + if (sbi_probe_extension(SBI_EXT_IPI) > 0)
> + __sbi_send_ipi = __sbi_send_ipi_v02;
> + else
> + __sbi_send_ipi = __sbi_send_ipi_dummy_warn;
> + if (sbi_probe_extension(SBI_EXT_RFENCE) > 0)
> + __sbi_rfence = __sbi_rfence_v02;
> + else
> + __sbi_rfence = __sbi_rfence_dummy_warn;
> +
> }
>
> return 0;
> --
> 2.23.0
>
You might want to print whether TIMER, IPI and RFENCE extension
were detected at boot-time.
Otherwise, looks good.
Reviewed-by: Anup Patel <[email protected]>
Regards,
Anup
Hi Atish,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20191125]
[cannot apply to linus/master v5.4 v5.4-rc8 v5.4-rc7 v5.4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Atish-Patra/Add-support-for-SBI-v0-2/20191126-122142
base: c165016bac2719e05794c216f9b6da730d68d1e3
config: riscv-allnoconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
All errors (new ones prefixed by >>):
arch/riscv/kernel/sbi.c:71:52: note: format string is defined here
pr_warn("IPI extension is not available in SBI v%lu.%lu\n",
~~^
%u
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/pm.h:11,
from arch/riscv/kernel/sbi.c:4:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
^~~~~~~~
include/linux/printk.h:306:9: note: in expansion of macro 'KERN_WARNING'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~
include/linux/printk.h:307:17: note: in expansion of macro 'pr_warning'
#define pr_warn pr_warning
^~~~~~~~~~
arch/riscv/kernel/sbi.c:71:2: note: in expansion of macro 'pr_warn'
pr_warn("IPI extension is not available in SBI v%lu.%lu\n",
^~~~~~~
arch/riscv/kernel/sbi.c:71:56: note: format string is defined here
pr_warn("IPI extension is not available in SBI v%lu.%lu\n",
~~^
%u
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/pm.h:11,
from arch/riscv/kernel/sbi.c:4:
arch/riscv/kernel/sbi.c: In function '__sbi_rfence_dummy_warn':
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
^~~~~~~~
include/linux/printk.h:306:9: note: in expansion of macro 'KERN_WARNING'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~
include/linux/printk.h:307:17: note: in expansion of macro 'pr_warning'
#define pr_warn pr_warning
^~~~~~~~~~
arch/riscv/kernel/sbi.c:83:2: note: in expansion of macro 'pr_warn'
pr_warn("remote fence extension is not available in SBI v%lu.%lu\n",
^~~~~~~
arch/riscv/kernel/sbi.c:83:61: note: format string is defined here
pr_warn("remote fence extension is not available in SBI v%lu.%lu\n",
~~^
%u
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/pm.h:11,
from arch/riscv/kernel/sbi.c:4:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
^~~~~~~~
include/linux/printk.h:306:9: note: in expansion of macro 'KERN_WARNING'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~
include/linux/printk.h:307:17: note: in expansion of macro 'pr_warning'
#define pr_warn pr_warning
^~~~~~~~~~
arch/riscv/kernel/sbi.c:83:2: note: in expansion of macro 'pr_warn'
pr_warn("remote fence extension is not available in SBI v%lu.%lu\n",
^~~~~~~
arch/riscv/kernel/sbi.c:83:65: note: format string is defined here
pr_warn("remote fence extension is not available in SBI v%lu.%lu\n",
~~^
%u
arch/riscv/kernel/sbi.c: In function '__sbi_set_timer_v02':
arch/riscv/kernel/sbi.c:214:12: error: 'SBI_EXT_TIME' undeclared (first use in this function); did you mean 'STA_PPSTIME'?
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0,
^~~~~~~~~~~~
STA_PPSTIME
arch/riscv/kernel/sbi.c:214:26: error: 'SBI_EXT_TIME_SET_TIMER' undeclared (first use in this function); did you mean 'SBI_EXT_TIME'?
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0,
^~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_TIME
arch/riscv/kernel/sbi.c: In function '__sbi_send_ipi_v02':
arch/riscv/kernel/sbi.c:222:9: error: variable 'ret' has initializer but incomplete type
struct sbiret ret = {0};
^~~~~~
arch/riscv/kernel/sbi.c:222:23: warning: excess elements in struct initializer
struct sbiret ret = {0};
^
arch/riscv/kernel/sbi.c:222:23: note: (near initialization for 'ret')
arch/riscv/kernel/sbi.c:222:16: error: storage size of 'ret' isn't known
struct sbiret ret = {0};
^~~
arch/riscv/kernel/sbi.c:230:18: error: 'SBI_EXT_IPI' undeclared (first use in this function)
ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hmask_val,
^~~~~~~~~~~
>> arch/riscv/kernel/sbi.c:230:31: error: 'SBI_EXT_IPI_SEND_IPI' undeclared (first use in this function); did you mean 'SBI_EXT_IPI'?
ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hmask_val,
^~~~~~~~~~~~~~~~~~~~
SBI_EXT_IPI
arch/riscv/kernel/sbi.c:222:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret = {0};
^~~
arch/riscv/kernel/sbi.c: In function '__sbi_rfence_v02':
arch/riscv/kernel/sbi.c:249:9: error: variable 'ret' has initializer but incomplete type
struct sbiret ret = {0};
^~~~~~
arch/riscv/kernel/sbi.c:249:23: warning: excess elements in struct initializer
struct sbiret ret = {0};
^
arch/riscv/kernel/sbi.c:249:23: note: (near initialization for 'ret')
arch/riscv/kernel/sbi.c:249:16: error: storage size of 'ret' isn't known
struct sbiret ret = {0};
^~~
arch/riscv/kernel/sbi.c:251:22: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'RISCV_FENCE'?
unsigned long ext = SBI_EXT_RFENCE;
^~~~~~~~~~~~~~
RISCV_FENCE
arch/riscv/kernel/sbi.c:259:7: error: 'SBI_EXT_RFENCE_REMOTE_FENCE_I' undeclared (first use in this function)
case SBI_EXT_RFENCE_REMOTE_FENCE_I:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:262:7: error: 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_FENCE_I'?
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_FENCE_I
arch/riscv/kernel/sbi.c:266:7: error: 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA'?
case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA
>> arch/riscv/kernel/sbi.c:271:7: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA'?
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA
>> arch/riscv/kernel/sbi.c:275:7: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID'?
case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID
>> arch/riscv/kernel/sbi.c:279:7: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA'?
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA
>> arch/riscv/kernel/sbi.c:283:7: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID' undeclared (first use in this function); did you mean 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID'?
case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID
arch/riscv/kernel/sbi.c:249:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret = {0};
^~~
arch/riscv/kernel/sbi.c: In function 'sbi_remote_fence_i':
arch/riscv/kernel/sbi.c:335:15: error: 'SBI_EXT_0_1_REMOTE_FENCE_I' undeclared (first use in this function)
__sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, SBI_EXT_RFENCE_REMOTE_FENCE_I,
^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:335:43: error: 'SBI_EXT_RFENCE_REMOTE_FENCE_I' undeclared (first use in this function); did you mean 'SBI_EXT_0_1_REMOTE_FENCE_I'?
__sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, SBI_EXT_RFENCE_REMOTE_FENCE_I,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_0_1_REMOTE_FENCE_I
arch/riscv/kernel/sbi.c: In function 'sbi_remote_sfence_vma':
arch/riscv/kernel/sbi.c:353:15: error: 'SBI_EXT_0_1_REMOTE_SFENCE_VMA' undeclared (first use in this function)
__sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/sbi.c:354:8: error: 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA' undeclared (first use in this function); did you mean 'SBI_EXT_0_1_REMOTE_SFENCE_VMA'?
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_0_1_REMOTE_SFENCE_VMA
arch/riscv/kernel/sbi.c: In function 'sbi_remote_sfence_vma_asid':
arch/riscv/kernel/sbi.c:375:15: error: 'SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID' undeclared (first use in this function)
__sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/sbi.c:376:8: error: 'SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID' undeclared (first use in this function); did you mean 'SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID'?
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_gvma':
arch/riscv/kernel/sbi.c:394:22: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'RISCV_FENCE'?
return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
^~~~~~~~~~~~~~
RISCV_FENCE
arch/riscv/kernel/sbi.c:394:38: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA' undeclared (first use in this function)
return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_gvma_vmid':
arch/riscv/kernel/sbi.c:415:22: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'RISCV_FENCE'?
return __sbi_rfence(SBI_EXT_RFENCE,
^~~~~~~~~~~~~~
RISCV_FENCE
arch/riscv/kernel/sbi.c:416:8: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID' undeclared (first use in this function)
SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_vvma':
arch/riscv/kernel/sbi.c:434:22: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'RISCV_FENCE'?
return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
^~~~~~~~~~~~~~
RISCV_FENCE
arch/riscv/kernel/sbi.c:434:38: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA' undeclared (first use in this function)
return __sbi_rfence(SBI_EXT_RFENCE, SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_vvma_asid':
arch/riscv/kernel/sbi.c:456:22: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'RISCV_FENCE'?
return __sbi_rfence(SBI_EXT_RFENCE,
^~~~~~~~~~~~~~
RISCV_FENCE
arch/riscv/kernel/sbi.c:457:8: error: 'SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID' undeclared (first use in this function)
SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c: In function 'sbi_probe_extension':
arch/riscv/kernel/sbi.c:470:16: error: storage size of 'ret' isn't known
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c:472:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'?
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_PROBE_EXT, extid, 0, 0, 0, 0, 0);
^~~~~~~~~~~~
BIT_MASK
arch/riscv/kernel/sbi.c:472:32: error: 'SBI_BASE_PROBE_EXT' undeclared (first use in this function)
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_PROBE_EXT, extid, 0, 0, 0, 0, 0);
^~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:470:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c: In function 'sbi_get_spec_version':
arch/riscv/kernel/sbi.c:484:16: error: storage size of 'ret' isn't known
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c:486:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'?
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_SPEC_VERSION,
^~~~~~~~~~~~
BIT_MASK
arch/riscv/kernel/sbi.c:486:32: error: 'SBI_BASE_GET_SPEC_VERSION' undeclared (first use in this function)
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_SPEC_VERSION,
^~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:484:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_id':
arch/riscv/kernel/sbi.c:496:16: error: storage size of 'ret' isn't known
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c:498:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'?
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_ID,
^~~~~~~~~~~~
BIT_MASK
arch/riscv/kernel/sbi.c:498:32: error: 'SBI_BASE_GET_IMP_ID' undeclared (first use in this function)
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_ID,
^~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:496:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_version':
arch/riscv/kernel/sbi.c:508:16: error: storage size of 'ret' isn't known
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c:510:18: error: 'SBI_EXT_BASE' undeclared (first use in this function); did you mean 'BIT_MASK'?
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_VERSION,
^~~~~~~~~~~~
BIT_MASK
arch/riscv/kernel/sbi.c:510:32: error: 'SBI_BASE_GET_IMP_VERSION' undeclared (first use in this function); did you mean '__GXX_ABI_VERSION'?
ret = sbi_ecall(SBI_EXT_BASE, SBI_BASE_GET_IMP_VERSION,
^~~~~~~~~~~~~~~~~~~~~~~~
__GXX_ABI_VERSION
arch/riscv/kernel/sbi.c:508:16: warning: unused variable 'ret' [-Wunused-variable]
struct sbiret ret;
^~~
arch/riscv/kernel/sbi.c: In function 'sbi_power_off':
arch/riscv/kernel/sbi.c:520:2: error: implicit declaration of function 'sbi_shutdown' [-Werror=implicit-function-declaration]
sbi_shutdown();
^~~~~~~~~~~~
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/pm.h:11,
from arch/riscv/kernel/sbi.c:4:
arch/riscv/kernel/sbi.c: In function 'sbi_init':
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
#define KERN_INFO KERN_SOH "6" /* informational */
^~~~~~~~
include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO'
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~
arch/riscv/kernel/sbi.c:532:2: note: in expansion of macro 'pr_info'
pr_info("SBI specification v%lu.%lu detected\n",
^~~~~~~
arch/riscv/kernel/sbi.c:532:32: note: format string is defined here
pr_info("SBI specification v%lu.%lu detected\n",
~~^
%u
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/pm.h:11,
from arch/riscv/kernel/sbi.c:4:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
#define KERN_INFO KERN_SOH "6" /* informational */
^~~~~~~~
include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO'
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~
arch/riscv/kernel/sbi.c:532:2: note: in expansion of macro 'pr_info'
pr_info("SBI specification v%lu.%lu detected\n",
^~~~~~~
arch/riscv/kernel/sbi.c:532:36: note: format string is defined here
pr_info("SBI specification v%lu.%lu detected\n",
~~^
%u
arch/riscv/kernel/sbi.c:535:6: error: implicit declaration of function 'sbi_spec_is_0_1' [-Werror=implicit-function-declaration]
if (sbi_spec_is_0_1()) {
^~~~~~~~~~~~~~~
arch/riscv/kernel/sbi.c:542:27: error: 'SBI_EXT_TIME' undeclared (first use in this function); did you mean 'STA_PPSTIME'?
if (sbi_probe_extension(SBI_EXT_TIME) > 0)
^~~~~~~~~~~~
STA_PPSTIME
>> arch/riscv/kernel/sbi.c:546:27: error: 'SBI_EXT_IPI' undeclared (first use in this function); did you mean 'SBI_EXT_TIME'?
if (sbi_probe_extension(SBI_EXT_IPI) > 0)
^~~~~~~~~~~
SBI_EXT_TIME
>> arch/riscv/kernel/sbi.c:550:27: error: 'SBI_EXT_RFENCE' undeclared (first use in this function); did you mean 'SBI_EXT_TIME'?
if (sbi_probe_extension(SBI_EXT_RFENCE) > 0)
^~~~~~~~~~~~~~
SBI_EXT_TIME
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_gvma':
arch/riscv/kernel/sbi.c:396:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_gvma_vmid':
arch/riscv/kernel/sbi.c:418:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_vvma':
arch/riscv/kernel/sbi.c:436:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_remote_hfence_vvma_asid':
arch/riscv/kernel/sbi.c:459:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_get_spec_version':
arch/riscv/kernel/sbi.c:492:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_id':
arch/riscv/kernel/sbi.c:504:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arch/riscv/kernel/sbi.c: In function 'sbi_get_firmware_version':
arch/riscv/kernel/sbi.c:516:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
cc1: some warnings being treated as errors
vim +230 arch/riscv/kernel/sbi.c
218
219 static int __sbi_send_ipi_v02(const unsigned long *hart_mask)
220 {
221 unsigned long hmask_val;
> 222 struct sbiret ret = {0};
223 int result;
224
225 if (!hart_mask)
226 hmask_val = *(cpumask_bits(cpu_online_mask));
227 else
228 hmask_val = *hart_mask;
229
> 230 ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI, hmask_val,
231 0, 0, 0, 0, 0);
232 if (ret.error) {
233 pr_err("%s: failed with error [%d]\n", __func__,
234 sbi_err_map_linux_errno(ret.error));
235 result = ret.error;
236 } else
237 result = ret.value;
238
239 return result;
240 }
241
242 static int __sbi_rfence_v02(unsigned long extid, unsigned long fid,
243 const unsigned long *hart_mask,
244 unsigned long hbase, unsigned long start,
245 unsigned long size, unsigned long arg4,
246 unsigned long arg5)
247 {
248 unsigned long hmask_val;
249 struct sbiret ret = {0};
250 int result;
251 unsigned long ext = SBI_EXT_RFENCE;
252
253 if (!hart_mask)
254 hmask_val = *(cpumask_bits(cpu_online_mask));
255 else
256 hmask_val = *hart_mask;
257
258 switch (fid) {
259 case SBI_EXT_RFENCE_REMOTE_FENCE_I:
260 ret = sbi_ecall(ext, fid, hmask_val, 0, 0, 0, 0, 0);
261 break;
> 262 case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
263 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
264 size, 0, 0);
265 break;
> 266 case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
267 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
268 size, arg4, 0);
269 break;
270 /*TODO: Handle non zero hbase cases */
> 271 case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
272 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
273 size, 0, 0);
274 break;
> 275 case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
276 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
277 size, arg4, 0);
278 break;
> 279 case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
280 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
281 size, 0, 0);
282 break;
> 283 case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
284 ret = sbi_ecall(ext, fid, hmask_val, 0, start,
285 size, arg4, 0);
286 break;
287 default:
288 pr_err("unknown function ID [%lu] for SBI extension [%lu]\n",
289 fid, ext);
290 result = -EINVAL;
291 }
292
293 if (ret.error) {
294 pr_err("%s: failed with error [%d]\n", __func__,
295 sbi_err_map_linux_errno(ret.error));
296 result = ret.error;
297 } else
298 result = ret.value;
299
300 return result;
301 }
302
303 /**
304 * sbi_set_timer() - Program the timer for next timer event.
305 * @stime_value: The value after which next timer event should fire.
306 *
307 * Return: None
308 */
309 void sbi_set_timer(uint64_t stime_value)
310 {
311 __sbi_set_timer(stime_value);
312 }
313
314 /**
315 * sbi_send_ipi() - Send an IPI to any hart.
316 * @hart_mask: A cpu mask containing all the target harts.
317 *
318 * Return: None
319 */
320 void sbi_send_ipi(const unsigned long *hart_mask)
321 {
322 __sbi_send_ipi(hart_mask);
323 }
324 EXPORT_SYMBOL(sbi_send_ipi);
325
326
327 /**
328 * sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
329 * @hart_mask: A cpu mask containing all the target harts.
330 *
331 * Return: None
332 */
333 void sbi_remote_fence_i(const unsigned long *hart_mask)
334 {
> 335 __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, SBI_EXT_RFENCE_REMOTE_FENCE_I,
336 hart_mask, 0, 0, 0, 0, 0);
337 }
338 EXPORT_SYMBOL(sbi_remote_fence_i);
339
340 /**
341 * sbi_remote_sfence_vma() - Execute SFENCE.VMA instructions on given remote
342 * harts for the specified virtual address range.
343 * @hart_mask: A cpu mask containing all the target harts.
344 * @start: Start of the virtual address
345 * @size: Total size of the virtual address range.
346 *
347 * Return: None
348 */
349 void sbi_remote_sfence_vma(const unsigned long *hart_mask,
350 unsigned long start,
351 unsigned long size)
352 {
353 __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA,
> 354 SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
355 hart_mask, 0, start, size, 0, 0);
356 }
357 EXPORT_SYMBOL(sbi_remote_sfence_vma);
358
359 /**
360 * sbi_remote_sfence_vma_asid() - Execute SFENCE.VMA instructions on given
361 * remote harts for a virtual address range belonging to a specific ASID.
362 *
363 * @hart_mask: A cpu mask containing all the target harts.
364 * @start: Start of the virtual address
365 * @size: Total size of the virtual address range.
366 * @asid: The value of address space identifier (ASID).
367 *
368 * Return: None
369 */
370 void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
371 unsigned long start,
372 unsigned long size,
373 unsigned long asid)
374 {
375 __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID,
> 376 SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
377 hart_mask, 0, start, size, asid, 0);
378 }
379 EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
380
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
On Tue, 2019-11-26 at 09:46 +0530, Anup Patel wrote:
> On Tue, Nov 26, 2019 at 8:50 AM Atish Patra <[email protected]>
> wrote:
> > Few v0.1 SBI calls are being replaced by new SBI calls that follows
> > v0.2 calling convention. The specification changes can be found at
> >
> > riscv/riscv-sbi-doc#27
> >
> > Implement the replacement extensions and few additional new SBI
> > function calls that makes way for a better SBI interface in future.
> >
> > Signed-off-by: Atish Patra <[email protected]>
> > ---
> > arch/riscv/include/asm/sbi.h | 35 +++++++
> > arch/riscv/kernel/sbi.c | 197
> > ++++++++++++++++++++++++++++++++++-
> > 2 files changed, 229 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/riscv/include/asm/sbi.h
> > b/arch/riscv/include/asm/sbi.h
> > index cc82ae63f8e0..54ba9eebec11 100644
> > --- a/arch/riscv/include/asm/sbi.h
> > +++ b/arch/riscv/include/asm/sbi.h
> > @@ -22,6 +22,9 @@ enum sbi_ext_id {
> > SBI_EXT_0_1_SHUTDOWN = 0x8,
> > #endif
> > SBI_EXT_BASE = 0x10,
> > + SBI_EXT_TIME = 0x54494D45,
> > + SBI_EXT_IPI = 0x735049,
> > + SBI_EXT_RFENCE = 0x52464E43,
> > };
> >
> > enum sbi_ext_base_fid {
> > @@ -34,6 +37,24 @@ enum sbi_ext_base_fid {
> > SBI_BASE_GET_MIMPID,
> > };
> >
> > +enum sbi_ext_time_fid {
> > + SBI_EXT_TIME_SET_TIMER = 0,
> > +};
> > +
> > +enum sbi_ext_ipi_fid {
> > + SBI_EXT_IPI_SEND_IPI = 0,
> > +};
> > +
> > +enum sbi_ext_rfence_fid {
> > + SBI_EXT_RFENCE_REMOTE_FENCE_I = 0,
> > + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> > + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
> > +};
> > +
> > #define SBI_SPEC_VERSION_DEFAULT 0x1
> > #define SBI_SPEC_VERSION_MAJOR_OFFSET 24
> > #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
> > @@ -74,6 +95,20 @@ void sbi_remote_sfence_vma_asid(const unsigned
> > long *hart_mask,
> > unsigned long start,
> > unsigned long size,
> > unsigned long asid);
> > +int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size);
> > +int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size,
> > + unsigned long vmid);
> > +int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size);
> > +int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size,
> > + unsigned long asid);
> > int sbi_probe_extension(long ext);
> >
> > /* Check if current SBI specification version is 0.1 or not */
> > diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> > index 8574de1074c4..74b3155b570f 100644
> > --- a/arch/riscv/kernel/sbi.c
> > +++ b/arch/riscv/kernel/sbi.c
> > @@ -205,6 +205,101 @@ static int __sbi_rfence_v01(unsigned long
> > ext, unsigned long fid,
> > }
> > #endif /* CONFIG_RISCV_SBI_V01 */
> >
> > +static void __sbi_set_timer_v02(uint64_t stime_value)
> > +{
> > +#if __riscv_xlen == 32
> > + sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER,
> > stime_value,
> > + stime_value >> 32, 0, 0, 0, 0);
> > +#else
> > + sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER,
> > stime_value, 0,
> > + 0, 0, 0, 0);
> > +#endif
> > +}
> > +
> > +static int __sbi_send_ipi_v02(const unsigned long *hart_mask)
> > +{
> > + unsigned long hmask_val;
> > + struct sbiret ret = {0};
> > + int result;
> > +
> > + if (!hart_mask)
> > + hmask_val = *(cpumask_bits(cpu_online_mask));
> > + else
> > + hmask_val = *hart_mask;
> > +
> > + ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI,
> > hmask_val,
> > + 0, 0, 0, 0, 0);
> > + if (ret.error) {
> > + pr_err("%s: failed with error [%d]\n", __func__,
> > + sbi_err_map_linux_errno(ret.error));
> > + result = ret.error;
> > + } else
> > + result = ret.value;
> > +
> > + return result;
> > +}
> > +
> > +static int __sbi_rfence_v02(unsigned long extid, unsigned long
> > fid,
> > + const unsigned long *hart_mask,
> > + unsigned long hbase, unsigned long
> > start,
> > + unsigned long size, unsigned long
> > arg4,
> > + unsigned long arg5)
> > +{
> > + unsigned long hmask_val;
> > + struct sbiret ret = {0};
> > + int result;
> > + unsigned long ext = SBI_EXT_RFENCE;
> > +
> > + if (!hart_mask)
> > + hmask_val = *(cpumask_bits(cpu_online_mask));
> > + else
> > + hmask_val = *hart_mask;
> > +
> > + switch (fid) {
> > + case SBI_EXT_RFENCE_REMOTE_FENCE_I:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, 0, 0, 0,
> > 0);
> > + break;
> > + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, 0, 0);
> > + break;
> > + case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, arg4, 0);
> > + break;
> > + /*TODO: Handle non zero hbase cases */
> > + case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, 0, 0);
> > + break;
> > + case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, arg4, 0);
> > + break;
> > + case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, 0, 0);
> > + break;
> > + case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
> > + ret = sbi_ecall(ext, fid, hmask_val, 0, start,
> > + size, arg4, 0);
> > + break;
> > + default:
> > + pr_err("unknown function ID [%lu] for SBI extension
> > [%lu]\n",
> > + fid, ext);
> > + result = -EINVAL;
> > + }
> > +
> > + if (ret.error) {
> > + pr_err("%s: failed with error [%d]\n", __func__,
> > + sbi_err_map_linux_errno(ret.error));
> > + result = ret.error;
> > + } else
> > + result = ret.value;
> > +
> > + return result;
> > +}
> > +
> > /**
> > * sbi_set_timer() - Program the timer for next timer event.
> > * @stime_value: The value after which next timer event should
> > fire.
> > @@ -237,7 +332,7 @@ EXPORT_SYMBOL(sbi_send_ipi);
> > */
> > void sbi_remote_fence_i(const unsigned long *hart_mask)
> > {
> > - __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I, 0,
> > + __sbi_rfence(SBI_EXT_0_1_REMOTE_FENCE_I,
> > SBI_EXT_RFENCE_REMOTE_FENCE_I,
> > hart_mask, 0, 0, 0, 0, 0);
> > }
> > EXPORT_SYMBOL(sbi_remote_fence_i);
> > @@ -255,7 +350,8 @@ void sbi_remote_sfence_vma(const unsigned long
> > *hart_mask,
> > unsigned long start,
> > unsigned long size)
> > {
> > - __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA, 0,
> > + __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA,
> > + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
> > hart_mask, 0, start, size, 0, 0);
> > }
> > EXPORT_SYMBOL(sbi_remote_sfence_vma);
> > @@ -276,11 +372,93 @@ void sbi_remote_sfence_vma_asid(const
> > unsigned long *hart_mask,
> > unsigned long size,
> > unsigned long asid)
> > {
> > - __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, 0,
> > + __sbi_rfence(SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID,
> > + SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
> > hart_mask, 0, start, size, asid, 0);
> > }
> > EXPORT_SYMBOL(sbi_remote_sfence_vma_asid);
> >
> > +/**
> > + * sbi_remote_hfence_gvma() - Execute HFENCE.GVMA instructions on
> > given remote
> > + * harts for the specified guest physical
> > address range.
> > + * @hart_mask: A cpu mask containing all the target harts.
> > + * @start: Start of the guest physical address
> > + * @size: Total size of the guest physical address range.
> > + *
> > + * Return: None
> > + */
> > +int sbi_remote_hfence_gvma(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size)
> > +{
> > + return __sbi_rfence(SBI_EXT_RFENCE,
> > SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
> > + hart_mask, 0, start, size, 0, 0);
> > +}
> > +EXPORT_SYMBOL_GPL(sbi_remote_hfence_gvma);
> > +
> > +/**
> > + * sbi_remote_hfence_gvma_vmid() - Execute HFENCE.GVMA
> > instructions on given
> > + * remote harts for a guest physical address range belonging to a
> > specific VMID.
> > + *
> > + * @hart_mask: A cpu mask containing all the target harts.
> > + * @start: Start of the guest physical address
> > + * @size: Total size of the guest physical address range.
> > + * @vmid: The value of guest ID (VMID).
> > + *
> > + * Return: 0 if success, Error otherwise.
> > + */
> > +int sbi_remote_hfence_gvma_vmid(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size,
> > + unsigned long vmid)
> > +{
> > + return __sbi_rfence(SBI_EXT_RFENCE,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
> > + hart_mask, 0, start, size, vmid, 0);
> > +}
> > +EXPORT_SYMBOL(sbi_remote_hfence_gvma_vmid);
> > +
> > +/**
> > + * sbi_remote_hfence_vvma() - Execute HFENCE.VVMA instructions on
> > given remote
> > + * harts for the current guest virtual
> > address range.
> > + * @hart_mask: A cpu mask containing all the target harts.
> > + * @start: Start of the current guest virtual address
> > + * @size: Total size of the current guest virtual address range.
> > + *
> > + * Return: None
> > + */
> > +int sbi_remote_hfence_vvma(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size)
> > +{
> > + return __sbi_rfence(SBI_EXT_RFENCE,
> > SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
> > + hart_mask, 0, start, size, 0, 0);
> > +}
> > +EXPORT_SYMBOL(sbi_remote_hfence_vvma);
> > +
> > +/**
> > + * sbi_remote_hfence_vvma_asid() - Execute HFENCE.VVMA
> > instructions on given
> > + * remote harts for current guest virtual address range belonging
> > to a specific
> > + * ASID.
> > + *
> > + * @hart_mask: A cpu mask containing all the target harts.
> > + * @start: Start of the current guest virtual address
> > + * @size: Total size of the current guest virtual address range.
> > + * @asid: The value of address space identifier (ASID).
> > + *
> > + * Return: None
> > + */
> > +int sbi_remote_hfence_vvma_asid(const unsigned long *hart_mask,
> > + unsigned long start,
> > + unsigned long size,
> > + unsigned long asid)
> > +{
> > + return __sbi_rfence(SBI_EXT_RFENCE,
> > + SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
> > + hart_mask, 0, start, size, asid, 0);
> > +}
> > +EXPORT_SYMBOL(sbi_remote_hfence_vvma_asid);
> > +
> > /**
> > * sbi_probe_extension() - Check if an SBI extension ID is
> > supported or not.
> > * @extid: The extension ID to be probed.
> > @@ -361,6 +539,19 @@ int __init sbi_init(void)
> > } else {
> > pr_info("SBI implementation ID=0x%lx
> > Version=0x%lx\n",
> > sbi_get_firmware_id(),
> > sbi_get_firmware_version());
> > + if (sbi_probe_extension(SBI_EXT_TIME) > 0)
> > + __sbi_set_timer = __sbi_set_timer_v02;
> > + else
> > + __sbi_set_timer =
> > __sbi_set_timer_dummy_warn;
> > + if (sbi_probe_extension(SBI_EXT_IPI) > 0)
> > + __sbi_send_ipi = __sbi_send_ipi_v02;
> > + else
> > + __sbi_send_ipi = __sbi_send_ipi_dummy_warn;
> > + if (sbi_probe_extension(SBI_EXT_RFENCE) > 0)
> > + __sbi_rfence = __sbi_rfence_v02;
> > + else
> > + __sbi_rfence = __sbi_rfence_dummy_warn;
> > +
> > }
> >
> > return 0;
> > --
> > 2.23.0
> >
>
> You might want to print whether TIMER, IPI and RFENCE extension
> were detected at boot-time.
>
Sure. Will do.
> Otherwise, looks good.
>
> Reviewed-by: Anup Patel <[email protected]>
>
Thanks for the review.
> Regards,
> Anup
--
Regards,
Atish