diff options
author | Marcel Apfelbaum <marcel@redhat.com> | 2016-06-27 18:38:34 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-07-04 14:50:58 +0300 |
commit | 621d983a1f9051f4cfc3f402569b46b77d8449fc (patch) | |
tree | 8e1fcc1afde7a0d2dbb5c5025ee23454f99552bd /hw/pci-host/q35.c | |
parent | bf8d492405feaee2c1685b3b9d5e03228ed3e47f (diff) | |
download | qemu-621d983a1f9051f4cfc3f402569b46b77d8449fc.zip qemu-621d983a1f9051f4cfc3f402569b46b77d8449fc.tar.gz qemu-621d983a1f9051f4cfc3f402569b46b77d8449fc.tar.bz2 |
hw/iommu: enable iommu with -device
Use the standard '-device intel-iommu' to create the IOMMU device.
The legacy '-machine,iommu=on' can still be used.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci-host/q35.c')
-rw-r--r-- | hw/pci-host/q35.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 0150039..8d060a5 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -52,6 +52,7 @@ static void q35_host_realize(DeviceState *dev, Error **errp) pci->bus = pci_bus_new(DEVICE(s), "pcie.0", s->mch.pci_address_space, s->mch.address_space_io, 0, TYPE_PCIE_BUS); + PC_MACHINE(qdev_get_machine())->bus = pci->bus; qdev_set_parent_bus(DEVICE(&s->mch), BUS(pci->bus)); qdev_init_nofail(DEVICE(&s->mch)); } @@ -446,28 +447,12 @@ static void mch_reset(DeviceState *qdev) mch_update(mch); } -static AddressSpace *q35_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) -{ - IntelIOMMUState *s = opaque; - VTDAddressSpace *vtd_as; - - assert(0 <= devfn && devfn <= VTD_PCI_DEVFN_MAX); - - vtd_as = vtd_find_add_as(s, bus, devfn); - return &vtd_as->as; -} - static void mch_init_dmar(MCHPCIState *mch) { - PCIBus *pci_bus = PCI_BUS(qdev_get_parent_bus(DEVICE(mch))); - mch->iommu = INTEL_IOMMU_DEVICE(qdev_create(NULL, TYPE_INTEL_IOMMU_DEVICE)); object_property_add_child(OBJECT(mch), "intel-iommu", OBJECT(mch->iommu), NULL); qdev_init_nofail(DEVICE(mch->iommu)); - sysbus_mmio_map(SYS_BUS_DEVICE(mch->iommu), 0, Q35_HOST_BRIDGE_IOMMU_ADDR); - - pci_setup_iommu(pci_bus, q35_host_dma_iommu, mch->iommu); } static void mch_realize(PCIDevice *d, Error **errp) |