Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
[pandora-kernel.git] / virt / kvm / iommu.c
index 78c80f6..d5f3b8d 100644 (file)
@@ -187,6 +187,8 @@ int kvm_assign_device(struct kvm *kvm,
                        goto out_unmap;
        }
 
+       pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
+
        printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
                assigned_dev->host_segnr,
                assigned_dev->host_busnr,
@@ -215,6 +217,8 @@ int kvm_deassign_device(struct kvm *kvm,
 
        iommu_detach_device(domain, &pdev->dev);
 
+       pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
+
        printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
                assigned_dev->host_segnr,
                assigned_dev->host_busnr,
@@ -228,12 +232,12 @@ int kvm_iommu_map_guest(struct kvm *kvm)
 {
        int r;
 
-       if (!iommu_found()) {
+       if (!iommu_present(&pci_bus_type)) {
                printk(KERN_ERR "%s: iommu not found\n", __func__);
                return -ENODEV;
        }
 
-       kvm->arch.iommu_domain = iommu_domain_alloc();
+       kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
        if (!kvm->arch.iommu_domain)
                return -ENOMEM;