--- intel-iommu.c.orig	2015-04-21 18:11:32.690219966 +0100
+++ intel-iommu.c	2015-04-21 18:13:27.976054232 +0100
@@ -4242,6 +4242,18 @@
 
 static void intel_iommu_remove_device(struct device *dev)
 {
+	struct intel_iommu *iommu;
+	struct pci_dev *pdev = to_pci_dev(dev);
+
+	iommu = device_to_iommu(pci_domain_nr(pdev->bus), pdev->bus->number,
+							pdev->devfn);
+
+	if (iommu && (pdev->devfn == 0x40 || pdev->devfn == 0x41)) {
+		clear_context_table(iommu, pdev->bus->number, pdev->devfn);
+		iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL);
+		iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);
+	}
+
 	iommu_group_remove_device(dev);
 }
 
