From: Joerg Roedel Date: Wed, 3 Feb 2010 15:13:41 +0000 (+0100) Subject: x86/amd-iommu: Fix deassignment of a device from the pt_domain X-Git-Tag: firefly_0821_release~11625^2~21 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=314a4e5441e5402e16c5e810f33a4ed842d0a473;p=firefly-linux-kernel-4.4.55.git x86/amd-iommu: Fix deassignment of a device from the pt_domain commit d3ad9373b7c29b63d5e8460a69453718d200cc3b upstream. Deassigning a device from the passthrough domain does not work and breaks device assignment to kvm guests. This patch fixes the issue. Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index ff964960e065..23fc9fe1625f 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c @@ -1230,9 +1230,10 @@ static void __detach_device(struct protection_domain *domain, u16 devid) /* * If we run in passthrough mode the device must be assigned to the - * passthrough domain if it is detached from any other domain + * passthrough domain if it is detached from any other domain. + * Make sure we can deassign from the pt_domain itself. */ - if (iommu_pass_through) { + if (iommu_pass_through && domain != pt_domain) { struct amd_iommu *iommu = amd_iommu_rlookup_table[devid]; __attach_device(iommu, pt_domain, devid); }