linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export
@ 2020-04-17 12:12 Kefeng Wang
  2020-04-17 12:12 ` [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI Kefeng Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kefeng Wang @ 2020-04-17 12:12 UTC (permalink / raw)
  To: atish.patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-riscv
  Cc: Kefeng Wang

Fix incorrect EXPORT_SYMBOL().

Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/kernel/sbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 7c24da59bccf..62b10a16c8d7 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -102,7 +102,7 @@ void sbi_shutdown(void)
 {
 	sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
 }
-EXPORT_SYMBOL(sbi_set_timer);
+EXPORT_SYMBOL(sbi_shutdown);
 
 /**
  * sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
@@ -113,7 +113,7 @@ void sbi_clear_ipi(void)
 {
 	sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
 }
-EXPORT_SYMBOL(sbi_shutdown);
+EXPORT_SYMBOL(sbi_clear_ipi);
 
 /**
  * sbi_set_timer_v01() - Program the timer for next timer event.
-- 
2.20.1


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

* [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI
  2020-04-17 12:12 [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Kefeng Wang
@ 2020-04-17 12:12 ` Kefeng Wang
  2020-04-17 12:40   ` Anup Patel
  2020-04-17 12:12 ` [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown Kefeng Wang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Kefeng Wang @ 2020-04-17 12:12 UTC (permalink / raw)
  To: atish.patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-riscv
  Cc: Kefeng Wang

As shown in SBI v0.2, the legacy console SBI functions (sbi_console_getchar()
and sbi_console_putchar()) are expected to be deprecated; they have no replacement.

Let's HVC_RISCV_SBI and SERIAL_EARLYCON_RISCV_SBI depends on RISCV_SBI_V01.

Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/tty/hvc/Kconfig    | 2 +-
 drivers/tty/serial/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
index 31b7e1b03749..d1b27b0522a3 100644
--- a/drivers/tty/hvc/Kconfig
+++ b/drivers/tty/hvc/Kconfig
@@ -88,7 +88,7 @@ config HVC_DCC
 
 config HVC_RISCV_SBI
 	bool "RISC-V SBI console support"
-	depends on RISCV_SBI
+	depends on RISCV_SBI_V01
 	select HVC_DRIVER
 	help
 	  This enables support for console output via RISC-V SBI calls, which
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 0aea76cd67ff..adf9e80e7dc9 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -86,7 +86,7 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
 
 config SERIAL_EARLYCON_RISCV_SBI
 	bool "Early console using RISC-V SBI"
-	depends on RISCV_SBI
+	depends on RISCV_SBI_V01
 	select SERIAL_CORE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
-- 
2.20.1


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

* [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown
  2020-04-17 12:12 [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Kefeng Wang
  2020-04-17 12:12 ` [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI Kefeng Wang
@ 2020-04-17 12:12 ` Kefeng Wang
  2020-04-17 12:43   ` Anup Patel
  2020-04-17 12:40 ` [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Anup Patel
  2020-04-23 15:43 ` Palmer Dabbelt
  3 siblings, 1 reply; 7+ messages in thread
From: Kefeng Wang @ 2020-04-17 12:12 UTC (permalink / raw)
  To: atish.patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-riscv
  Cc: Kefeng Wang

There is no shutdown call in SBI v0.2, only set pm_power_off
when RISCV_SBI_V01 enabled to fix following build error,

riscv64-linux-ld: arch/riscv/kernel/sbi.o: in function `sbi_power_off':
sbi.c:(.text+0xe): undefined reference to `sbi_shutdown

Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/kernel/sbi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 62b10a16c8d7..f383ef5672b2 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -167,6 +167,11 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask,
 
 	return result;
 }
+
+static void sbi_set_power_off(void)
+{
+	pm_power_off = sbi_shutdown;
+}
 #else
 static void __sbi_set_timer_v01(uint64_t stime_value)
 {
@@ -191,6 +196,8 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask,
 
 	return 0;
 }
+
+static void sbi_set_power_off(void) {}
 #endif /* CONFIG_RISCV_SBI_V01 */
 
 static void __sbi_set_timer_v02(uint64_t stime_value)
@@ -540,16 +547,12 @@ static inline long sbi_get_firmware_version(void)
 	return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
 }
 
-static void sbi_power_off(void)
-{
-	sbi_shutdown();
-}
 
 int __init sbi_init(void)
 {
 	int ret;
 
-	pm_power_off = sbi_power_off;
+	sbi_set_power_off();
 	ret = sbi_get_spec_version();
 	if (ret > 0)
 		sbi_spec_version = ret;
-- 
2.20.1


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

* Re: [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export
  2020-04-17 12:12 [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Kefeng Wang
  2020-04-17 12:12 ` [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI Kefeng Wang
  2020-04-17 12:12 ` [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown Kefeng Wang
@ 2020-04-17 12:40 ` Anup Patel
  2020-04-23 15:43 ` Palmer Dabbelt
  3 siblings, 0 replies; 7+ messages in thread
From: Anup Patel @ 2020-04-17 12:40 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Atish Patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel@vger.kernel.org List, linux-riscv

On Fri, Apr 17, 2020 at 5:40 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Fix incorrect EXPORT_SYMBOL().
>
> Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/kernel/sbi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 7c24da59bccf..62b10a16c8d7 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -102,7 +102,7 @@ void sbi_shutdown(void)
>  {
>         sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
>  }
> -EXPORT_SYMBOL(sbi_set_timer);
> +EXPORT_SYMBOL(sbi_shutdown);
>
>  /**
>   * sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
> @@ -113,7 +113,7 @@ void sbi_clear_ipi(void)
>  {
>         sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
>  }
> -EXPORT_SYMBOL(sbi_shutdown);
> +EXPORT_SYMBOL(sbi_clear_ipi);
>
>  /**
>   * sbi_set_timer_v01() - Program the timer for next timer event.
> --
> 2.20.1
>

Looks good to me.

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

Regards,
Anup

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

* Re: [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI
  2020-04-17 12:12 ` [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI Kefeng Wang
@ 2020-04-17 12:40   ` Anup Patel
  0 siblings, 0 replies; 7+ messages in thread
From: Anup Patel @ 2020-04-17 12:40 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Atish Patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel@vger.kernel.org List, linux-riscv

On Fri, Apr 17, 2020 at 5:40 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> As shown in SBI v0.2, the legacy console SBI functions (sbi_console_getchar()
> and sbi_console_putchar()) are expected to be deprecated; they have no replacement.
>
> Let's HVC_RISCV_SBI and SERIAL_EARLYCON_RISCV_SBI depends on RISCV_SBI_V01.
>
> Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/tty/hvc/Kconfig    | 2 +-
>  drivers/tty/serial/Kconfig | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
> index 31b7e1b03749..d1b27b0522a3 100644
> --- a/drivers/tty/hvc/Kconfig
> +++ b/drivers/tty/hvc/Kconfig
> @@ -88,7 +88,7 @@ config HVC_DCC
>
>  config HVC_RISCV_SBI
>         bool "RISC-V SBI console support"
> -       depends on RISCV_SBI
> +       depends on RISCV_SBI_V01
>         select HVC_DRIVER
>         help
>           This enables support for console output via RISC-V SBI calls, which
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 0aea76cd67ff..adf9e80e7dc9 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -86,7 +86,7 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
>
>  config SERIAL_EARLYCON_RISCV_SBI
>         bool "Early console using RISC-V SBI"
> -       depends on RISCV_SBI
> +       depends on RISCV_SBI_V01
>         select SERIAL_CORE
>         select SERIAL_CORE_CONSOLE
>         select SERIAL_EARLYCON
> --
> 2.20.1
>

Looks good to me.

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

Regards,
Anup

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

* Re: [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown
  2020-04-17 12:12 ` [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown Kefeng Wang
@ 2020-04-17 12:43   ` Anup Patel
  0 siblings, 0 replies; 7+ messages in thread
From: Anup Patel @ 2020-04-17 12:43 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Atish Patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel@vger.kernel.org List, linux-riscv

On Fri, Apr 17, 2020 at 5:40 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> There is no shutdown call in SBI v0.2, only set pm_power_off
> when RISCV_SBI_V01 enabled to fix following build error,
>
> riscv64-linux-ld: arch/riscv/kernel/sbi.o: in function `sbi_power_off':
> sbi.c:(.text+0xe): undefined reference to `sbi_shutdown
>
> Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/kernel/sbi.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 62b10a16c8d7..f383ef5672b2 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -167,6 +167,11 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask,
>
>         return result;
>  }
> +
> +static void sbi_set_power_off(void)
> +{
> +       pm_power_off = sbi_shutdown;
> +}
>  #else
>  static void __sbi_set_timer_v01(uint64_t stime_value)
>  {
> @@ -191,6 +196,8 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask,
>
>         return 0;
>  }
> +
> +static void sbi_set_power_off(void) {}
>  #endif /* CONFIG_RISCV_SBI_V01 */
>
>  static void __sbi_set_timer_v02(uint64_t stime_value)
> @@ -540,16 +547,12 @@ static inline long sbi_get_firmware_version(void)
>         return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
>  }
>
> -static void sbi_power_off(void)
> -{
> -       sbi_shutdown();
> -}
>
>  int __init sbi_init(void)
>  {
>         int ret;
>
> -       pm_power_off = sbi_power_off;
> +       sbi_set_power_off();
>         ret = sbi_get_spec_version();
>         if (ret > 0)
>                 sbi_spec_version = ret;
> --
> 2.20.1
>

Looks good to me.

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

Regards,
Anup

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

* Re: [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export
  2020-04-17 12:12 [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Kefeng Wang
                   ` (2 preceding siblings ...)
  2020-04-17 12:40 ` [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Anup Patel
@ 2020-04-23 15:43 ` Palmer Dabbelt
  3 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2020-04-23 15:43 UTC (permalink / raw)
  To: wangkefeng.wang
  Cc: Atish Patra, Paul Walmsley, aou, linux-kernel, linux-riscv,
	wangkefeng.wang

On Fri, 17 Apr 2020 05:12:20 PDT (-0700), wangkefeng.wang@huawei.com wrote:
> Fix incorrect EXPORT_SYMBOL().
>
> Fixes: efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/kernel/sbi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 7c24da59bccf..62b10a16c8d7 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -102,7 +102,7 @@ void sbi_shutdown(void)
>  {
>  	sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
>  }
> -EXPORT_SYMBOL(sbi_set_timer);
> +EXPORT_SYMBOL(sbi_shutdown);
>
>  /**
>   * sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
> @@ -113,7 +113,7 @@ void sbi_clear_ipi(void)
>  {
>  	sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
>  }
> -EXPORT_SYMBOL(sbi_shutdown);
> +EXPORT_SYMBOL(sbi_clear_ipi);
>
>  /**
>   * sbi_set_timer_v01() - Program the timer for next timer event.

Thanks.  I've put all three of these on fixes.

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

end of thread, other threads:[~2020-04-23 15:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 12:12 [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Kefeng Wang
2020-04-17 12:12 ` [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI Kefeng Wang
2020-04-17 12:40   ` Anup Patel
2020-04-17 12:12 ` [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown Kefeng Wang
2020-04-17 12:43   ` Anup Patel
2020-04-17 12:40 ` [PATCH 1/3] riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export Anup Patel
2020-04-23 15:43 ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).