From: sashiko-bot@kernel.org
To: "Srirangan Madhavan" <smadhavan@nvidia.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 4/9] PCI/CXL: Add sibling function coordination for reset
Date: Thu, 28 May 2026 10:41:50 +0000 [thread overview]
Message-ID: <20260528104150.8C5781F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260528083154.137979-5-smadhavan@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incorrect bit indexing when checking the Non-CXL Function Map DVSEC for non-ARI devices.
--
commit b310856ad85d3fc081d86a4d5ea3b158b15fce9f
Author: Srirangan Madhavan <smadhavan@nvidia.com>
PCI/CXL: Add sibling function coordination for reset
This commit adds helpers to collect CXL sibling PCI functions affected by a
CXL reset and prepares them by saving and disabling them. It uses the
Non-CXL Function Map DVSEC to filter out non-CXL functions and functions
without CXL.cache or CXL.mem capabilities.
> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index 318744695f628..01effbb4e7cd1 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
[ ... ]
> @@ -1096,3 +1102,204 @@ cxl_reset_flush_cpu_caches(struct cxl_reset_region_context *ctx)
[ ... ]
> +static bool cxl_reset_is_cxl_sibling(struct pci_dev *pdev,
> + struct pci_dev *sibling,
> + unsigned long *non_cxl_func_map)
> +{
> + if (sibling == pdev || sibling->bus != pdev->bus)
> + return false;
> +
> + if (pci_ari_enabled(pdev->bus))
> + return !test_bit(sibling->devfn, non_cxl_func_map);
> +
> + if (PCI_SLOT(sibling->devfn) != PCI_SLOT(pdev->devfn))
> + return false;
> +
> + return !test_bit(PCI_FUNC(sibling->devfn) * 32 +
> + PCI_SLOT(sibling->devfn), non_cxl_func_map);
[Severity: High]
Does this formula correctly index the Non-CXL Function Map for non-ARI
devices?
For a non-ARI device, the function map typically uses bits 0-7 to represent
functions 0-7. With this formula, a sibling at function 0 and slot 2 will
evaluate to bit 2 (0 * 32 + 2) instead of bit 0.
If bit 2 happens to be set (indicating function 2 is non-CXL), function 0
could be incorrectly identified as a non-CXL function and excluded from the
reset coordination.
Will this cause the skipped function to miss having its state saved and
IOMMU blocked, potentially leading to lost configuration state, unhandled
IOMMU faults, or driver crashes during the reset?
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260528083154.137979-1-smadhavan@nvidia.com?part=4
next prev parent reply other threads:[~2026-05-28 10:41 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 8:31 [PATCH v6 0/9] cxl: Add cxl_reset sysfs attribute for memdevs Srirangan Madhavan
2026-05-28 8:31 ` [PATCH v6 1/9] cxl/hdm: Add helpers to restore and commit memdev decoders Srirangan Madhavan
2026-05-28 9:12 ` sashiko-bot
2026-05-28 11:06 ` Richard Cheng
2026-06-02 18:12 ` Dave Jiang
2026-06-02 18:31 ` Dave Jiang
2026-06-02 20:34 ` Cheatham, Benjamin
2026-06-03 22:35 ` Dan Williams (nvidia)
2026-05-28 8:31 ` [PATCH v6 2/9] PCI: Export pci_dev_save_and_disable() and pci_dev_restore() Srirangan Madhavan
2026-06-02 20:18 ` Dave Jiang
2026-06-03 22:36 ` Dan Williams (nvidia)
2026-05-28 8:31 ` [PATCH v6 3/9] cxl: Add reset-idle and cache flush helpers Srirangan Madhavan
2026-05-28 10:09 ` sashiko-bot
2026-06-02 20:34 ` Cheatham, Benjamin
2026-06-02 20:36 ` Dave Jiang
2026-06-04 2:49 ` Dan Williams (nvidia)
2026-05-28 8:31 ` [PATCH v6 4/9] PCI/CXL: Add sibling function coordination for reset Srirangan Madhavan
2026-05-28 10:41 ` sashiko-bot [this message]
2026-05-28 11:15 ` Richard Cheng
2026-06-02 22:10 ` Dave Jiang
2026-06-04 3:13 ` Dan Williams (nvidia)
2026-05-28 8:31 ` [PATCH v6 5/9] cxl/pci: Add CXL DVSEC reset helper Srirangan Madhavan
2026-05-28 11:05 ` sashiko-bot
2026-06-02 20:34 ` Cheatham, Benjamin
2026-05-28 8:31 ` [PATCH v6 6/9] cxl/pci: Track memdevs affected by CXL reset Srirangan Madhavan
2026-05-28 11:36 ` sashiko-bot
2026-06-02 20:34 ` Cheatham, Benjamin
2026-05-28 8:31 ` [PATCH v6 7/9] cxl/pci: Orchestrate CXL reset for affected memdevs Srirangan Madhavan
2026-05-28 12:25 ` sashiko-bot
2026-06-02 20:34 ` Cheatham, Benjamin
2026-06-04 3:25 ` Dan Williams (nvidia)
2026-05-28 8:31 ` [PATCH v6 8/9] cxl/memdev: Add cxl_reset sysfs attribute Srirangan Madhavan
2026-05-28 13:03 ` sashiko-bot
2026-06-02 21:35 ` Cheatham, Benjamin
2026-06-02 23:50 ` Dave Jiang
2026-05-28 8:31 ` [PATCH v6 9/9] Documentation/ABI: Document CXL memdev cxl_reset Srirangan Madhavan
2026-06-03 0:11 ` Dave Jiang
2026-06-02 20:34 ` [PATCH v6 0/9] cxl: Add cxl_reset sysfs attribute for memdevs Cheatham, Benjamin
2026-06-02 21:42 ` Dan Williams (nvidia)
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=20260528104150.8C5781F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=smadhavan@nvidia.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