From: sashiko-bot@kernel.org
To: "Srirangan Madhavan" <smadhavan@nvidia.com>
Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v13 14/15] PCI/CXL: Expose CXL Reset as a PCI reset method
Date: Tue, 22 Sep 2026 09:02:55 +0000 [thread overview]
Message-ID: <20260922090255.805311F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260922083924.2451158-15-smadhavan@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] PCI/CXL: unsafe fallback to FLR on cxl_reset safety check failure
- [High] PCI/CXL: cxl_reset rejected during probe if features disabled
--
commit a3dd9319808c6b4394c9a465a0ccd99ba52161a2
Author: Srirangan Madhavan <smadhavan@nvidia.com>
PCI/CXL: Expose CXL Reset as a PCI reset method
This commit registers cxl_reset with the PCI reset-method interface, placing
it before FLR. It adds capability and state checks to ensure the device
supports and is configured for CXL cache and memory protocols. It also
returns -ENOTTY when the device capabilities or required cache
synchronization do not permit a safe reset.
> diff --git a/drivers/cxl/core/resource.c b/drivers/cxl/core/resource.c
> --- a/drivers/cxl/core/resource.c
> +++ b/drivers/cxl/core/resource.c
> @@ ... @@
> int cxl_reset_function(struct pci_dev *pdev, bool probe)
> {
> int dvsec, rc;
> u16 cap, ctrl;
>
> [ ... ]
>
> if (!(cap & PCI_DVSEC_CXL_CACHE_CAPABLE) ||
> !(cap & PCI_DVSEC_CXL_MEM_CAPABLE) ||
> !(cap & PCI_DVSEC_CXL_RST_CAPABLE) ||
> !(cap & PCI_DVSEC_CXL_RST_MEM_CLR_CAPABLE))
> return -ENOTTY;
[Severity: High]
Does returning -ENOTTY here cause the PCI core to silently fall back to FLR
during an actual reset request?
Type 3 devices (memory expanders) lack CXL.cache capabilities, so they would
fail this check. If they fall back to FLR, it resets the PCIe state but not
the CXL protocol state. For devices with active CXL memory, this might lead
to Machine Check Exceptions or memory corruption when the CPU interacts with
the reset device.
Would returning a hard error like -EOPNOTSUPP during execution safely abort
the unsafe reset?
>
> rc = pci_read_config_word(pdev, dvsec + PCI_DVSEC_CXL_CTRL, &ctrl);
> if (rc)
> - return pcibios_err_to_errno(rc);
> + return probe ? -ENOTTY : pcibios_err_to_errno(rc);
> if (PCI_POSSIBLE_ERROR(ctrl))
> - return -ENODEV;
> + return probe ? -ENOTTY : -ENODEV;
> if (!(ctrl & PCI_DVSEC_CXL_CACHE_ENABLE) ||
> !(ctrl & PCI_DVSEC_CXL_MEM_ENABLE))
> return -ENOTTY;
[Severity: High]
Does evaluating this dynamic state during probe permanently exclude the
reset method before the driver can enable the features?
When pci_init_reset_methods() calls cxl_reset_function() with probe == true
during early device discovery, returning -ENOTTY causes the PCI core to omit
this method entirely from the supported reset methods.
If this check evaluates dynamic state before the early-return for probe, it
might cause hot-plugged devices to silently fall back to FLR when a reset
is later requested. Could this check be moved after the if (probe)
early-return?
>
> [ ... ]
>
> if (probe)
> return 0;
>
> [ ... ]
>
> if (!cpu_cache_has_invalidate_memregion())
> return -ENOTTY;
[Severity: High]
Similar to the capability check above, does returning -ENOTTY here fail to
safely abort the reset?
Since the PCI framework interprets -ENOTTY as "method not applicable, try
next", this causes a fallback to the unsafe FLR method. Would returning a
hard error prevent this unsafe fallback?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922083924.2451158-1-smadhavan@nvidia.com?part=14
next prev parent reply other threads:[~2026-09-22 9:02 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 8:39 [PATCH v13 00/15] PCI/CXL: Add CXL reset support for Type 2 devices Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 01/15] cxl: Drop stale decoder interleave limit comment Srirangan Madhavan
2026-09-22 8:41 ` sashiko-bot
2026-09-24 1:16 ` Jonathan Cameron
2026-09-24 16:23 ` Dave Jiang
2026-09-22 8:39 ` [PATCH v13 02/15] cxl: Share CXL port upstream PCI device lookup Srirangan Madhavan
2026-09-22 8:47 ` sashiko-bot
2026-09-23 21:39 ` Cheatham, Benjamin
2026-09-24 1:21 ` Jonathan Cameron
2026-09-24 16:55 ` Dave Jiang
2026-10-01 22:33 ` Srirangan Madhavan
2026-09-24 1:22 ` Jonathan Cameron
2026-10-01 22:28 ` Srirangan Madhavan
2026-09-24 17:01 ` Dave Jiang
2026-09-22 8:39 ` [PATCH v13 03/15] cxl: Move HDM decoder programming helpers Srirangan Madhavan
2026-09-22 8:50 ` sashiko-bot
2026-09-24 1:29 ` Jonathan Cameron
2026-10-01 23:40 ` Srirangan Madhavan
2026-09-24 17:02 ` Dave Jiang
2026-09-22 8:39 ` [PATCH v13 04/15] cxl: Move decoder declarations to shared header Srirangan Madhavan
2026-09-22 8:48 ` sashiko-bot
2026-09-24 1:31 ` Jonathan Cameron
2026-09-24 17:03 ` Dave Jiang
2026-09-22 8:39 ` [PATCH v13 05/15] cxl: Introduce reusable HDM decoder settings Srirangan Madhavan
2026-09-22 8:47 ` sashiko-bot
2026-09-23 21:39 ` Cheatham, Benjamin
2026-09-24 1:35 ` Jonathan Cameron
2026-10-01 22:43 ` Srirangan Madhavan
2026-09-24 2:45 ` Jonathan Cameron
2026-10-01 23:42 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 06/15] cxl: Make HDM reset helpers available to built-in PCI code Srirangan Madhavan
2026-09-22 8:54 ` sashiko-bot
2026-09-23 21:40 ` Cheatham, Benjamin
2026-09-24 2:49 ` Jonathan Cameron
2026-10-01 22:46 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 07/15] cxl: Share HDM decoder register unpacking Srirangan Madhavan
2026-09-22 8:55 ` sashiko-bot
2026-09-24 3:05 ` Jonathan Cameron
2026-10-01 23:52 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 08/15] cxl: Refresh cached PCI HDM decoder settings Srirangan Madhavan
2026-09-22 8:47 ` sashiko-bot
2026-09-23 21:40 ` Cheatham, Benjamin
2026-10-01 22:58 ` Srirangan Madhavan
2026-09-24 3:08 ` Jonathan Cameron
2026-09-22 8:39 ` [PATCH v13 09/15] cxl: Cache endpoint HDM state during PCI enumeration Srirangan Madhavan
2026-09-22 8:54 ` sashiko-bot
2026-09-23 21:40 ` Cheatham, Benjamin
2026-10-01 23:14 ` Srirangan Madhavan
2026-09-24 3:36 ` Jonathan Cameron
2026-10-01 23:55 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 10/15] cxl: Add CXL Device Reset sequencing Srirangan Madhavan
2026-09-22 8:49 ` sashiko-bot
2026-09-23 21:40 ` Cheatham, Benjamin
2026-09-24 17:29 ` Dave Jiang
2026-10-01 23:36 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 11/15] cxl: Validate and synchronize HDM ranges around reset Srirangan Madhavan
2026-09-22 8:51 ` sashiko-bot
2026-09-23 21:40 ` Cheatham, Benjamin
2026-10-01 23:25 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 12/15] PCI/CXL: Reject reset with unsafe function scope Srirangan Madhavan
2026-09-22 8:56 ` sashiko-bot
2026-09-23 21:41 ` Cheatham, Benjamin
2026-09-24 17:33 ` Dave Jiang
2026-09-22 8:39 ` [PATCH v13 13/15] cxl: Restore CXL state after PCI reset Srirangan Madhavan
2026-09-22 8:55 ` sashiko-bot
2026-09-24 3:50 ` Jonathan Cameron
2026-10-01 23:58 ` Srirangan Madhavan
2026-09-22 8:39 ` [PATCH v13 14/15] PCI/CXL: Expose CXL Reset as a PCI reset method Srirangan Madhavan
2026-09-22 9:02 ` sashiko-bot [this message]
2026-09-22 8:39 ` [PATCH v13 15/15] PCI/CXL: Restore CXL state after CXL bus reset Srirangan Madhavan
2026-09-22 9:01 ` sashiko-bot
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=20260922090255.805311F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-cxl@vger.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