From: Jan Beulich Date: Fri, 15 Oct 2021 09:19:41 +0000 (+0200) Subject: AMD/IOMMU: consider hidden devices when flushing device I/O TLBs X-Git-Tag: archive/raspbian/4.14.3+32-g9de3671772-1_deb11u1+rpi1^2^2~48^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=49b0aef3f916e325e10d7d90ea25ea0321ac0d48;p=xen.git AMD/IOMMU: consider hidden devices when flushing device I/O TLBs Hidden devices are associated with DomXEN but usable by the hardware domain. Hence they need flushing as well when all devices are to have flushes invoked. While there drop a redundant ATS-enabled check and constify the first parameter of the involved function. Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant master commit: 036432e8b27e1ef21e0f0204ba9b0e3972a031c2 master date: 2021-10-12 11:54:34 +0200 --- diff --git a/xen/drivers/passthrough/amd/iommu_cmd.c b/xen/drivers/passthrough/amd/iommu_cmd.c index fc5377f5f2..e155b1168f 100644 --- a/xen/drivers/passthrough/amd/iommu_cmd.c +++ b/xen/drivers/passthrough/amd/iommu_cmd.c @@ -309,14 +309,11 @@ void amd_iommu_flush_iotlb(u8 devfn, const struct pci_dev *pdev, spin_unlock_irqrestore(&iommu->lock, flags); } -static void amd_iommu_flush_all_iotlbs(struct domain *d, daddr_t daddr, +static void amd_iommu_flush_all_iotlbs(const struct domain *d, daddr_t daddr, unsigned int order) { struct pci_dev *pdev; - if ( !ats_enabled ) - return; - for_each_pdev( d, pdev ) { u8 devfn = pdev->devfn; @@ -347,7 +344,16 @@ static void _amd_iommu_flush_pages(struct domain *d, } if ( ats_enabled ) + { amd_iommu_flush_all_iotlbs(d, daddr, order); + + /* + * Hidden devices are associated with DomXEN but usable by the + * hardware domain. Hence they need dealing with here as well. + */ + if ( is_hardware_domain(d) ) + amd_iommu_flush_all_iotlbs(dom_xen, daddr, order); + } } void amd_iommu_flush_all_pages(struct domain *d)