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

[PATCH] ns16550: correct name/value pair parsing for PCI port/bridge


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Mar 2023 08:50:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=SC8JjrPz6uqOyyhMgMFiAFkMiLXWPS32xD/kCYDQ6Us=; b=GcZ+2cXrbqawfheG5FfdglutgEDxA2MLrpQabo4iff8oqr/bolQTTu084lakZSv1FsbRJJDiMUuzbQ2PcnLvfLhzLCS9xoUO1pymqCxzut5PtB6lZmhAHajZsb0T2ngCqCK6tx1+B2TJn3T/Vz5fH17G8JeVqT7o3RhRRFfEmet5B0DmjoXsC0SD9VHJpwTNPTzyf59wTLjVIg4wwl2eZmq7z7yEidL7autCqIaRLXKHpVGdcFbaxEfq4ssfJ6rtIr3cWHqoZc87IgGynsn6N8KybOAVrZJpC0Xz8lQ6k+WkI8ihRG6KVuPHZ8xDeSDBVYRumHaob8aGKdeRzVbfKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g0nYBF8Y7ZxO88hnGgZV+GYYppJcP0ey9mWHIZpCd+HRIjs3JRQOpBKac4oX6Lvai1vnZ+y5P8P4kp9PVDzi5I6TtH5AEbxFYRZKyRuvQjAzhSMtlOOuYvYzy/weKRdYYdHVS1Kqf85mjhZlVSKCq/9m5FzgdVtve3uCiekuURKtxxzPaUcAUAmMPwk3+xmAdEJPP+cALloJsiMat8XDm/pVmYYq/GCUeQkARkwLj0OrePvFzmpHC56hz7hqVAP2H+L88qSJevarvp8NKwXfIhwjHAianzNoUDG44hkIHDo0vUDmOnjy1GiyK6HWyH9sNLfFSDi0qIR0UvnWxW9/UQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 29 Mar 2023 06:51:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

First of all these were inverted: "bridge=" caused the port coordinates
to be established, while "port=" controlled the bridge coordinates. And
then the error messages being identical also wasn't helpful. While
correcting this also move both case blocks close together.

Fixes: 97fd49a7e074 ("ns16550: add support for UART parameters to be specifed 
with name-value pairs")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
pci_serial_early_init() only dealing with I/O port variants is also
bogus, but that's a separate topic (which arguably would better be taken
care of by someone actually in the position of testing it). Additionally
I think it would be a good idea if the function left the bridge windows
alone if they're already configured suitably (perhaps with a wider
range).

_ns16550_resume() also doesn't care about configuring the bridge
correctly.

It further looks to be a shortcoming that pci_uart_config() doesn't
determine the bridge behind which the selected device may be located
(let alone a hierarchy of bridges).

--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1631,13 +1631,6 @@ static bool __init parse_namevalue_pairs
             break;
 
 #ifdef CONFIG_HAS_PCI
-        case bridge_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
-                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
-            uart->ps_bdf_enable = true;
-            break;
-
         case device:
             if ( strncmp(param_value, "pci", 3) == 0 )
             {
@@ -1652,9 +1645,16 @@ static bool __init parse_namevalue_pairs
             break;
 
         case port_bdf:
+            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
+                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
+                PARSE_ERR_RET("Bad port PCI coordinates\n");
+            uart->ps_bdf_enable = true;
+            break;
+
+        case bridge_bdf:
             if ( !parse_pci(param_value, NULL, &uart->pb_bdf[0],
                             &uart->pb_bdf[1], &uart->pb_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
+                PARSE_ERR_RET("Bad bridge PCI coordinates\n");
             uart->pb_bdf_enable = true;
             break;
 #endif



 


Rackspace

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