[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] AMD/IOMMU: pull ATS disabling earlier
commit 388b5f1be68861b8abaf67e6a311b09b5a0816c5 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Oct 15 12:47:18 2021 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Oct 15 12:47:18 2021 +0200 AMD/IOMMU: pull ATS disabling earlier Disabling should be done in the opposite order of enabling: ATS wants to be turned off before adjusting the DTE, just like it gets enabled only after the DTE was suitably prepared. Note that we want ATS to be disabled as soon as any of the DTEs involved in the handling of a device (including phantom devices) gets adjusted respectively. For this reason the "devfn == pdev->devfn" of the original conditional gets dropped. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Paul Durrant <paul@xxxxxxx> --- xen/drivers/passthrough/amd/pci_amd_iommu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c index 45d16b731f..63fa426273 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -313,6 +313,12 @@ static void amd_iommu_disable_domain_device(const struct domain *domain, if ( QUARANTINE_SKIP(domain) ) return; + ASSERT(pcidevs_locked()); + + if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && + pci_ats_enabled(iommu->seg, bus, pdev->devfn) ) + disable_ats_device(pdev); + BUG_ON ( iommu->dev_table.buffer == NULL ); req_id = get_dma_requestor_id(iommu->seg, PCI_BDF2(bus, devfn)); table = iommu->dev_table.buffer; @@ -348,13 +354,6 @@ static void amd_iommu_disable_domain_device(const struct domain *domain, } else spin_unlock_irqrestore(&iommu->lock, flags); - - ASSERT(pcidevs_locked()); - - if ( devfn == pdev->devfn && - pci_ats_device(iommu->seg, bus, devfn) && - pci_ats_enabled(iommu->seg, bus, devfn) ) - disable_ats_device(pdev); } static int reassign_device(struct domain *source, struct domain *target, -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |