linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE
@ 2023-06-09 13:39 Uwe Kleine-König
  2023-06-09 13:39 ` [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2023-06-09 13:39 UTC (permalink / raw)
  To: Michael Ellerman, Greg Kroah-Hartman, Jiri Slaby
  Cc: Rob Herring, kernel, Geert Uytterhoeven, linuxppc-dev,
	Helge Deller, Randy Dunlap, linux-kernel, Johan Hovold,
	Kumaravel Thiagarajan, James Hilliard, Nicholas Piggin,
	linux-serial, Matthew Gerlach, Ilpo Järvinen,
	Andy Shevchenko, Liang He, Lino Sanfilippo

Hello,

this is the fourth iteration of trying to make the FSL workaround code
active even without 8250 console support.

The first patch is a fix for commit 66eff0ef528b (powerpc/legacy_serial:
Warn about 8250 devices operated without active FSL workarounds) that
currently is in tty-next. This patch originates from my v3 that was only
partially applied. (That is a lame excuse though. While the applying the
full series would not have shown this problem, bisection would still
have a problem.)

The second patch makes SERIAL_8250_FSL tristate and thus allows this to
be enabled also with SERIAL_8250=m. This is also the relevant change
since v3, where 8250_fsl.o was linked into 8250-base.ko.

This series is build tested on amd64 and powerpc with all 27 possible
configurations for

	SERIAL_8250={y,m,n}
	SERIAL_8250_FSL={y,m,n}
	SERIAL_OF_PLATFORM={y,m,n}

using:

	choices=(y m n)
	for i in $(seq 0 26); do
		perl -p -e "s/SERIAL_8250=y/SERIAL_8250=${choices[$(((i / 9) % 3))]}/; s/SERIAL_8250_FSL=y/SERIAL_8250_FSL=${choices[$(((i / 3) % 3))]}/; s/SERIAL_OF_PLATFORM=y/SERIAL_OF_PLATFORM=${choices[$((i % 3))]}/;" .config-pre > .config &&
		make -j 12 ||
		break;
	done

with .config-pre having COMPILE_TEST=y so this time there shouldn't be a
build regression. (Not all 27 variants are possible, so some valid
configurations are tested twice or more, but that's still good enough.)

The patches have no strong dependency on each other, so they could go in
via different trees. But given that 66eff0ef528b is in tty-next, taking
both via tty sounds most sensible.

Best regards
Uwe

Uwe Kleine-König (2):
  powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures
  serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE

 arch/powerpc/kernel/legacy_serial.c | 2 +-
 drivers/tty/serial/8250/8250_fsl.c  | 3 +++
 drivers/tty/serial/8250/8250_of.c   | 2 +-
 drivers/tty/serial/8250/Kconfig     | 6 +++---
 4 files changed, 8 insertions(+), 5 deletions(-)


base-commit: 66eff0ef528b6d6e9a45b68f6cd969dcbe7b800a
-- 
2.39.2


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

* [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures
  2023-06-09 13:39 [PATCH v4 0/2] serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE Uwe Kleine-König
@ 2023-06-09 13:39 ` Uwe Kleine-König
  2023-06-10  3:03   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2023-06-09 13:39 UTC (permalink / raw)
  To: Michael Ellerman, Greg Kroah-Hartman, Jiri Slaby
  Cc: Rob Herring, linuxppc-dev, Randy Dunlap, linux-kernel,
	Nicholas Piggin, kernel, Liang He

With SERIAL_8250=y and SERIAL_8250_FSL_CONSOLE=n the both
IS_ENABLED(CONFIG_SERIAL_8250) and IS_REACHABLE(CONFIG_SERIAL_8250)
evaluate to true and so fsl8250_handle_irq() is used. However this
function is only available if CONFIG_SERIAL_8250_CONSOLE=y (and thus
SERIAL_8250_FSL=y).

To prepare SERIAL_8250_FSL becoming tristate and being enabled in more
cases, check for IS_REACHABLE(CONFIG_SERIAL_8250_FSL) before making use
of fsl8250_handle_irq(). This check is correct with and without the
change to make SERIAL_8250_FSL modular.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: 66eff0ef528b ("powerpc/legacy_serial: Warn about 8250 devices operated without active FSL workarounds")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/powerpc/kernel/legacy_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index fdbd85aafeb1..6ee65741dbd5 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -510,7 +510,7 @@ static void __init fixup_port_irq(int index,
 
 	if (IS_ENABLED(CONFIG_SERIAL_8250) &&
 	    of_device_is_compatible(np, "fsl,ns16550")) {
-		if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
+		if (IS_REACHABLE(CONFIG_SERIAL_8250_FSL)) {
 			port->handle_irq = fsl8250_handle_irq;
 			port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
 		} else {
-- 
2.39.2


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

* Re: [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures
  2023-06-09 13:39 ` [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures Uwe Kleine-König
@ 2023-06-10  3:03   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2023-06-10  3:03 UTC (permalink / raw)
  To: Uwe Kleine-König, Michael Ellerman, Greg Kroah-Hartman,
	Jiri Slaby
  Cc: Rob Herring, Liang He, linux-kernel, Nicholas Piggin, kernel,
	linuxppc-dev



On 6/9/23 06:39, Uwe Kleine-König wrote:
> With SERIAL_8250=y and SERIAL_8250_FSL_CONSOLE=n the both
> IS_ENABLED(CONFIG_SERIAL_8250) and IS_REACHABLE(CONFIG_SERIAL_8250)
> evaluate to true and so fsl8250_handle_irq() is used. However this
> function is only available if CONFIG_SERIAL_8250_CONSOLE=y (and thus
> SERIAL_8250_FSL=y).
> 
> To prepare SERIAL_8250_FSL becoming tristate and being enabled in more
> cases, check for IS_REACHABLE(CONFIG_SERIAL_8250_FSL) before making use
> of fsl8250_handle_irq(). This check is correct with and without the
> change to make SERIAL_8250_FSL modular.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: 66eff0ef528b ("powerpc/legacy_serial: Warn about 8250 devices operated without active FSL workarounds")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  arch/powerpc/kernel/legacy_serial.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
> index fdbd85aafeb1..6ee65741dbd5 100644
> --- a/arch/powerpc/kernel/legacy_serial.c
> +++ b/arch/powerpc/kernel/legacy_serial.c
> @@ -510,7 +510,7 @@ static void __init fixup_port_irq(int index,
>  
>  	if (IS_ENABLED(CONFIG_SERIAL_8250) &&
>  	    of_device_is_compatible(np, "fsl,ns16550")) {
> -		if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
> +		if (IS_REACHABLE(CONFIG_SERIAL_8250_FSL)) {
>  			port->handle_irq = fsl8250_handle_irq;
>  			port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
>  		} else {

-- 
~Randy

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

end of thread, other threads:[~2023-06-10  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 13:39 [PATCH v4 0/2] serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE Uwe Kleine-König
2023-06-09 13:39 ` [PATCH v4 1/2] powerpc/legacy_serial: Handle SERIAL_8250_FSL=n build failures Uwe Kleine-König
2023-06-10  3:03   ` Randy Dunlap

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