Re: [PATCH 4/4] cxl/pci: Guard decoder accesses after reset

From: Dave Jiang

Date: Fri Oct 30 2026 - 13:38:39 EST




On 9/28/26 7:04 PM, Richard Cheng wrote:
> cxl_reset_done() runs even when PCI state restoration is skipped.
> Reading HDM decoder registers while the device is inaccessible can
> trigger another error.
>
> Skip decoder checks if the PCI Command read fails, returns all ones, or
> Memory Space Enable is clear.
>
> Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>

Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>

> ---
> drivers/cxl/pci.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index c7c91e8dc51d..2294f7761e50 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -976,6 +976,12 @@ static void cxl_reset_done(struct pci_dev *pdev)
> struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
> struct cxl_memdev *cxlmd = cxlds->cxlmd;
> struct device *dev = &pdev->dev;
> + u32 command;
> +
> + /* PCI state restoration may have been skipped after a failed reset. */
> + if (pci_read_config_dword(pdev, PCI_COMMAND, &command) ||
> + PCI_POSSIBLE_ERROR(command) || !(command & PCI_COMMAND_MEMORY))
> + return;
>
> /*
> * FLR does not expect to touch the HDM decoders and related