From patchwork Wed May 27 09:04:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 246662 List-Id: U-Boot discussion From: bmeng.cn at gmail.com (Bin Meng) Date: Wed, 27 May 2020 02:04:52 -0700 Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version Message-ID: <1590570293-14225-1-git-send-email-bmeng.cn@gmail.com> From: Bin Meng U-Boot defaults to use SBI v0.2. Howerver there is a global variable sbi_spec_version that stills refers to v0.1. Since it is not used anywhere, let's remove it. Signed-off-by: Bin Meng --- arch/riscv/include/asm/sbi.h | 2 -- arch/riscv/lib/sbi.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 453cb5c..08e1ac0 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -77,7 +77,6 @@ enum sbi_ext_rfence_fid { #define SBI_FID_REMOTE_SFENCE_VMA_ASID SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID #endif -#define SBI_SPEC_VERSION_DEFAULT 0x1 #define SBI_SPEC_VERSION_MAJOR_SHIFT 24 #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f #define SBI_SPEC_VERSION_MINOR_MASK 0xffffff @@ -90,7 +89,6 @@ enum sbi_ext_rfence_fid { #define SBI_ERR_DENIED -4 #define SBI_ERR_INVALID_ADDRESS -5 -extern unsigned long sbi_spec_version; struct sbiret { long error; long value; diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c index 993597e..f298846 100644 --- a/arch/riscv/lib/sbi.c +++ b/arch/riscv/lib/sbi.c @@ -11,9 +11,6 @@ #include #include -/* default SBI version is 0.1 */ -unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT; - struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, From patchwork Wed May 27 09:04:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 246663 List-Id: U-Boot discussion From: bmeng.cn at gmail.com (Bin Meng) Date: Wed, 27 May 2020 02:04:53 -0700 Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01 In-Reply-To: <1590570293-14225-1-git-send-email-bmeng.cn@gmail.com> References: <1590570293-14225-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1590570293-14225-2-git-send-email-bmeng.cn@gmail.com> From: Bin Meng sbi_probe_extension() is an API defined in SBI v0.2, not v0.1. Fixes 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01") Signed-off-by: Bin Meng --- arch/riscv/lib/sbi.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c index f298846..8fbc238 100644 --- a/arch/riscv/lib/sbi.c +++ b/arch/riscv/lib/sbi.c @@ -53,6 +53,25 @@ void sbi_set_timer(uint64_t stime_value) #endif } +/** + * sbi_probe_extension() - Check if an SBI extension ID is supported or not. + * @extid: The extension ID to be probed. + * + * Return: Extension specific nonzero value f yes, -ENOTSUPP otherwise. + */ +int sbi_probe_extension(int extid) +{ + struct sbiret ret; + + ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, extid, + 0, 0, 0, 0, 0); + if (!ret.error) + if (ret.value) + return ret.value; + + return -ENOTSUPP; +} + #ifdef CONFIG_SBI_V01 /** @@ -162,22 +181,4 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, (unsigned long)hart_mask, start, size, asid, 0, 0); } -/** - * sbi_probe_extension() - Check if an SBI extension ID is supported or not. - * @extid: The extension ID to be probed. - * - * Return: Extension specific nonzero value f yes, -ENOTSUPP otherwise. - */ -int sbi_probe_extension(int extid) -{ - struct sbiret ret; - - ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, extid, - 0, 0, 0, 0, 0); - if (!ret.error) - if (ret.value) - return ret.value; - - return -ENOTSUPP; -} #endif /* CONFIG_SBI_V01 */