]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
x86/amd-iommu: Fix deassignment of a device from the pt_domain
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 22 Jan 2010 16:55:27 +0000 (17:55 +0100)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 22 Jan 2010 16:56:49 +0000 (17:56 +0100)
Deassigning a device from the passthrough domain does not
work and breaks device assignment to kvm guests. This patch
fixes the issue.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
arch/x86/kernel/amd_iommu.c

index 751ce73c6e1b0b1134ef601a8692396536920166..adb0ba025702938b37586c9a8c2999cf68b135dd 100644 (file)
@@ -1511,9 +1511,11 @@ static void __detach_device(struct device *dev)
 
        /*
         * 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 && dev_data->domain == NULL)
+       if (iommu_pass_through &&
+           (dev_data->domain == NULL && domain != pt_domain))
                __attach_device(dev, pt_domain);
 }