Skip to contentSkip to conversation

riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export

PATCH In review Kefeng Wang 3 participants 7 messages Apr 17, 2020 – Apr 23, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 riscv: sbi: Correct sbi_shutdown() and sbi_clear_ipi() export

Fix incorrect EXPORT_SYMBOL().

Fixes efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
---
 arch/riscv/kernel/sbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi.c +2 -2
index 7c24da59bccf..62b10a16c8d7 100644
@@ -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.
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/3 tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI

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")
---
 drivers/tty/hvc/Kconfig    | 2 +-
 drivers/tty/serial/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/hvc/Kconfig +1 -1
index 31b7e1b03749..d1b27b0522a3 100644
@@ -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
drivers/tty/serial/Kconfig +1 -1
index 0aea76cd67ff..adf9e80e7dc9 100644
@@ -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
Signature · 1 line
2.20.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] tty: riscv: Using RISCV_SBI_V01 instead of RISCV_SBI

Quoted 40 lines · 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")
---
 drivers/tty/hvc/Kconfig    | 2 +-
 drivers/tty/serial/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/hvc/Kconfig +1 -1
index 31b7e1b03749..d1b27b0522a3 100644
@@ -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
drivers/tty/serial/Kconfig +1 -2
index 0aea76cd67ff..adf9e80e7dc9 100644
@@ -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
--
Quoted 2 lines

2.20.1

Looks good to me.

Regards,
Anup

#3 lore raw

PATCH 3/3 riscv: sbi: Fix undefined reference to sbi_shutdown

In reply to 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")
---
 arch/riscv/kernel/sbi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/riscv/kernel/sbi.c +8 -5
index 62b10a16c8d7..f383ef5672b2 100644
@@ -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;
Signature · 1 line
2.20.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] riscv: sbi: Fix undefined reference to sbi_shutdown

Quoted 57 lines · 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")
---
 arch/riscv/kernel/sbi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/riscv/kernel/sbi.c +8 -6
index 62b10a16c8d7..f383ef5672b2 100644
@@ -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;
--
Quoted 2 lines

2.20.1

Looks good to me.

Regards,
Anup

Reviewed-by on v1 1/3
#5 lore raw
In reply to Kefeng Wang
Quoted 32 lines · Kefeng Wang

Fix incorrect EXPORT_SYMBOL().

Fixes efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
---
 arch/riscv/kernel/sbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi.c +2 -3
index 7c24da59bccf..62b10a16c8d7 100644
@@ -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.
--
Quoted 2 lines

2.20.1

Looks good to me.

Regards,
Anup

maintainer
#6 lore raw
In reply to Kefeng Wang
Quoted 22 lines · On Fri, 17 Apr 2020 05:12:20 PDT (-0700), [email protected] wrote:

Fix incorrect EXPORT_SYMBOL().

Fixes efca13989250 ("RISC-V: Introduce a new config for SBI v0.1")
---
 arch/riscv/kernel/sbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi.c +1 -1
index 7c24da59bccf..62b10a16c8d7 100644
@@ -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.

arch/riscv/kernel/sbi.c void sbi_clear_ipi(void) · line 119

Quoted 8 lines
arch/riscv/kernel/sbi.c +1 -1
@@ -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.