Skip to contentSkip to conversation

riscv: sbi: Remove sbi_spec_version

PATCH New Bin Meng 3 participants 12 messages May 27, 2020 – Jun 3, 2020 2 messages not in the archive RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
index 453cb5c..08e1ac0 100644
@@ -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;
arch/riscv/lib/sbi.c +0 -3
index 993597e..f298846 100644
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
-/* 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,
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

From: Bin Meng <[email protected]>

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")

---

 arch/riscv/lib/sbi.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)
arch/riscv/lib/sbi.c +19 -18
index f298846..8fbc238 100644
@@ -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 */
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Quoted 6 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Quoted 7 lines

From: Bin Meng <[email protected]>

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")

---

Quoted 56 lines
 arch/riscv/lib/sbi.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)
arch/riscv/lib/sbi.c +19 -19
@@ -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 */
--

2.7.4

#4 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Hi Bin

Quoted 8 lines
Quoted 8 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

From: Bin Meng <[email protected]>

Quoted 8 lines
Quoted 5 lines

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")

---

BTW, it seem look like sbi_remote_fence_i, sbi_remote_sfence_vma and sbi_remote_sfence_vma_asid
are all can be used no mater in SBI_V01 or SBI_V02. Because you have distinguished them in sbi.h

Thanks,
Rick

Quoted 56 lines
Quoted 56 lines
 arch/riscv/lib/sbi.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)
arch/riscv/lib/sbi.c +19 -19
@@ -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 */
--

2.7.4

author
#5 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Hi Rick,

Quoted 17 lines · Rick Chen

Hi Bin

Quoted 14 lines
Quoted 13 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

From: Bin Meng <[email protected]>

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")

---

Quoted 7 lines
Quoted 2 lines

BTW, it seem look like sbi_remote_fence_i, sbi_remote_sfence_vma and sbi_remote_sfence_vma_asid
are all can be used no mater in SBI_V01 or SBI_V02. Because you have distinguished them in sbi.h

No these calls are different and not compatible between SBI_V01 and SBI_V02.

See commit 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01")

Regards,
Bin

#6 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Quoted 24 lines · Bin Meng

Hi Rick,

Quoted 20 lines · Rick Chen

Hi Bin

Quoted 16 lines
Quoted 6 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Quoted 7 lines

From: Bin Meng <[email protected]>

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")

---

Quoted 7 lines
Quoted 4 lines

BTW, it seem look like sbi_remote_fence_i, sbi_remote_sfence_vma and sbi_remote_sfence_vma_asid
are all can be used no mater in SBI_V01 or SBI_V02. Because you have distinguished them in sbi.h

No these calls are different and not compatible between SBI_V01 and SBI_V02.

In addition to that, U-Boot proper enables SMP only for SBI_V01 because U-Boot doesn't need
boot all the cores if the supervisor OS & SBI provider supports SBI v0.2 with HSM.

Starting with OpenSBI v0.7 & Linux kernel 5.7 supports both. Thus, there is no advantage in adding
redundant code in a generic path that is never going to be used.

Any SBI provider that only supports SBI v0.1, the user can fall back to SBI_V01 config.

Quoted 4 lines

See commit 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01")

Regards,
Bin

Signature · 2 lines
Regards,
Atish
#7 lore raw

PATCH 2/2 riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Hi Atish

Atish Patra <[email protected]> ? 2020?6?3? ?? ??2:32???

Quoted 39 lines · Bin Meng
Quoted 24 lines

Hi Rick,

Quoted 20 lines · Rick Chen

Hi Bin

Quoted 16 lines
Quoted 6 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01

Quoted 7 lines

From: Bin Meng <[email protected]>

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")

---

Quoted 7 lines
Quoted 4 lines

BTW, it seem look like sbi_remote_fence_i, sbi_remote_sfence_vma and sbi_remote_sfence_vma_asid
are all can be used no mater in SBI_V01 or SBI_V02. Because you have distinguished them in sbi.h

No these calls are different and not compatible between SBI_V01 and SBI_V02.

In addition to that, U-Boot proper enables SMP only for SBI_V01 because U-Boot doesn't need
boot all the cores if the supervisor OS & SBI provider supports SBI v0.2 with HSM.

Quoted 6 lines

Starting with OpenSBI v0.7 & Linux kernel 5.7 supports both. Thus, there is no advantage in adding
redundant code in a generic path that is never going to be used.

Any SBI provider that only supports SBI v0.1, the user can fall back to SBI_V01 config.

Thanks for your explanation.

Regards,
Rick

Quoted 10 lines
Quoted 4 lines

See commit 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01")

Regards,
Bin

--
Regards,
Atish

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

Hi Bin

Quoted 40 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
@@ -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;

arch/riscv/lib/sbi.c line 15

Quoted 5 lines
arch/riscv/lib/sbi.c +0 -2
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
-/* default SBI version is 0.1 */
-unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;

Why not keep this variable and get version of openSbi automatically, then register v01 or v02 callback function just like sbi_init() of Atish' patch.

Thanks,
Rick

Quoted 7 lines
arch/riscv/lib/sbi.c +0 -2
-
 struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
                        unsigned long arg1, unsigned long arg2,
                        unsigned long arg3, unsigned long arg4,
--

2.7.4

author
#10 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

Hi Rick,

Quoted 46 lines · Rick Chen

Hi Bin

Quoted 43 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
@@ -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;
arch/riscv/lib/sbi.c +0 -0
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
Quoted 6 lines

arch/riscv/lib/sbi.c line 15

Quoted 2 lines
arch/riscv/lib/sbi.c +0 -2
-/* default SBI version is 0.1 */
-unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;

Why not keep this variable and get version of openSbi automatically, then register v01 or v02 callback function just like sbi_init() of Atish' patch.

I feel this is not needed anyway, because we are using Kconfig option to pass the same information.

Regards,
Bin

#11 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

Hi Bin

Bin Meng <[email protected]> ? 2020?6?1? ?? ??5:06???

Quoted 57 lines

Hi Rick,

Quoted 46 lines · Rick Chen

Hi Bin

Quoted 43 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
@@ -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;
arch/riscv/lib/sbi.c +0 -0
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
Quoted 6 lines

arch/riscv/lib/sbi.c line 15

Quoted 2 lines
arch/riscv/lib/sbi.c +0 -2
-/* default SBI version is 0.1 */
-unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;

Why not keep this variable and get version of openSbi automatically, then register v01 or v02 callback function just like sbi_init() of Atish' patch.

Quoted 2 lines

I feel this is not needed anyway, because we are using Kconfig option to pass the same information.

U-Boot proper has been configured as SBI_V02 by default currently. About backward compatible issue, it is not so friendly for users. They shall select SBI_VERSION configurations correctly in U-Boot proper and re-compile between different versions of openSbi. If U-Boot proper can probe openSbi and switch V01 or V02 mode automatically, users can run smoothly without awareness of SBI versions.

Thanks,
Rick

Quoted 3 lines

Regards,
Bin

author
#12 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

Hi Rick,

Quoted 64 lines · Rick Chen

Hi Bin

Bin Meng <[email protected]> ? 2020?6?1? ?? ??5:06???

Quoted 57 lines

Hi Rick,

Quoted 46 lines · Rick Chen

Hi Bin

Quoted 43 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
@@ -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;
arch/riscv/lib/sbi.c +0 -0
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
Quoted 6 lines

arch/riscv/lib/sbi.c line 15

Quoted 2 lines
arch/riscv/lib/sbi.c +0 -2
-/* default SBI version is 0.1 */
-unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;

Why not keep this variable and get version of openSbi automatically, then register v01 or v02 callback function just like sbi_init() of Atish' patch.

Quoted 2 lines

I feel this is not needed anyway, because we are using Kconfig option to pass the same information.

Quoted 8 lines

U-Boot proper has been configured as SBI_V02 by default currently. About backward compatible issue, it is not so friendly for users. They shall select SBI_VERSION configurations correctly in U-Boot proper and re-compile between different versions of openSbi. If U-Boot proper can probe openSbi and switch V01 or V02 mode automatically, users can run smoothly without awareness of SBI versions.

OpenSBI v0.7 is not backward compatible with previous version regarding the multicore boot. Dynamically detecting SBI and the SBI implementation version will make U-Boot codes very complicated. In addition to SBI v0.1 vs. v0.2, we need detect whether SBI HSM extension is available and if that's not available, U-Boot has to do the lottery multi-core boot in every stage (SPL and proper). RISC-V is a new architecture and without a lot of legacy burden to carry on, I hope we can do the clean room implementation from the beginning.

Regards,
Bin

#13 lore raw

PATCH 1/2 riscv: sbi: Remove sbi_spec_version

Hi Bin

Bin Meng <[email protected]> ? 2020?6?2? ?? ??5:39???

Quoted 77 lines

Hi Rick,

Quoted 64 lines · Rick Chen

Hi Bin

Bin Meng <[email protected]> ? 2020?6?1? ?? ??5:06???

Quoted 57 lines

Hi Rick,

Quoted 46 lines · Rick Chen

Hi Bin

Quoted 43 lines

From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Wednesday, May 27, 2020 5:05 PM
To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
Cc: Atish Patra; Bin Meng
Subject: [PATCH 1/2] riscv: sbi: Remove sbi_spec_version

From: Bin Meng <[email protected]>

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.

---

 arch/riscv/include/asm/sbi.h | 2 --
 arch/riscv/lib/sbi.c         | 3 ---
 2 files changed, 5 deletions(-)
arch/riscv/include/asm/sbi.h +0 -2
@@ -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;
arch/riscv/lib/sbi.c +0 -0
@@ -11,9 +11,6 @@
 #include <asm/encoding.h>
 #include <asm/sbi.h>
 
Quoted 6 lines

arch/riscv/lib/sbi.c line 15

Quoted 2 lines
arch/riscv/lib/sbi.c +0 -2
-/* default SBI version is 0.1 */
-unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;

Why not keep this variable and get version of openSbi automatically, then register v01 or v02 callback function just like sbi_init() of Atish' patch.

Quoted 2 lines

I feel this is not needed anyway, because we are using Kconfig option to pass the same information.

Quoted 8 lines

U-Boot proper has been configured as SBI_V02 by default currently. About backward compatible issue, it is not so friendly for users. They shall select SBI_VERSION configurations correctly in U-Boot proper and re-compile between different versions of openSbi. If U-Boot proper can probe openSbi and switch V01 or V02 mode automatically, users can run smoothly without awareness of SBI versions.

Quoted 9 lines

OpenSBI v0.7 is not backward compatible with previous version regarding the multicore boot. Dynamically detecting SBI and the SBI implementation version will make U-Boot codes very complicated. In addition to SBI v0.1 vs. v0.2, we need detect whether SBI HSM extension is available and if that's not available, U-Boot has to do the lottery multi-core boot in every stage (SPL and proper). RISC-V is a new architecture and without a lot of legacy burden to carry on, I hope we can do the clean room implementation from the beginning.

OK.
Thanks for explanation.

Quoted 2 lines

Regards,
Bin