linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	linuxppc-dev@lists.ozlabs.org,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: Re: [tty:tty-testing 19/19] legacy_serial.c:undefined reference to `fsl8250_handle_irq'
Date: Fri, 2 Jun 2023 09:42:19 +0200	[thread overview]
Message-ID: <20230602074219.srlgpaaypewd2q5s@pengutronix.de> (raw)
In-Reply-To: <202306021041.qbRZZenE-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4347 bytes --]

Hello,

On Fri, Jun 02, 2023 at 10:27:52AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
> head:   3a3d09a9ee0ef5b417d6bdf8486a4da2bef06dc3
> commit: 3a3d09a9ee0ef5b417d6bdf8486a4da2bef06dc3 [19/19] serial: 8250: Apply FSL workarounds also without SERIAL_8250_CONSOLE
> config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230602/202306021041.qbRZZenE-lkp@intel.com/config)
> compiler: powerpc-linux-gcc (GCC) 12.3.0
> reproduce (this is a W=1 build):
>         mkdir -p ~/bin
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?id=3a3d09a9ee0ef5b417d6bdf8486a4da2bef06dc3
>         git remote add tty https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
>         git fetch --no-tags tty tty-testing
>         git checkout 3a3d09a9ee0ef5b417d6bdf8486a4da2bef06dc3

For the new readers, this is about

	https://lore.kernel.org/r/20230531083230.2702181-1-u.kleine-koenig@pengutronix.de

Greg already dropped it from his tty-testing tree. Thanks and sorry for
this second breakage. :-\

>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306021041.qbRZZenE-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    powerpc-linux-ld: arch/powerpc/kernel/legacy_serial.o: in function `serial_dev_init':
> >> legacy_serial.c:(.init.text+0x46a): undefined reference to `fsl8250_handle_irq'
> >> powerpc-linux-ld: legacy_serial.c:(.init.text+0x472): undefined reference to `fsl8250_handle_irq'

Urgs, this is ugly. Arch code uses a function from the 8250 driver
introduced in commit 9deaa53ac7fa ("serial: add irq handler for
Freescale 16550 errata.").

So the problematic case is SERIAL_8250=m which results in
fsl8250_handle_irq being in a module.

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index c9ad12461d44..ad9f15902abb 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -510,8 +510,12 @@ static void __init fixup_port_irq(int index,
 
 #ifdef CONFIG_SERIAL_8250_FSL
 	if (of_device_is_compatible(np, "fsl,ns16550")) {
-		port->handle_irq = fsl8250_handle_irq;
-		port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
+		if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
+			port->handle_irq = fsl8250_handle_irq;
+			port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
+		} else {
+			pr_warn("Not activating fsl workarounds for 8250 port %d\n", index);
+		}
 	}
 #endif
 }

would work. The warning would trigger in cases where before the port
just silently used the default irq handler and so the FSL bug isn't
workarounded[1]. If the warning isn't wanted, it could be simplified to:

#if IS_REACHABLE(CONFIG_SERIAL_8250)
	if (of_device_is_compatible(np, "fsl,ns16550")) {
		...
	}
#endif

But I wonder if in the presence of

        if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) &&
            (of_device_is_compatible(np, "fsl,ns16550") ||
             of_device_is_compatible(np, "fsl,16550-FIFO64"))) {
                port->handle_irq = fsl8250_handle_irq;
                port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
        }

in of_platform_serial_setup() the code in
arch/powerpc/kernel/legacy_serial.c can just be dropped instead?!

Best regards
Uwe

[1] Of course this won't happen because the help text of SERIAL_8250
clearly indicates that =m isn't a safe choice in the presence of
"non-standard serial ports". So the issue is purly theoretic.

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2023-06-02  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02  2:27 [tty:tty-testing 19/19] legacy_serial.c:undefined reference to `fsl8250_handle_irq' kernel test robot
2023-06-02  7:42 ` Uwe Kleine-König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602074219.srlgpaaypewd2q5s@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lkp@intel.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paul.gortmaker@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).