From ccd162e5be9dbd08e4f523d612f3ec72a2cba00a Mon Sep 17 00:00:00 2001 From: CLEMENT MATHIEU--DRIF Date: Wed, 29 Oct 2025 10:51:44 +0000 Subject: [PATCH] pci: Block ATS requests when privileged mode is disabled Signed-off-by: Clement Mathieu--Drif Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Message-Id: <20251029105137.1097933-5-clement.mathieu--drif@eviden.com> --- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 9035caca92..90d6d71efd 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -3171,6 +3171,10 @@ ssize_t pci_ats_request_translation(PCIDevice *dev, uint32_t pasid, return -EPERM; } + if (priv_req && !pcie_pasid_priv_enabled(dev)) { + return -EPERM; + } + pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn); if (iommu_bus && iommu_bus->iommu_ops->ats_request_translation) { return iommu_bus->iommu_ops->ats_request_translation(bus, -- 2.47.3