xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices

Auto-discovered serial PCI devices when using dev=amt|pci won't get
->ps_bdf_enable, and as such some of the logic (like making sure the
respective BARs are enabled) won't be applied to them.

Fix by unconditionally setting ->ps_bdf_enable for all PCI serial devices,
and removing the special case that was done in some places by checking
whether the ->bar was set.  This also allows simplifying the logic in
pci_serial_early_init().

Fixes: 9738db88f6 ("xen: Automatically find serial port on PCI/PCIe and AMT devices.")
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Roger Pau Monne committed 2026-03-30 16:43:14 +02:00
1 parent ce023004c4
commit 4bf3336062
1 file changed
+6 -5
+6 -5
View File
@@ -283,7 +283,10 @@ static int cf_check ns16550_getc(struct serial_port *port, char *pc)
static void pci_serial_early_init(struct ns16550 *uart)
{
#ifdef NS16550_PCI
if ( uart->bar && uart->io_base >= 0x10000 )
if ( !uart->ps_bdf_enable )
return;
if ( uart->io_base >= 0x10000 )
{
pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
uart->ps_bdf[2]),
@@ -291,9 +294,6 @@ static void pci_serial_early_init(struct ns16550 *uart)
return;
}
if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
return;
if ( uart->pb_bdf_enable )
pci_conf_write16(PCI_SBDF(0, uart->pb_bdf[0], uart->pb_bdf[1],
uart->pb_bdf[2]),
@@ -440,7 +440,7 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud);
#ifdef NS16550_PCI
if ( uart->bar || uart->ps_bdf_enable )
if ( uart->ps_bdf_enable )
{
if ( uart->param && uart->param->mmio &&
rangeset_add_range(mmio_ro_ranges, PFN_DOWN(uart->io_base),
@@ -1338,6 +1338,7 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, unsigned int idx)
uart->ps_bdf[0] = b;
uart->ps_bdf[1] = d;
uart->ps_bdf[2] = f;
uart->ps_bdf_enable = true;
uart->bar_idx = bar_idx;
uart->bar = bar;
uart->bar64 = bar_64;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.