[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.20] xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices



commit c2cb923ed7680b8ca7d5754a961635ecffff3c59
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Apr 20 12:34:34 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 20 12:34:34 2026 +0200

    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: 9738db88f68f ("xen: Automatically find serial port on PCI/PCIe and 
AMT devices.")
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 4bf33360623d9d59c8e7a49b70308c1b58d4d772
    master date: 2026-03-30 16:43:14 +0200
---
 xen/drivers/char/ns16550.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 77acc188d9..1dce415cb2 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -273,7 +273,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]),
@@ -281,9 +284,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]),
@@ -428,7 +428,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),
@@ -1320,6 +1320,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;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.