Re: [bug report] nvme-pci: NVMe lost after S3 resume, CSTS reads all-ones for a few 100 ms

From: Christoph Hellwig

Date: Fri Nov 20 2026 - 13:08:30 EST


> +/*
> + * A controller that was shut down for suspend may have lost power while the
> + * PCI core still treats it as D3hot, so nothing waited for it to come back.
> + * Config space can already answer while MMIO still reads all-ones. Give such
> + * a controller some time instead of declaring it dead on the first read.
> + */
> +#define NVME_RESUME_MMIO_TIMEOUT_MS 10000
> +#define NVME_RESUME_MMIO_POLL_MS 100
> +
> +static bool nvme_pci_wait_mmio_after_suspend(struct nvme_dev *dev)

I'd probably rename this function and do the initial read of
NVME_REG_CSTS inside of the helper as well to keep everything in a
single place. Otherwise this does look reasonable to me as it
automatically takes care of this issue without affecting setups
that don't have this quirk.