* [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device
@ 2026-11-23 21:53 Farhan Ali
2026-11-23 22:50 ` Bjorn Helgaas
0 siblings, 1 reply; 4+ messages in thread
From: Farhan Ali @ 2026-11-23 21:53 UTC (permalink / raw)
To: linux-pci, linux-kernel, bhelgaas
Cc: lukas, alifm, mjrosato, gbayer, schnelle
The Samsung NVMe SSD Controller PM174x [144d:a826] advertises Immediate
Readiness, so pcie_flr() doesn't wait after FLR, but the device isn't ready
yet and config reads return ~0 after the reset. This happens with
firmware version SNA6SNA6 or older.
This was seen on s390x with the nvme driver bound, by resetting the device
via the sysfs reset attribute:
# echo 1 > /sys/bus/pci/devices/200c:00:00.0/reset
nvme 200c:00:00.0: Unable to change power state from D3cold to D0, device inaccessible
nvme nvme0: Disabling device after reset failure: -19
Ignore Immediate Readiness on this device too, so pcie_flr() waits.
Fixes: 10baa9b4df40 ("PCI: Drop unnecessary retries when restoring BARs")
Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
---
drivers/pci/quirks.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 4a02fc80755d..11c3b45afe78 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5790,6 +5790,7 @@ static void quirk_no_imm_ready(struct pci_dev *dev)
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80c, quirk_no_imm_ready);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80d, quirk_no_imm_ready);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80e, quirk_no_imm_ready);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa826, quirk_no_imm_ready);
static void quirk_no_ext_tags(struct pci_dev *pdev)
{
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device
2026-11-23 21:53 [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device Farhan Ali
@ 2026-11-23 22:50 ` Bjorn Helgaas
2026-11-24 10:24 ` Niklas Schnelle
2026-11-24 17:59 ` Farhan Ali
0 siblings, 2 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2026-11-23 22:50 UTC (permalink / raw)
To: Farhan Ali
Cc: linux-pci, linux-kernel, bhelgaas, lukas, mjrosato, gbayer,
schnelle, Kanchan Joshi, Nitesh Shetty, Judy Brock
[+cc Kanchan, Nitesh, Judy (scraped from lore Samsung NVMe traffic)]
On Mon, Nov 23, 2026 at 01:53:08PM -0800, Farhan Ali wrote:
> The Samsung NVMe SSD Controller PM174x [144d:a826] advertises Immediate
> Readiness, so pcie_flr() doesn't wait after FLR, but the device isn't ready
> yet and config reads return ~0 after the reset. This happens with
> firmware version SNA6SNA6 or older.
>
> This was seen on s390x with the nvme driver bound, by resetting the device
> via the sysfs reset attribute:
>
> # echo 1 > /sys/bus/pci/devices/200c:00:00.0/reset
>
> nvme 200c:00:00.0: Unable to change power state from D3cold to D0, device inaccessible
> nvme nvme0: Disabling device after reset failure: -19
>
> Ignore Immediate Readiness on this device too, so pcie_flr() waits.
>
> Fixes: 10baa9b4df40 ("PCI: Drop unnecessary retries when restoring BARs")
> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
> ---
> drivers/pci/quirks.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 4a02fc80755d..11c3b45afe78 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -5790,6 +5790,7 @@ static void quirk_no_imm_ready(struct pci_dev *dev)
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80c, quirk_no_imm_ready);
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80d, quirk_no_imm_ready);
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80e, quirk_no_imm_ready);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa826, quirk_no_imm_ready);
We already have:
996a59519af2 ("PCI: Ignore Immediate Readiness on Samsung PM9D3a NVMe")
0f8b5d90d179 ("PCI: Ignore Immediate Readiness on Samsung 990 PRO and 990 EVO Plus NVMe")
I wonder if something like the below might be safer and avoid an
ongoing series of quirks.
The spec (PCIe r7.0, sec 7.5.1.1.4) says that when Immediate Readiness
is set, "the Function is guaranteed to be ready to successfully
complete valid Configuration Requests at any time" and "software is
exempt from all requirements to *delay configuration accesses*
following any type of reset."
I thought that meant Completions for config requests would always have
Successful Completion status, but I guess one could read it as "device
must respond with a Completion to an access immediately after reset,
even if the Completion is RRS."
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7c6f2aba8144..c9f95852e83d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4457,15 +4457,13 @@ int pcie_flr(struct pci_dev *dev)
pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
- if (dev->imm_ready)
- goto done;
-
/*
* Per PCIe r4.0, sec 6.6.2, a device must complete an FLR within
* 100ms, but may silently discard requests while the FLR is in
* progress. Wait 100ms before trying to access the device.
*/
- msleep(100);
+ if (!dev->imm_ready)
+ msleep(100);
ret = pci_dev_wait(dev, "FLR", PCIE_RESET_READY_POLL_MS);
done:
@@ -4534,16 +4532,14 @@ static int pci_af_flr(struct pci_dev *dev, bool probe)
pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
- if (dev->imm_ready)
- goto done;
-
/*
* Per Advanced Capabilities for Conventional PCI ECN, 13 April 2006,
* updated 27 July 2006; a device must complete an FLR within
* 100ms, but may silently discard requests while the FLR is in
* progress. Wait 100ms before trying to access the device.
*/
- msleep(100);
+ if (!dev->imm_ready)
+ msleep(100);
ret = pci_dev_wait(dev, "AF_FLR", PCIE_RESET_READY_POLL_MS);
done:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device
2026-11-23 22:50 ` Bjorn Helgaas
@ 2026-11-24 10:24 ` Niklas Schnelle
2026-11-24 17:59 ` Farhan Ali
1 sibling, 0 replies; 4+ messages in thread
From: Niklas Schnelle @ 2026-11-24 10:24 UTC (permalink / raw)
To: Bjorn Helgaas, Farhan Ali
Cc: linux-pci, linux-kernel, bhelgaas, lukas, mjrosato, gbayer,
Kanchan Joshi, Nitesh Shetty, Judy Brock
On Mon, 2026-11-23 at 16:50 -0600, Bjorn Helgaas wrote:
> [+cc Kanchan, Nitesh, Judy (scraped from lore Samsung NVMe traffic)]
>
> On Mon, Nov 23, 2026 at 01:53:08PM -0800, Farhan Ali wrote:
> > The Samsung NVMe SSD Controller PM174x [144d:a826] advertises Immediate
> > Readiness, so pcie_flr() doesn't wait after FLR, but the device isn't ready
> > yet and config reads return ~0 after the reset. This happens with
> > firmware version SNA6SNA6 or older.
> >
> > This was seen on s390x with the nvme driver bound, by resetting the device
> > via the sysfs reset attribute:
> >
> > # echo 1 > /sys/bus/pci/devices/200c:00:00.0/reset
> >
> > nvme 200c:00:00.0: Unable to change power state from D3cold to D0, device inaccessible
> > nvme nvme0: Disabling device after reset failure: -19
> >
> > Ignore Immediate Readiness on this device too, so pcie_flr() waits.
> >
> > Fixes: 10baa9b4df40 ("PCI: Drop unnecessary retries when restoring BARs")
> > Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
> > ---
> > drivers/pci/quirks.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index 4a02fc80755d..11c3b45afe78 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -5790,6 +5790,7 @@ static void quirk_no_imm_ready(struct pci_dev *dev)
> > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80c, quirk_no_imm_ready);
> > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80d, quirk_no_imm_ready);
> > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80e, quirk_no_imm_ready);
> > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa826, quirk_no_imm_ready);
>
> We already have:
>
> 996a59519af2 ("PCI: Ignore Immediate Readiness on Samsung PM9D3a NVMe")
> 0f8b5d90d179 ("PCI: Ignore Immediate Readiness on Samsung 990 PRO and 990 EVO Plus NVMe")
>
> I wonder if something like the below might be safer and avoid an
> ongoing series of quirks.
>
> The spec (PCIe r7.0, sec 7.5.1.1.4) says that when Immediate Readiness
> is set, "the Function is guaranteed to be ready to successfully
> complete valid Configuration Requests at any time" and "software is
> exempt from all requirements to *delay configuration accesses*
> following any type of reset."
>
> I thought that meant Completions for config requests would always have
> Successful Completion status, but I guess one could read it as "device
> must respond with a Completion to an access immediately after reset,
> even if the Completion is RRS."
From our testing and also as mentioned in the cover letter[0] of
0f8b5d90d179 ("PCI: Ignore Immediate Readiness on Samsung 990 PRO and
990 EVO Plus NVMe") Samsung did fix newer firmware to exhibit the
behavior the current Linux code expects.
That said, I tested the change you propose and this too fixes the
problem for me on s390 and it's certainly cleaner than a bunch of
quirks. I also made sure that we don't get otherwise failed reads which
we then turned into 0xff…f, so it looks like the device is indeed
completing immediately just with RRS. And yes, I can see how one could
read the Spec like that though I too would have read it to mean
Successful Completion.
Feel free to add:
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Thanks,
Niklas
[0]
https://lore.kernel.org/linux-pci/20261011163249.18479-1-gruhlke@mailbox.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device
2026-11-23 22:50 ` Bjorn Helgaas
2026-11-24 10:24 ` Niklas Schnelle
@ 2026-11-24 17:59 ` Farhan Ali
1 sibling, 0 replies; 4+ messages in thread
From: Farhan Ali @ 2026-11-24 17:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, linux-kernel, bhelgaas, lukas, mjrosato, gbayer,
schnelle, Kanchan Joshi, Nitesh Shetty, Judy Brock
On 11/23/2026 2:50 PM, Bjorn Helgaas wrote:
> [+cc Kanchan, Nitesh, Judy (scraped from lore Samsung NVMe traffic)]
>
> On Mon, Nov 23, 2026 at 01:53:08PM -0800, Farhan Ali wrote:
>> The Samsung NVMe SSD Controller PM174x [144d:a826] advertises Immediate
>> Readiness, so pcie_flr() doesn't wait after FLR, but the device isn't ready
>> yet and config reads return ~0 after the reset. This happens with
>> firmware version SNA6SNA6 or older.
>>
>> This was seen on s390x with the nvme driver bound, by resetting the device
>> via the sysfs reset attribute:
>>
>> # echo 1 > /sys/bus/pci/devices/200c:00:00.0/reset
>>
>> nvme 200c:00:00.0: Unable to change power state from D3cold to D0, device inaccessible
>> nvme nvme0: Disabling device after reset failure: -19
>>
>> Ignore Immediate Readiness on this device too, so pcie_flr() waits.
>>
>> Fixes: 10baa9b4df40 ("PCI: Drop unnecessary retries when restoring BARs")
>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>> ---
>> drivers/pci/quirks.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 4a02fc80755d..11c3b45afe78 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -5790,6 +5790,7 @@ static void quirk_no_imm_ready(struct pci_dev *dev)
>> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80c, quirk_no_imm_ready);
>> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80d, quirk_no_imm_ready);
>> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa80e, quirk_no_imm_ready);
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SAMSUNG, 0xa826, quirk_no_imm_ready);
> We already have:
>
> 996a59519af2 ("PCI: Ignore Immediate Readiness on Samsung PM9D3a NVMe")
> 0f8b5d90d179 ("PCI: Ignore Immediate Readiness on Samsung 990 PRO and 990 EVO Plus NVMe")
>
> I wonder if something like the below might be safer and avoid an
> ongoing series of quirks.
>
> The spec (PCIe r7.0, sec 7.5.1.1.4) says that when Immediate Readiness
> is set, "the Function is guaranteed to be ready to successfully
> complete valid Configuration Requests at any time" and "software is
> exempt from all requirements to *delay configuration accesses*
> following any type of reset."
>
> I thought that meant Completions for config requests would always have
> Successful Completion status, but I guess one could read it as "device
> must respond with a Completion to an access immediately after reset,
> even if the Completion is RRS."
My interpretation of the spec was also a successful completion of the
config space requests. As Niklas mentioned we see the problem with
devices running an older firmware version. Maybe Samsung folks can say
more about how these devices actually implemented the spec with regards
to Immediate Readiness.
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7c6f2aba8144..c9f95852e83d 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4457,15 +4457,13 @@ int pcie_flr(struct pci_dev *dev)
>
> pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
>
> - if (dev->imm_ready)
> - goto done;
> -
> /*
> * Per PCIe r4.0, sec 6.6.2, a device must complete an FLR within
> * 100ms, but may silently discard requests while the FLR is in
> * progress. Wait 100ms before trying to access the device.
> */
> - msleep(100);
> + if (!dev->imm_ready)
> + msleep(100);
>
> ret = pci_dev_wait(dev, "FLR", PCIE_RESET_READY_POLL_MS);
> done:
> @@ -4534,16 +4532,14 @@ static int pci_af_flr(struct pci_dev *dev, bool probe)
>
> pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
>
> - if (dev->imm_ready)
> - goto done;
> -
> /*
> * Per Advanced Capabilities for Conventional PCI ECN, 13 April 2006,
> * updated 27 July 2006; a device must complete an FLR within
> * 100ms, but may silently discard requests while the FLR is in
> * progress. Wait 100ms before trying to access the device.
> */
> - msleep(100);
> + if (!dev->imm_ready)
> + msleep(100);
>
> ret = pci_dev_wait(dev, "AF_FLR", PCIE_RESET_READY_POLL_MS);
> done:
This change looks correct to me, feel free to add:
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-24 18:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 21:53 [PATCH v1] PCI: Ignore Immediate Readiness for Samsung a826 device Farhan Ali
2026-11-23 22:50 ` Bjorn Helgaas
2026-11-24 10:24 ` Niklas Schnelle
2026-11-24 17:59 ` Farhan Ali
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®