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

[PATCH v2 1/3] xen/uart: uniformly set ->ps_bdf_enable for all PCI serial devices


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 27 Mar 2026 14:54:18 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bhmHBEQUQsV67sJGN1j2fx0kLUU8zzBp+J69Zw8ktbA=; b=Ht1/9ru79fgMP5zfyG4oyj93khxvw5MuFXFDfM2nPUR9azKupcdyTWN3MYcNBmtHkMXyKBG1PS5sgBzm2OMuZBbPEpMCICDSaEmbLLpCOFW1VCaSNvhUBJnGYL1VGVAsSJRbK/HMNeuqrNX9l7SKKPE5B8rnFdXzi+44zDz9lNNpnEfEO2xcyt8X+WncolplbNIAraqjWMzEFpvQtchG5WcwRwlUsf5DjYtShZJLMS8/90A3eOZfPmAYEXSdrIFyNhUP26qcS0KRUQ63Kfku35ZIUreBujCWZOgP95jm4R3XrEgfALocXry7HHSok587e2VmJPoWXpb7LtIhBZlL3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aVhh2QX+IfrMB81zqosvz2AgZ8kClcAdXh+8N8BudTc3ZaPZJ5cUsozEVe/yeGIe+V7eSo240RfUKmzFnfr2SNbCmwuUqp39bfhS9dCUJlaQmQLfvikogv1uj1pFGDHbG9NL3iPPjQHnA/oJna7UdSEwti5AFuAF+o2VY+2Rge8k+Cd+xTGJ5SfXqeDAoRvircIYPB/i2zdngqya1lk8/y2n6dY56ZTnTRXUgAHVfiumM0dYLUmdtuRvhw0hRv7zXv8C5xTDuPQKDsnHJsk0/sq0UTwcvXrbXc3ZxfTAqvNLAmt3sxeOcTUqrs1/a1ATeGPN5B6I4GwiTV5rV/h7mg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 27 Mar 2026 13:55:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Auto-discovered serial PCI devices when using device=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>
---
Changes since v1:
 - New in this version.
---
 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 d384f1c69d2c..d05dc506ed9c 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -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),
@@ -1335,6 +1335,7 @@ pci_uart_config(struct ns16550 *uart, bool skip_amt, 
unsigned int idx)
                 if ( param->fifo_size )
                     uart->fifo_size = param->fifo_size;
 
+                uart->ps_bdf_enable = true;
                 uart->ps_bdf[0] = b;
                 uart->ps_bdf[1] = d;
                 uart->ps_bdf[2] = f;
-- 
2.51.0




 


Rackspace

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