From: Lukas Wunner <lukas@wunner.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Kobayashi,Daisuke" <kobayashi.da-06@fujitsu.com>,
kobayashi.da-06@jp.fujitsu.com, linux-cxl@vger.kernel.org,
y-goto@fujitsu.com, linux-pci@vger.kernel.org, mj@ucw.cz,
dan.j.williams@intel.com
Subject: Re: [PATCH v4 3/3] cxl/pci: Add sysfs attribute for CXL 1.1 device link status
Date: Wed, 10 Apr 2024 00:18:48 +0200 [thread overview]
Message-ID: <ZhW-yBR-u6DP9N3p@wunner.de> (raw)
In-Reply-To: <20240409150540.GA2076036@bhelgaas>
On Tue, Apr 09, 2024 at 10:05:40AM -0500, Bjorn Helgaas wrote:
> On Tue, Apr 09, 2024 at 04:35:28PM +0900, Kobayashi,Daisuke wrote:
> > Add sysfs attribute for CXL 1.1 device link status to the cxl pci device.
> >
> > In CXL1.1, the link status of the device is included in the RCRB mapped to
> > the memory mapped register area. Critically, that arrangement makes the link
> > status and control registers invisible to existing PCI user tooling.
>
> Idle thought: PCIe does define RCRB, even pre-CXL. Maybe the PCI core
> should be enhanced to comprehend RCRB directly?
The way CXL 1.1 (ab)uses the RCRB differs from what the PCIe Base Spec
envisions:
Per PCIe r6.2 sec 7.2.3, the RCRB contains additional Extended Capabilities
of a Root Port -- in addition to those in the Root Port's Config Space.
What we could do in the PCI core to support this is to amend our helpers
which search for Extended Capabilities to also search for them in the RCRB.
In fact, two years ago I cooked up a patch which does exactly that:
https://github.com/l1k/linux/commit/3eb94f042527
And I cooked up another patch to fetch the RCRB's address from the CXL
Early Discovery ACPI table:
https://github.com/l1k/linux/commit/d9d3cf45cf8c
The reason I never submitted the patches? I realized after the fact that
CXL 1.1 uses the RCRB in a completely different way:
Per CXL r3.0 sec 8.2.1, RCH Downstream and RCD Upstream Ports do not
actually possess a Config Space. Instead, they possess *only* an RCRB.
And that RCRB contains a Type 1 Configuration Space Header.
But because the PCIe Base Spec prescribes that there has to be an
Extended Capability at offset 0 of the RCRB, the CXL spec puts a
Null Extended Capability at offset 0 so that the Type 1 Config Space
Header is skipped.
However this means that the first dword of the Type 1 Config Space
Header does not contain a Vendor ID and Device ID.
So what we could do is create a fake pci_dev for each RCH Downstream and
RCD Upstream Port plus a specially crafted struct pci_ops whose ->read()
and write() callbacks access the RCRB. But how do we know which Vendor
and Device ID to return from a ->read()? There is none in the RCRB!
The CXL Consortium seems to have realized the mess they made with
CXL 1.1 and from CXL 2.0 onwards everything is now a proper PCI device.
I talked to Dan about my findings and his decision was basically to
not enable any of that legacy CXL 1.1 RCRB functionality in the kernel.
Thanks,
Lukas
next prev parent reply other threads:[~2024-04-09 22:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 7:35 [PATCH v4 0/3] cxl: Export cxl1.1 device link status to sysfs Kobayashi,Daisuke
2024-04-09 7:35 ` [PATCH v4 1/3] cxl: Add rcd_regs to cxl_rcrb_info Kobayashi,Daisuke
2024-04-09 19:08 ` Dave Jiang
2024-04-09 7:35 ` [PATCH v4 2/3] cxl/core/regs: Add rcd_regs initialization at __rcrb_to_component() Kobayashi,Daisuke
2024-04-09 19:15 ` Dave Jiang
2024-04-10 7:14 ` Daisuke Kobayashi (Fujitsu)
2024-04-09 7:35 ` [PATCH v4 3/3] cxl/pci: Add sysfs attribute for CXL 1.1 device link status Kobayashi,Daisuke
2024-04-09 15:05 ` Bjorn Helgaas
2024-04-09 18:04 ` Dan Williams
2024-04-09 22:18 ` Lukas Wunner [this message]
2024-04-09 21:33 ` Dan Williams
2024-04-09 21:47 ` Dan Williams
2024-04-10 7:22 ` Daisuke Kobayashi (Fujitsu)
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=ZhW-yBR-u6DP9N3p@wunner.de \
--to=lukas@wunner.de \
--cc=dan.j.williams@intel.com \
--cc=helgaas@kernel.org \
--cc=kobayashi.da-06@fujitsu.com \
--cc=kobayashi.da-06@jp.fujitsu.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mj@ucw.cz \
--cc=y-goto@fujitsu.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