* [PATCH] tty: hvc: restrict HVC_DCC to ARMv6+ and ARM64
@ 2026-07-17 7:16 Karl Mehltretter
2026-07-17 7:22 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Karl Mehltretter @ 2026-07-17 7:16 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby
Cc: Arnd Bergmann, Nicolas Pitre, linux-serial, linux-kernel,
Karl Mehltretter
hvc_dcc drives the JTAG DCC via the ARMv6/v7 CP14 debug registers
(mrc/mcr p14, 0, rX, c0, c1/c5, 0 in asm/dcc.h). That encoding is
undefined on older ARM cores, and also on ARMv7-M, but HVC_DCC only
depends on ARM, so it can be enabled on e.g. ARM926 (ARCH_MULTI_V5),
where hvc_dcc_console_init() runs __dcc_putchar() at boot and takes an
undefined-instruction trap before the console is up:
Internal error: Oops - undefined instruction: 0 [#1] ARM
PC is at hvc_dcc_check+0x50/0x8c
hvc_dcc_check from hvc_dcc_console_init+0x18/0x48
hvc_dcc_console_init from console_init+0x58/0x170
Kernel panic - not syncing: Fatal exception
Restrict HVC_DCC to the CPUs where that encoding is valid: the
CPU_V6 || CPU_V6K || CPU_V7 set that arch/arm/include/debug/icedcc.S
guards it with, plus ARM64.
Fixes: 16c63f8ea49c ("drivers: char: hvc: add arm JTAG DCC console support")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
drivers/tty/hvc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
index c2a4e88b328f..5866195de26a 100644
--- a/drivers/tty/hvc/Kconfig
+++ b/drivers/tty/hvc/Kconfig
@@ -79,7 +79,7 @@ config HVC_UDBG
config HVC_DCC
bool "ARM JTAG DCC console"
- depends on ARM || ARM64
+ depends on (ARM && (CPU_V6 || CPU_V6K || CPU_V7)) || ARM64
select HVC_DRIVER
select SERIAL_CORE_CONSOLE
help
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: hvc: restrict HVC_DCC to ARMv6+ and ARM64
2026-07-17 7:16 [PATCH] tty: hvc: restrict HVC_DCC to ARMv6+ and ARM64 Karl Mehltretter
@ 2026-07-17 7:22 ` Greg Kroah-Hartman
2026-07-17 8:04 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-17 7:22 UTC (permalink / raw)
To: Karl Mehltretter
Cc: Jiri Slaby, Arnd Bergmann, Nicolas Pitre, linux-serial,
linux-kernel
On Fri, Jul 17, 2026 at 09:16:16AM +0200, Karl Mehltretter wrote:
> hvc_dcc drives the JTAG DCC via the ARMv6/v7 CP14 debug registers
> (mrc/mcr p14, 0, rX, c0, c1/c5, 0 in asm/dcc.h). That encoding is
> undefined on older ARM cores, and also on ARMv7-M, but HVC_DCC only
> depends on ARM, so it can be enabled on e.g. ARM926 (ARCH_MULTI_V5),
> where hvc_dcc_console_init() runs __dcc_putchar() at boot and takes an
> undefined-instruction trap before the console is up:
>
> Internal error: Oops - undefined instruction: 0 [#1] ARM
> PC is at hvc_dcc_check+0x50/0x8c
> hvc_dcc_check from hvc_dcc_console_init+0x18/0x48
> hvc_dcc_console_init from console_init+0x58/0x170
> Kernel panic - not syncing: Fatal exception
>
> Restrict HVC_DCC to the CPUs where that encoding is valid: the
> CPU_V6 || CPU_V6K || CPU_V7 set that arch/arm/include/debug/icedcc.S
> guards it with, plus ARM64.
>
> Fixes: 16c63f8ea49c ("drivers: char: hvc: add arm JTAG DCC console support")
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> drivers/tty/hvc/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
> index c2a4e88b328f..5866195de26a 100644
> --- a/drivers/tty/hvc/Kconfig
> +++ b/drivers/tty/hvc/Kconfig
> @@ -79,7 +79,7 @@ config HVC_UDBG
>
> config HVC_DCC
> bool "ARM JTAG DCC console"
> - depends on ARM || ARM64
> + depends on (ARM && (CPU_V6 || CPU_V6K || CPU_V7)) || ARM64
What about testing builds?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: hvc: restrict HVC_DCC to ARMv6+ and ARM64
2026-07-17 7:22 ` Greg Kroah-Hartman
@ 2026-07-17 8:04 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-07-17 8:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, Karl Mehltretter
Cc: Jiri Slaby, Nicolas Pitre, linux-serial, linux-kernel
On Fri, Jul 17, 2026, at 09:22, Greg Kroah-Hartman wrote:
> On Fri, Jul 17, 2026 at 09:16:16AM +0200, Karl Mehltretter wrote:
>> hvc_dcc drives the JTAG DCC via the ARMv6/v7 CP14 debug registers
>> (mrc/mcr p14, 0, rX, c0, c1/c5, 0 in asm/dcc.h). That encoding is
>> undefined on older ARM cores, and also on ARMv7-M, but HVC_DCC only
>> depends on ARM, so it can be enabled on e.g. ARM926 (ARCH_MULTI_V5),
>> where hvc_dcc_console_init() runs __dcc_putchar() at boot and takes an
>> undefined-instruction trap before the console is up:
>>
>> Internal error: Oops - undefined instruction: 0 [#1] ARM
>> PC is at hvc_dcc_check+0x50/0x8c
>> hvc_dcc_check from hvc_dcc_console_init+0x18/0x48
>> hvc_dcc_console_init from console_init+0x58/0x170
>> Kernel panic - not syncing: Fatal exception
>>
>> Restrict HVC_DCC to the CPUs where that encoding is valid: the
>> CPU_V6 || CPU_V6K || CPU_V7 set that arch/arm/include/debug/icedcc.S
>> guards it with, plus ARM64.
>>
>> Fixes: 16c63f8ea49c ("drivers: char: hvc: add arm JTAG DCC console support")
>> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
I don't like having architecture specific symbols in drivers/*/Kconfig,
but this one is clearly correct, so as a quick fix this is
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
A nicer alternative would be to improve the feature detection
in the driver by probing an appropriate ID register for presence
of DCC. Unfortunately we can't use regular device probing
because the driver is a low-level debug hack that is intended
to just bypass all of that and provide a console.
Maybe checking RCP14_DBGDIDR() to see if the version is greater
or equal to '1' (arm1136) will work? If that also traps,
an __ex_table fixup could catch that to fail the driver probe.
>> drivers/tty/hvc/Kconfig | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
>> index c2a4e88b328f..5866195de26a 100644
>> --- a/drivers/tty/hvc/Kconfig
>> +++ b/drivers/tty/hvc/Kconfig
>> @@ -79,7 +79,7 @@ config HVC_UDBG
>>
>> config HVC_DCC
>> bool "ARM JTAG DCC console"
>> - depends on ARM || ARM64
>> + depends on (ARM && (CPU_V6 || CPU_V6K || CPU_V7)) || ARM64
>
> What about testing builds?
The driver only builds on arm32 or arm64, and there is little
value of build-testing it on armv4/v5.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-17 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 7:16 [PATCH] tty: hvc: restrict HVC_DCC to ARMv6+ and ARM64 Karl Mehltretter
2026-07-17 7:22 ` Greg Kroah-Hartman
2026-07-17 8:04 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox