[PATCH v2 1/5] riscv: Add 3 SBI wrapper functions to get cpu manufacturer information

Anup Patel anup at brainfault.org
Wed Mar 17 11:32:58 GMT 2021


On Wed, Mar 17, 2021 at 3:04 PM Vincent Chen <vincent.chen at sifive.com> wrote:
>
> Add 3 wrapper functions to get vendor id, architecture id and implement id
> from M-mode
>
> Signed-off-by: Vincent Chen <vincent.chen at sifive.com>

Looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Regards,
Anup

> ---
>  arch/riscv/include/asm/sbi.h |  3 +++
>  arch/riscv/kernel/sbi.c      | 15 +++++++++++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 99895d9c3bdd..dd2329962ceb 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -97,6 +97,9 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
>
>  void sbi_console_putchar(int ch);
>  int sbi_console_getchar(void);
> +long sbi_get_mvendorid(void);
> +long sbi_get_marchid(void);
> +long sbi_get_mimpid(void);
>  void sbi_set_timer(uint64_t stime_value);
>  void sbi_shutdown(void);
>  void sbi_clear_ipi(void);
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index f4a7db3d309e..ead7e3fec104 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -547,6 +547,21 @@ static inline long sbi_get_firmware_version(void)
>         return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
>  }
>
> +long sbi_get_mvendorid(void)
> +{
> +       return __sbi_base_ecall(SBI_EXT_BASE_GET_MVENDORID);
> +}
> +
> +long sbi_get_marchid(void)
> +{
> +       return __sbi_base_ecall(SBI_EXT_BASE_GET_MARCHID);
> +}
> +
> +long sbi_get_mimpid(void)
> +{
> +       return __sbi_base_ecall(SBI_EXT_BASE_GET_MIMPID);
> +}
> +
>  static void sbi_send_cpumask_ipi(const struct cpumask *target)
>  {
>         struct cpumask hartid_mask;
> --
> 2.7.4
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



More information about the linux-riscv mailing list