From: Robert Richter <rrichter@amd.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, dave@stgolabs.net,
jonathan.cameron@huawei.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com,
dan.j.williams@intel.com
Subject: Re: [PATCH v8 05/11] cxl: Defer dport allocation for switch ports
Date: Tue, 26 Aug 2025 09:51:36 +0200 [thread overview]
Message-ID: <aK1niOntTRwwZhhv@rric.localdomain> (raw)
In-Reply-To: <0d4c1766-d966-43bd-abec-b1a8a4592a1b@intel.com>
On 22.08.25 08:52:39, Dave Jiang wrote:
>
>
> On 8/22/25 2:59 AM, Robert Richter wrote:
> > On 20.08.25 08:20:04, Dave Jiang wrote:
> >> On 8/20/25 5:41 AM, Robert Richter wrote:
> >>> Hi Dave,
> >>>
> >>> see my comments below.
> >>>
> >>> On 14.08.25 15:21:45, Dave Jiang wrote:
> >>
> >> <--snip-->
> >>
> >>>> + if (IS_ERR(new_dport))
> >>>> + return new_dport;
> >>>> +
> >>>> + cxl_switch_parse_cdat(port);
> >>>> +
> >>>> + /*
> >>>> + * First instance of dport appearing, need to setup the port, including
> >>>> + * allocating decoders.
> >>>> + */
> >>>> + if (port->nr_dports == 1) {
> >>>> + rc = cxl_switch_port_setup(port);
> >>>
> >>> Can't this be done with port creation? I don't see a reason doing this
> >>> late at this point.
> >>
> >
> >> The main reason we are doing this is to move the port register
> >> probing until we know the CXL link is established. Otherwise when
> >> cxl_acpi does probe and calls add_host_bridge_uport(), that
> >> devm_cxl_add_port() can trigger errors if the platform BIOS enables
> >> PCI hotplug support on Intel platforms. The error messages "cxl
> >> portN: Couldn't locate the CXL.cache and CXL.mem capability array
> >> header" is observed. Essentially we can be trying to map registers
> >> while DVSEC ID 3 and/or 7 has not appeared yet. And in turn because
> >> that got pushed out, so did the decoder enumeration.
> >
> > The code suggests the Component Registers of the CXL Host Bridge are
> > not yet ready. Is this delayed after the first Root Port is connected
> > to a CXL Endpoint/Switch? PCIe DVSEC ID 3 and 7
> > (CXL_DVSEC_PORT_EXTENSIONS, CXL_DVSEC_PCIE_FLEXBUS_PORT) are part of
> > the pcie config space, which is enumerated not before a CXL endpoint
> > becomes active. I haven't found a spec refs here. Please explain.
>
> So the behavior is observed when PCIe hotplug support is turned on
> in BIOS for the Intel platform. A CXL device is plugged in to a RP
> without CXL switches. The thinking is that the CXL link is not fully
> established at the time when cxl_acpi_probe() is running and the
> ports are being added. And the only way to 100% be sure the link is
> established is when we are enumerating the memdev just like the
> dports. Not sure what spec ref are you looking for. Table 8-2
> indicates that those 2 DVSECs are mandatory for CXL root ports. Lack
> of presence means either the RP isn't CXL or the CXL link isn't
> established yet. I would assume this would also be true if a CXL
> memdev is hot-plugged into a slot post boot.
But add_host_bridge_uport() only creates ports for the host bridge
(ACPI0016) devices and enumerates their component registers (CHBCR).
The root ports are being added already late as those are part of the
pci hierarchy. The root ports are discovered in
devm_cxl_enumerate_ports() not earlier than the mem_dev is probed.
devm_cxl_add_memdev() is called once the endpoint is probed and the
CXL link is up.
That is, function cxl_port_get_or_add_dport() in add_port_attach_ep
should only add the dport. Then, a retry in the enumeration loop will
be triggered and the cxl_port for the root port is added. No explicit
call of cxl_switch_port_setup() should be needed, it can be done
during cxl_port_probe(). All done late after the endpoint was found.
-Robert
next prev parent reply other threads:[~2025-08-26 7:51 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 22:21 [PATCH v8 00/11] cxl: Delay HB port and switch dport probing until endpoint dev probe Dave Jiang
2025-08-14 22:21 ` [PATCH v8 01/11] cxl: Add helper to detect top of CXL device topology Dave Jiang
2025-08-15 12:50 ` Jonathan Cameron
2025-08-20 13:51 ` Robert Richter
2025-08-14 22:21 ` [PATCH v8 02/11] cxl: Add helper to reap dport Dave Jiang
2025-08-20 14:10 ` Robert Richter
2025-08-20 20:54 ` Dave Jiang
2025-08-14 22:21 ` [PATCH v8 03/11] cxl: Add a cached copy of target_map to cxl_decoder Dave Jiang
2025-08-15 12:52 ` Jonathan Cameron
2025-08-20 14:17 ` Robert Richter
2025-08-14 22:21 ` [PATCH v8 04/11] cxl: Move port register setup to first dport appear Dave Jiang
2025-08-15 12:57 ` Jonathan Cameron
2025-08-21 11:57 ` Robert Richter
2025-08-22 10:37 ` Robert Richter
2025-08-14 22:21 ` [PATCH v8 05/11] cxl: Defer dport allocation for switch ports Dave Jiang
2025-08-20 12:41 ` Robert Richter
2025-08-20 15:20 ` Dave Jiang
2025-08-22 9:59 ` Robert Richter
2025-08-22 15:52 ` Dave Jiang
2025-08-26 7:51 ` Robert Richter [this message]
2025-08-27 17:05 ` Dave Jiang
2025-08-29 15:02 ` Robert Richter
2025-08-29 17:23 ` Dave Jiang
2025-09-01 14:48 ` Robert Richter
2025-09-02 15:58 ` Dave Jiang
2025-08-27 21:15 ` Dave Jiang
2025-09-01 17:29 ` Robert Richter
2025-09-02 15:40 ` Dave Jiang
2025-09-03 18:21 ` Dave Jiang
2025-08-27 21:37 ` Dave Jiang
2025-08-14 22:21 ` [PATCH v8 06/11] cxl/test: Add cxl_test support for cxl_port_get_possible_dports() Dave Jiang
2025-08-14 22:21 ` [PATCH v8 07/11] cxl/test: Add mock version of devm_cxl_add_dport_by_dev() Dave Jiang
2025-08-14 22:21 ` [PATCH v8 08/11] cxl/test: Add support to cxl_test for decoder enumeration mock functions Dave Jiang
2025-08-14 22:21 ` [PATCH v8 09/11] cxl/test: Setup target_map for cxl_test decoder initialization Dave Jiang
2025-08-15 13:04 ` Jonathan Cameron
2025-08-14 22:21 ` [PATCH v8 10/11] cxl: Change sslbis handler to only handle single dport Dave Jiang
2025-08-14 22:21 ` [PATCH v8 11/11] tools/testing/cxl: Add decoder save/restore support Dave Jiang
2025-08-15 13:15 ` Jonathan Cameron
2025-08-19 9:39 ` [PATCH v8 00/11] cxl: Delay HB port and switch dport probing until endpoint dev probe Robert Richter
2025-08-19 15:41 ` Dave Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aK1niOntTRwwZhhv@rric.localdomain \
--to=rrichter@amd.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox