Re: [PATCH v16 14/18] PCI/CXL: Reject reset with unsafe function scope
From: Richard Cheng
Date: Fri Oct 30 2026 - 04:44:11 EST
On Thu, Oct 29, 2026 at 02:56:59PM +0800, Srirangan Madhavan wrote:
> The per-device PCI reset interface must not reset sibling functions.
> Reject cxl_reset and cxl_bus for VFs, multifunction devices, and PFs with
> enabled VFs.
>
> Suggested-by: Alex Williamson <alwilliamson@xxxxxxxxxx>
> Link: https://lore.kernel.org/linux-cxl/20260626160846.426e71b6@xxxxxxxxxx/
> Link: https://lore.kernel.org/linux-cxl/6a50441e2bb5e_3cabcb1003e@djbw-dev.notmuch/
> Signed-off-by: Srirangan Madhavan <smadhavan@xxxxxxxxxx>
> Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Reviewed-by: Richard Cheng <icheng@xxxxxxxxxx>
> ---
> drivers/pci/cxl.c | 3 +++
> drivers/pci/pci.c | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/drivers/pci/cxl.c b/drivers/pci/cxl.c
> index 4a8969145f8b..9a298e90586d 100644
> --- a/drivers/pci/cxl.c
> +++ b/drivers/pci/cxl.c
> @@ -515,6 +515,9 @@ int cxl_reset_function(struct pci_dev *pdev, bool probe)
> !(ctrl & PCI_DVSEC_CXL_MEM_ENABLE))
> return -ENOTTY;
>
> + if (pdev->is_virtfn || pdev->multifunction || pci_num_vf(pdev))
> + return -ENOTTY;
> +
> if (probe)
> return 0;
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index b2879a6be5f8..9031060423cc 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5026,6 +5026,9 @@ static int cxl_reset_bus_function(struct pci_dev *dev, bool probe)
> if (!dvsec)
> return -ENOTTY;
>
> + if (dev->is_virtfn || dev->multifunction || pci_num_vf(dev))
> + return -ENOTTY;
> +
> if (probe)
> return 0;
>
> --
> 2.43.0
>