ia64/xen-unstable
changeset 19032:1c6642adaeb2
AMD IOMMU: Fix a dead lock in device assignment.
Do not obtain pcidevs_lock in reassign_device().
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Do not obtain pcidevs_lock in reassign_device().
Signed-off-by: Wei Wang <wei.wang2@amd.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Jan 13 15:16:07 2009 +0000 (2009-01-13) |
parents | 27e9687c5b3d |
children | 73770182aee4 |
files | xen/drivers/passthrough/amd/pci_amd_iommu.c |
line diff
1.1 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Tue Jan 13 08:59:49 2009 +0000 1.2 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Tue Jan 13 15:16:07 2009 +0000 1.3 @@ -271,26 +271,22 @@ static int reassign_device( struct domai 1.4 struct amd_iommu *iommu; 1.5 int bdf; 1.6 1.7 - spin_lock(&pcidevs_lock); 1.8 + ASSERT(spin_is_locked(&pcidevs_lock)); 1.9 pdev = pci_get_pdev_by_domain(source, bus, devfn); 1.10 if ( !pdev ) 1.11 - { 1.12 - spin_unlock(&pcidevs_lock); 1.13 return -ENODEV; 1.14 - } 1.15 1.16 bdf = (bus << 8) | devfn; 1.17 /* supported device? */ 1.18 iommu = (bdf < ivrs_bdf_entries) ? 1.19 - find_iommu_for_device(bus, pdev->devfn) : NULL; 1.20 + find_iommu_for_device(bus, pdev->devfn) : NULL; 1.21 1.22 if ( !iommu ) 1.23 { 1.24 - spin_unlock(&pcidevs_lock); 1.25 amd_iov_error("Fail to find iommu." 1.26 - " %x:%x.%x cannot be assigned to domain %d\n", 1.27 - bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id); 1.28 - return -ENODEV; 1.29 + " %x:%x.%x cannot be assigned to domain %d\n", 1.30 + bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id); 1.31 + return -ENODEV; 1.32 } 1.33 1.34 amd_iommu_disable_domain_device(source, iommu, bdf);