From: Parker Newman <parker@finest.io>
To: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Jiri Slaby <jirislaby@kernel.org>,
Parker Newman <pnewman@connecttech.com>
Subject: Re: [PATCH] tty: serial: 8250: exar: fix kernel warning in default_setup function
Date: Wed, 13 Aug 2025 09:30:47 -0400 [thread overview]
Message-ID: <20250813091900.7d4e4e89.parker@finest.io> (raw)
In-Reply-To: <20250813130629.03832804@posteo.net>
On Wed, 13 Aug 2025 11:06:31 +0000
Wilken Gottwalt <wilken.gottwalt@posteo.net> wrote:
> On Wed, 6 Aug 2025 00:34:44 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > On Wed, Jul 30, 2025 at 11:03:50AM +0000, Wilken Gottwalt wrote:
> > > On Tue, 29 Jul 2025 10:48:17 +0200
> > > Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > >
> > > > > diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> > > > > index 04a0cbab02c2..5660bb897803 100644
> > > > > --- a/drivers/tty/serial/8250/8250_exar.c
> > > > > +++ b/drivers/tty/serial/8250/8250_exar.c
> > > > > @@ -500,12 +500,13 @@ static int default_setup(struct exar8250 *priv, struct pci_dev
> > > > > *pcidev, struct uart_8250_port *port)
> > > > > {
> > > > > const struct exar8250_board *board = priv->board;
> > > > > + unsigned int bar = 0;
> > > > > unsigned char status;
> > > > > - int err;
> > > > >
> > > > > - err = serial8250_pci_setup_port(pcidev, port, 0, offset, board->reg_shift);
> > > > > - if (err)
> > > > > - return err;
> > > > > + port->port.iotype = UPIO_MEM;
> > > > > + port->port.mapbase = pci_resource_start(pcidev, bar) + offset;
> > > > > + port->port.membase = priv->virt + offset;
> > > > > + port->port.regshift = board->reg_shift;
> > > >
> > > > And so now serial8250_pci_setup_port() is never called? Are you sure
> > > > that's ok?
> > >
> > > Hi Greg,
> > >
> > > I will not provide a second version of this patch, because this is a bigger
> > > problem involving 8250_exar, 8250_pci and 8250_pci1xxxx. With the changes from
> > > kernel 6.10 to 6.11 the underlying pcim_* functions where changed. The
> > > serial8250_pci_setup_port() does checks on pci_dev + BAR where resources were
> > > already mapped via pcim_iomap(), pci_iomap() or even pci_ioremap_bar(). Not
> > > sure if mixing this is a good idea after the kernel 6.11 changes.
> > >
> > > serial8250_pci_setup_port() uses pcim_iomap() and pcim_iomap_table() for checking
> > > these already mapped resources. But the pcim_iomap_table() is deprecated and
> > > suggests to use pcim_iomap() function to aquire the pointer to the resources
> > > while at the same time pcim_iomap() description states, don't use this function
> > > twice on the same BAR. I think the most sane approach would be to drop the
> > > pcim_iomap() and pcim_iomap_table() checks from the serial8250_pci_setup_port()
> > > function. But I can not fully test this, I only have access to some hardware
> > > used by the 8250_exar driver. I also CC Andy and Parker, both worked on the
> > > affected code.
> >
> > I'm on vacations right now and I lost context of this a long ago, please Cc me
> > to any new version of this change to have a fresh look.
>
> Hi Andy,
>
> there is not much to add here. It is basically a recursivly added issue and
> affects the three mentioned drivers. In my opinion it is safe to remove the
> pcim_iomap() and pcim_iomap_table() functions checks from the generic
> serial8250_pci_setup_port() function. To me it looks like the "newly"
> implemented pcim_iomap(), which should not be used twice on the same pci bar,
> is the only issue here. But I can only speak for the 8250_exar driver. We
> use the fix in productions systems and it solves the issue. But beyond that?
> To me the change of the pcim_iomap() looks like a design flaw in general,
> allowing io-mapping only one resource per pci bar looks odd to me, but I am
> not knowleged enough about these subsystems.
>
Hi All,
It looks like there are 2 issues in serial8250_pci_setup_port() after the
previously mentioned changes to the PCI core.
1. pcim_iomap() should only be called once per BAR
2. pcim_iomap_table() is deprecated
It seems like fixing serial8250_pci_setup_port() makes the most sense as the
deprecated code is in that function. This function is used in 8250_exar,
8250_pci, and 8250_pci1xxxx.
The fix would be to have pcim_iomap() called in probe prior to setting up the
ports. This is already done in 8250_exar and 8250_pci1xxxx but not in 8250_pci.
Then 8250_pci_setup_port() would need a new argument to pass the serial card's
BAR address. Or maybe add a "struct serial8250_pci_port" that wrappers
all the arguments?
Making these changes for 8250_pci1xxxx and 8250_exar would be trivial but
8250_pci will take some more effort.
I can try to get this done in the next few weeks if this makes sense to
everyone. I can test the 8250_exar driver and potentially can find a 8250_pci
based card but I don't think I have access to anything that uses 8250_pci1xxxx.
-Parker
next prev parent reply other threads:[~2025-08-13 13:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 8:17 [PATCH] tty: serial: 8250: exar: fix kernel warning in default_setup function Wilken Gottwalt
2025-07-29 8:48 ` Greg Kroah-Hartman
2025-07-29 9:32 ` Wilken Gottwalt
2025-07-30 11:03 ` Wilken Gottwalt
2025-08-05 21:34 ` Andy Shevchenko
2025-08-13 11:06 ` Wilken Gottwalt
2025-08-13 13:30 ` Parker Newman [this message]
2025-10-27 12:18 ` Andy Shevchenko
2025-10-27 12:31 ` Parker Newman
2025-10-27 14:33 ` Andy Shevchenko
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=20250813091900.7d4e4e89.parker@finest.io \
--to=parker@finest.io \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=pnewman@connecttech.com \
--cc=wilken.gottwalt@posteo.net \
/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