All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
@ 2020-05-27  9:04 Bin Meng
  2020-05-27  9:04 ` [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01 Bin Meng
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB1@ATCPCS16.andestech.com>
  0 siblings, 2 replies; 12+ messages in thread
From: Bin Meng @ 2020-05-27  9:04 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

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 <bin.meng@windriver.com>
---

 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 <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,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
  2020-05-27  9:04 [PATCH 1/2] riscv: sbi: Remove sbi_spec_version Bin Meng
@ 2020-05-27  9:04 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB8@ATCPCS16.andestech.com>
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB1@ATCPCS16.andestech.com>
  1 sibling, 1 reply; 12+ messages in thread
From: Bin Meng @ 2020-05-27  9:04 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

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 <bin.meng@windriver.com>
---

 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 */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB8@ATCPCS16.andestech.com>
@ 2020-06-01  7:59     ` Rick Chen
  2020-06-01  9:07       ` Rick Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Rick Chen @ 2020-06-01  7:59 UTC (permalink / raw)
  To: u-boot

> 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 <bin.meng@windriver.com>
>
> 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 <bin.meng@windriver.com>
> ---

Reviewed-by: Rick Chen <rick@andestech.com>

>
>  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 */
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB1@ATCPCS16.andestech.com>
@ 2020-06-01  8:13   ` Rick Chen
  2020-06-01  9:06     ` Bin Meng
  0 siblings, 1 reply; 12+ messages in thread
From: Rick Chen @ 2020-06-01  8:13 UTC (permalink / raw)
  To: u-boot

Hi Bin

> 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 <bin.meng@windriver.com>
>
> 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 <bin.meng@windriver.com>
> ---
>
>  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 <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

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
  2020-06-01  8:13   ` [PATCH 1/2] riscv: sbi: Remove sbi_spec_version Rick Chen
@ 2020-06-01  9:06     ` Bin Meng
  2020-06-02  9:12       ` Rick Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Bin Meng @ 2020-06-01  9:06 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Mon, Jun 1, 2020 at 4:14 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > 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 <bin.meng@windriver.com>
> >
> > 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 <bin.meng@windriver.com>
> > ---
> >
> >  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 <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.

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

Regards,
Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
  2020-06-01  7:59     ` Rick Chen
@ 2020-06-01  9:07       ` Rick Chen
  2020-06-01  9:09         ` Bin Meng
  0 siblings, 1 reply; 12+ messages in thread
From: Rick Chen @ 2020-06-01  9:07 UTC (permalink / raw)
  To: u-boot

Hi Bin

> > 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 <bin.meng@windriver.com>
> >
> > 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 <bin.meng@windriver.com>
> > ---
>
> Reviewed-by: Rick Chen <rick@andestech.com>
>

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

> >
> >  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 */
> > --
> > 2.7.4
> >

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
  2020-06-01  9:07       ` Rick Chen
@ 2020-06-01  9:09         ` Bin Meng
  2020-06-02 18:32           ` Atish Patra
  0 siblings, 1 reply; 12+ messages in thread
From: Bin Meng @ 2020-06-01  9:09 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Mon, Jun 1, 2020 at 5:08 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > > 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 <bin.meng@windriver.com>
> > >
> > > 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 <bin.meng@windriver.com>
> > > ---
> >
> > Reviewed-by: Rick Chen <rick@andestech.com>
> >
>
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
  2020-06-01  9:06     ` Bin Meng
@ 2020-06-02  9:12       ` Rick Chen
  2020-06-02  9:39         ` Bin Meng
  0 siblings, 1 reply; 12+ messages in thread
From: Rick Chen @ 2020-06-02  9:12 UTC (permalink / raw)
  To: u-boot

Hi Bin

Bin Meng <bmeng.cn@gmail.com> ? 2020?6?1? ?? ??5:06???
>
> Hi Rick,
>
> On Mon, Jun 1, 2020 at 4:14 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > 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 <bin.meng@windriver.com>
> > >
> > > 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 <bin.meng@windriver.com>
> > > ---
> > >
> > >  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 <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.
>
> 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



>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
  2020-06-02  9:12       ` Rick Chen
@ 2020-06-02  9:39         ` Bin Meng
  2020-06-03  2:33           ` Rick Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Bin Meng @ 2020-06-02  9:39 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Tue, Jun 2, 2020 at 5:13 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> Bin Meng <bmeng.cn@gmail.com> ? 2020?6?1? ?? ??5:06???
> >
> > Hi Rick,
> >
> > On Mon, Jun 1, 2020 at 4:14 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > 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 <bin.meng@windriver.com>
> > > >
> > > > 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 <bin.meng@windriver.com>
> > > > ---
> > > >
> > > >  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 <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.
> >
> > 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.
>

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
  2020-06-01  9:09         ` Bin Meng
@ 2020-06-02 18:32           ` Atish Patra
  2020-06-03  1:16             ` Rick Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Atish Patra @ 2020-06-02 18:32 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 1, 2020 at 2:09 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Rick,
>
> On Mon, Jun 1, 2020 at 5:08 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > > 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 <bin.meng@windriver.com>
> > > >
> > > > 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 <bin.meng@windriver.com>
> > > > ---
> > >
> > > Reviewed-by: Rick Chen <rick@andestech.com>
> > >
> >
> > 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.
> See commit 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01")
>
> Regards,
> Bin



-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01
  2020-06-02 18:32           ` Atish Patra
@ 2020-06-03  1:16             ` Rick Chen
  0 siblings, 0 replies; 12+ messages in thread
From: Rick Chen @ 2020-06-03  1:16 UTC (permalink / raw)
  To: u-boot

Hi Atish

Atish Patra <atishp@atishpatra.org> ? 2020?6?3? ?? ??2:32???
>
> On Mon, Jun 1, 2020 at 2:09 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Hi Rick,
> >
> > On Mon, Jun 1, 2020 at 5:08 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > > 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 <bin.meng@windriver.com>
> > > > >
> > > > > 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 <bin.meng@windriver.com>
> > > > > ---
> > > >
> > > > Reviewed-by: Rick Chen <rick@andestech.com>
> > > >
> > >
> > > 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.

Thanks for your explanation.

Regards,
Rick

> > See commit 7e249bc13aaf: ("riscv: Move all SMP related SBI calls to SBI_v01")
> >
> > Regards,
> > Bin
>
>
>
> --
> Regards,
> Atish

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] riscv: sbi: Remove sbi_spec_version
  2020-06-02  9:39         ` Bin Meng
@ 2020-06-03  2:33           ` Rick Chen
  0 siblings, 0 replies; 12+ messages in thread
From: Rick Chen @ 2020-06-03  2:33 UTC (permalink / raw)
  To: u-boot

Hi Bin

Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??5:39???
>
> Hi Rick,
>
> On Tue, Jun 2, 2020 at 5:13 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?1? ?? ??5:06???
> > >
> > > Hi Rick,
> > >
> > > On Mon, Jun 1, 2020 at 4:14 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > > 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 <bin.meng@windriver.com>
> > > > >
> > > > > 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 <bin.meng@windriver.com>
> > > > > ---
> > > > >
> > > > >  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 <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.
> > >
> > > 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.
> >
>
> 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.

Reviewed-by: Rick Chen <rick@andestech.com>

> Regards,
> Bin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-06-03  2:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  9:04 [PATCH 1/2] riscv: sbi: Remove sbi_spec_version Bin Meng
2020-05-27  9:04 ` [PATCH 2/2] riscv: sbi: Move sbi_probe_extension() out of CONFIG_SBI_V01 Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB8@ATCPCS16.andestech.com>
2020-06-01  7:59     ` Rick Chen
2020-06-01  9:07       ` Rick Chen
2020-06-01  9:09         ` Bin Meng
2020-06-02 18:32           ` Atish Patra
2020-06-03  1:16             ` Rick Chen
     [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4712FB1@ATCPCS16.andestech.com>
2020-06-01  8:13   ` [PATCH 1/2] riscv: sbi: Remove sbi_spec_version Rick Chen
2020-06-01  9:06     ` Bin Meng
2020-06-02  9:12       ` Rick Chen
2020-06-02  9:39         ` Bin Meng
2020-06-03  2:33           ` Rick Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.