return hd->platform_ops->add_device(pdev);
}
+int iommu_enable_device(struct pci_dev *pdev)
+{
+ struct hvm_iommu *hd;
+
+ if ( !pdev->domain )
+ return -EINVAL;
+
+ ASSERT(spin_is_locked(&pcidevs_lock));
+
+ hd = domain_hvm_iommu(pdev->domain);
+ if ( !iommu_enabled || !hd->platform_ops ||
+ !hd->platform_ops->enable_device )
+ return 0;
+
+ return hd->platform_ops->enable_device(pdev);
+}
+
int iommu_remove_device(struct pci_dev *pdev)
{
struct hvm_iommu *hd;
* pci_enable_acs - enable ACS if hardware support it
* @dev: the PCI device
*/
-void pci_enable_acs(struct pci_dev *pdev)
+static void pci_enable_acs(struct pci_dev *pdev)
{
int pos;
u16 cap, ctrl, seg = pdev->seg;
}
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
- pci_enable_acs(pdev);
}
+ else
+ iommu_enable_device(pdev);
+
+ pci_enable_acs(pdev);
out:
spin_unlock(&pcidevs_lock);
return ret;
}
+static int intel_iommu_enable_device(struct pci_dev *pdev)
+{
+ struct acpi_drhd_unit *drhd = acpi_find_matched_drhd_unit(pdev);
+ int ret = drhd ? ats_device(pdev, drhd) : -ENODEV;
+
+ if ( ret <= 0 )
+ return ret;
+
+ ret = enable_ats_device(pdev->seg, pdev->bus, pdev->devfn);
+
+ return ret >= 0 ? 0 : ret;
+}
+
static int intel_iommu_remove_device(struct pci_dev *pdev)
{
struct acpi_rmrr_unit *rmrr;
static void __init setup_dom0_device(struct pci_dev *pdev)
{
domain_context_mapping(pdev->domain, pdev->seg, pdev->bus, pdev->devfn);
- pci_enable_acs(pdev);
pci_vtd_quirk(pdev);
}
.init = intel_iommu_domain_init,
.dom0_init = intel_iommu_dom0_init,
.add_device = intel_iommu_add_device,
+ .enable_device = intel_iommu_enable_device,
.remove_device = intel_iommu_remove_device,
.assign_device = intel_iommu_assign_device,
.teardown = iommu_domain_teardown,
void iommu_disable_x2apic_IR(void);
int iommu_add_device(struct pci_dev *pdev);
+int iommu_enable_device(struct pci_dev *pdev);
int iommu_remove_device(struct pci_dev *pdev);
int iommu_domain_init(struct domain *d);
void iommu_dom0_init(struct domain *d);
int (*init)(struct domain *d);
void (*dom0_init)(struct domain *d);
int (*add_device)(struct pci_dev *pdev);
+ int (*enable_device)(struct pci_dev *pdev);
int (*remove_device)(struct pci_dev *pdev);
int (*assign_device)(struct domain *d, u16 seg, u8 bus, u8 devfn);
void (*teardown)(struct domain *d);
int msixtbl_pt_register(struct domain *, struct pirq *, uint64_t gtable);
void msixtbl_pt_unregister(struct domain *, struct pirq *);
void msixtbl_pt_cleanup(struct domain *d);
-void pci_enable_acs(struct pci_dev *pdev);
#endif /* __XEN_PCI_H__ */