From: sashiko-bot@kernel.org
To: "Jose Ignacio Tornos Martinez" <jtornosm@redhat.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 2/3] PCI: Add device-specific reset for Qualcomm devices
Date: Tue, 02 Jun 2026 16:39:07 +0000 [thread overview]
Message-ID: <20260602163907.7A6281F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602160024.1171949-3-jtornosm@redhat.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] Missing Device Initialization and CRS Polling Wait in `pci_dev_d3cold_d0_cycle`
- [Medium] Commit message contradiction regarding IOMMU preparation
Pre-existing issues:
- [High] IOMMU and ATS unconditionally disrupted during sysfs `reset_method` capabilities probe
--
commit 8b985d62d4b41384aa769fbbb431c482aeb82ae9
Author: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
PCI: Add device-specific reset for Qualcomm devices
This patch adds device-specific reset methods for some Qualcomm PCIe devices
(ath11k, ath12k, SDX62/SDX65) that lack working reset methods for VFIO
passthrough. It introduces a shared pci_dev_d3cold_d0_cycle helper function
that attempts D3cold with automatic fallback to D3hot on platforms without
ACPI _PR3 power resources.
> Extract a shared pci_dev_d3cold_d0_cycle() helper function to avoid code
> duplication between pci_d3cold_reset() (strict _PR3 requirement) and the
> new reset_d3cold_d3hot() device-specific reset (automaticfallback). The
> helper handles IOMMU preparation, performs the power cycle via
> pci_set_power_state(), and cleans up IOMMU state.
[Severity: Medium]
The commit message states "The helper handles IOMMU preparation", but the
helper code documentation states "Caller must handle IOMMU preparation/cleanup
if needed" and leaves IOMMU handling to the caller. Could the commit message
be updated to reflect the implemented code logic?
[ ... ]
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 096868f80cd4c..f7a7443287fdf 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4491,6 +4491,32 @@ static int pci_pm_reset(struct pci_dev *dev, bool probe)
> return ret;
> }
>
> +/**
> + * pci_dev_d3cold_d0_cycle - Perform D3cold->D0 power cycle
> + * @dev: Device to power cycle
> + *
> + * Common helper to perform D3cold->D0 power cycle for reset methods.
> + * Attempts D3cold transition with automatic fallback to D3hot on platforms
> + * without ACPI _PR3 power resources.
> + *
> + * Caller must handle IOMMU preparation/cleanup if needed.
> + *
> + * Returns 0 on success, negative error code on failure.
> + */
> +int pci_dev_d3cold_d0_cycle(struct pci_dev *dev)
> +{
> + int ret;
> +
> + if (dev->current_state != PCI_D0)
> + return -EINVAL;
> +
> + ret = pci_set_power_state(dev, PCI_D3cold);
> + if (ret)
> + return ret;
> +
> + return pci_set_power_state(dev, PCI_D0);
> +}
[Severity: High]
Does this function need to wait for device readiness (CRS) before returning?
Unlike pci_pm_reset() which polls with pci_dev_wait(), this returns
immediately after the D3hot->D0 transition. Since this targets the endpoint
directly and bypasses bridge-level pci_bridge_wait_for_secondary_bus() delays,
if the device internally resets during the transition and returns CRS (0xFFFF),
will pci_set_full_power_state() incorrectly mask the state and return success
prematurely?
If so, could this cause subsequent configuration accesses by VFIO to fail while
the hardware is still initializing?
[ ... ]
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index caaed1a01dc02..2380a29970736 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -4237,6 +4237,22 @@ static int reset_hinic_vf_dev(struct pci_dev *pdev, bool probe)
> return 0;
> }
>
> +/*
> + * Device-specific reset method via D3cold/D3hot power cycle.
> + *
> + * Some devices lack working FLR, advertise NoSoftRst+ (blocking PM reset),
> + * and have broken bus reset. This function provides device-specific reset via
> + * power cycling, attempting D3cold with automatic fallback to D3hot on platforms
> + * without ACPI _PR3 power resources.
> + */
> +static int reset_d3cold_d3hot(struct pci_dev *dev, bool probe)
> +{
> + if (probe)
> + return 0;
> +
> + return pci_dev_d3cold_d0_cycle(dev);
> +}
[Severity: High]
This is a pre-existing issue, but since the commit message suggests overriding
via sysfs, will querying these reset methods cause IOMMU faults for running
devices?
When userspace reads or writes to /sys/bus/pci/devices/.../reset_method, the
kernel calls reset methods with probe = true. In __pci_dev_specific_reset(),
it unconditionally executes pci_dev_reset_iommu_prepare(dev) before checking
the probe flag:
drivers/pci/quirks.c:__pci_dev_specific_reset() {
...
ret = pci_dev_reset_iommu_prepare(dev);
if (ret)
return ret;
// then calls i->reset(dev, probe);
...
}
Since pci_dev_reset_iommu_prepare() temporarily tears down PASID domains and
halts translations, will querying the reset methods for an actively running
device like ath11k disrupt ongoing DMA operations and cause system crashes?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602160024.1171949-1-jtornosm@redhat.com?part=2
next prev parent reply other threads:[~2026-06-02 16:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 16:00 [PATCH v6 0/3] PCI: Add d3cold and device-specific reset for Qualcomm devices Jose Ignacio Tornos Martinez
2026-06-02 16:00 ` [PATCH v6 1/3] PCI: Add d3cold as general reset method Jose Ignacio Tornos Martinez
2026-06-02 16:18 ` sashiko-bot
2026-06-02 16:00 ` [PATCH v6 2/3] PCI: Add device-specific reset for Qualcomm devices Jose Ignacio Tornos Martinez
2026-06-02 16:39 ` sashiko-bot [this message]
2026-06-02 17:10 ` Jeff Johnson
2026-06-03 7:15 ` Jose Ignacio Tornos Martinez
2026-06-02 16:00 ` [PATCH v6 3/3] PCI: Disable broken bus reset on " Jose Ignacio Tornos Martinez
-- strict thread matches above, loose matches on Subject: below --
2026-06-03 10:58 [PATCH v7 0/3] PCI: Add d3cold and device-specific reset for " Jose Ignacio Tornos Martinez
2026-06-03 10:58 ` [PATCH v6 2/3] PCI: Add " Jose Ignacio Tornos Martinez
2026-06-03 11:39 ` 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=20260602163907.7A6281F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jtornosm@redhat.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.