From: Lukas Wunner <lukas@wunner.de>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org,
dan.j.williams@intel.com, ira.weiny@intel.com,
vishal.l.verma@intel.com, alison.schofield@intel.com,
Jonathan.Cameron@huawei.com, dave@stgolabs.net,
bhelgaas@google.com
Subject: Re: [PATCH 1/3] PCI: Add check for CXL Secondary Bus Reset
Date: Tue, 12 Mar 2024 08:30:37 +0100 [thread overview]
Message-ID: <ZfAEncKttj9qFQHw@wunner.de> (raw)
In-Reply-To: <20240311204132.62757-2-dave.jiang@intel.com>
On Mon, Mar 11, 2024 at 01:39:53PM -0700, Dave Jiang wrote:
> +static bool is_cxl_device(struct pci_dev *dev)
> +{
> + return pci_find_dvsec_capability(dev, PCI_DVSEC_VENDOR_ID_CXL,
> + CXL_DVSEC_PCIE_DEVICE);
> +}
If this was my bikeshed, I'd call it pci_is_cxl() to match pci_is_pcie().
> +static bool is_cxl_port_sbr_masked(struct pci_dev *dev)
> +{
> + int dvsec;
> + int rc;
> + u16 reg;
Nit: Inverse Christmas tree?
> static int pci_reset_bus_function(struct pci_dev *dev, bool probe)
> {
> int rc;
>
> + /* If it's a CXL port and the SBR control is masked, fail the SBR */
> + if (is_cxl_device(dev) && dev->bus->self &&
> + is_cxl_port_sbr_masked(dev->bus->self)) {
> + if (probe)
> + return 0;
> +
> + return -EPERM;
> + }
> +
Is this also necessary if CONFIG_CXL_PCI=n?
Return code on non-availability of a reset method is generally -ENOTTY.
Or is the choice deliberate to expose this reset method despite the bit
being set and thus allow user space to unmask it in the first place?
Also, we mostly use pci_upstream_bridge(dev) in lieu of dev->bus->self.
Is the choice to use the latter deliberate because maybe is_virtfn is
never set and the device can never be on the root bus? (What about
RCiEP CXL devices?)
Thanks,
Lukas
next prev parent reply other threads:[~2024-03-12 7:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 20:39 [PATCH 0/3] PCI: Add Secondary Bus Reset (SBR) support for CXL Dave Jiang
2024-03-11 20:39 ` [PATCH 1/3] PCI: Add check for CXL Secondary Bus Reset Dave Jiang
2024-03-12 7:30 ` Lukas Wunner [this message]
2024-03-12 21:35 ` Dave Jiang
2024-03-11 20:39 ` [PATCH 2/3] PCI: Create new reset method to force SBR for CXL Dave Jiang
2024-03-12 7:50 ` Lukas Wunner
2024-03-11 20:39 ` [PATCH 3/3] cxl: Add post reset warning if reset is detected as Secondary Bus Reset (SBR) Dave Jiang
2024-03-12 7:46 ` [PATCH 0/3] PCI: Add Secondary Bus Reset (SBR) support for CXL Lukas Wunner
2024-03-12 21:31 ` 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=ZfAEncKttj9qFQHw@wunner.de \
--to=lukas@wunner.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.