lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220831081603.3415-13-rrichter@amd.com>
Date:   Wed, 31 Aug 2022 10:16:00 +0200
From:   Robert Richter <rrichter@....com>
To:     Alison Schofield <alison.schofield@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Ira Weiny <ira.weiny@...el.com>,
        Ben Widawsky <bwidawsk@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>
CC:     <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>, Robert Richter <rrichter@....com>
Subject: [PATCH 12/15] cxl/acpi: Skip devm_cxl_port_enumerate_dports() when in RCD mode

RCD mode has a different enumeration scheme other than in CXL VH mode.
An RCD is directly connected to an RCH without downstream and upstream
ports showing up in between in the PCI hierarchy. Skip dport
enumeration for RCHs. Upstream and downstream ports of RCH and RCD
will be setup separately in a later patch.

Introduce the function is_rch_uport() to detect an RCH port. For RCHs
the parent root port is not the "ACPI0017" device and instead does not
have a fw node connected to it.

Signed-off-by: Robert Richter <rrichter@....com>
---
 drivers/cxl/core/pci.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index 0dbbe8d39b07..86ed112eb262 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -65,6 +65,15 @@ static int match_add_dports(struct pci_dev *pdev, void *data)
 	return 0;
 }
 
+/*
+ * A parent of an RCH (CXL 1.1 host) is a plain platform device while
+ * a 2.0 host links to the ACPI0017 root device.
+ */
+static inline bool is_rch_uport(struct cxl_port *port)
+{
+	return is_cxl_port(&port->dev) && !port->dev.parent->fwnode;
+}
+
 /**
  * devm_cxl_port_enumerate_dports - enumerate downstream ports of the upstream port
  * @port: cxl_port whose ->uport is the upstream of dports to be enumerated
@@ -74,10 +83,19 @@ static int match_add_dports(struct pci_dev *pdev, void *data)
  */
 int devm_cxl_port_enumerate_dports(struct cxl_port *port)
 {
-	struct pci_bus *bus = cxl_port_to_pci_bus(port);
+	struct pci_bus *bus;
 	struct cxl_walk_context ctx;
 	int type;
 
+	/*
+	 * Skip enumeration in Restricted CXL Device mode as the
+	 * device has been already registered at the host's dport
+	 * during host discovery.
+	 */
+	if (is_rch_uport(port))
+		return 0;
+
+	bus = cxl_port_to_pci_bus(port);
 	if (!bus)
 		return -ENXIO;
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ