Skip to contentSkip to conversation

tty: hvc: Don't enable the RISC-V SBI console by default

PATCH Applied Palmer Dabbelt 5 participants 5 messages Feb 14, 2024 – Feb 21, 2024

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

PATCH 1/1 tty: hvc: Don't enable the RISC-V SBI console by default

From: Palmer Dabbelt <[email protected]>

The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was.

So just mark the new driver as nonportable.

Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")
---
 drivers/tty/hvc/Kconfig | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/hvc/Kconfig +5 -3
index 6e05c5c7bca1..c2a4e88b328f 100644
@@ -108,13 +108,15 @@ config HVC_DCC_SERIALIZE_SMP
 
 config HVC_RISCV_SBI
 	bool "RISC-V SBI console support"
-	depends on RISCV_SBI
+	depends on RISCV_SBI && NONPORTABLE
 	select HVC_DRIVER
 	help
 	  This enables support for console output via RISC-V SBI calls, which
-	  is normally used only during boot to output printk.
+	  is normally used only during boot to output printk.  This driver
+	  conflicts with real console drivers and should not be enabled on
+	  systems that directly access the console.
 
-	  If you don't know what do to here, say Y.
+	  If you don't know what do to here, say N.
 
 config HVCS
 	tristate "IBM Hypervisor Virtual Console Server support"
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was.

Quoted 5 lines

So just mark the new driver as nonportable.

Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")

- Paul

Reviewed-by on v1 1/1
#2 lore raw
In reply to Palmer Dabbelt
Quoted 8 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was.

Quoted 5 lines

So just mark the new driver as nonportable.

Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")

LTGM.

Regards,
Anup

Quoted 31 lines
---
 drivers/tty/hvc/Kconfig | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/hvc/Kconfig +5 -4
index 6e05c5c7bca1..c2a4e88b328f 100644
@@ -108,13 +108,15 @@ config HVC_DCC_SERIALIZE_SMP
 
 config HVC_RISCV_SBI
        bool "RISC-V SBI console support"
-       depends on RISCV_SBI
+       depends on RISCV_SBI && NONPORTABLE
        select HVC_DRIVER
        help
          This enables support for console output via RISC-V SBI calls, which
-         is normally used only during boot to output printk.
+         is normally used only during boot to output printk.  This driver
+         conflicts with real console drivers and should not be enabled on
+         systems that directly access the console.
 
-         If you don't know what do to here, say Y.
+         If you don't know what do to here, say N.
 
 config HVCS
        tristate "IBM Hypervisor Virtual Console Server support"
--

2.43.0

Reviewed-by on v1 1/1
#3 lore raw
In reply to Palmer Dabbelt
Quoted 7 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was.

Quoted 5 lines

So just mark the new driver as nonportable.

Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")

As was brought up when we covered this earlier today, if you're going to probe a driver based on an ecall, the same hardware should not remain enabled in the DT passed to the kernel.
If you want to enable this driver in a multiplatform kernel alongside "real" drivers, then the solution is simple, firmware needs implementation needs to patch the DT and, at least, mark the uart as reserved if it is using it to provide the debug console. Marking this nonportable so that people only walk into this with their eyes open seems like a reasonable action to me.

Cheers,
Conor.

Quoted 31 lines
---
 drivers/tty/hvc/Kconfig | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/hvc/Kconfig +5 -3
index 6e05c5c7bca1..c2a4e88b328f 100644
@@ -108,13 +108,15 @@ config HVC_DCC_SERIALIZE_SMP
 
 config HVC_RISCV_SBI
 	bool "RISC-V SBI console support"
-	depends on RISCV_SBI
+	depends on RISCV_SBI && NONPORTABLE
 	select HVC_DRIVER
 	help
 	  This enables support for console output via RISC-V SBI calls, which
-	  is normally used only during boot to output printk.
+	  is normally used only during boot to output printk.  This driver
+	  conflicts with real console drivers and should not be enabled on
+	  systems that directly access the console.
 
-	  If you don't know what do to here, say Y.
+	  If you don't know what do to here, say N.
 
 config HVCS
 	tristate "IBM Hypervisor Virtual Console Server support"
Signature · 1 line
2.43.0
#4 lore raw
In reply to Palmer Dabbelt
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Wed, 14 Feb 2024 07:34:30 -0800 you wrote:

From: Palmer Dabbelt <[email protected]>

The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was.

[...]

Here is the summary with links:
- tty: hvc: Don't enable the RISC-V SBI console by default

    https://git.kernel.org/riscv/c/481860974faa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html