mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
pci: use memory core for iommu support
Use the new iommu support in the memory core for iommu support. The only user, spapr, is also converted, but it still provides a DMAContext interface until the non-PCI bits switch to AddressSpace. Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Avi Kivity <avi.kivity@gmail.com> [ Do not calls memory_region_del_subregion() on the device's bus_master_enable_region, it is an alias; return an AddressSpace from the IOMMU hook and remove the destructor hook. - David Gibson ] Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
24addbc76d
commit
e00387d582
5 changed files with 28 additions and 28 deletions
|
@ -506,12 +506,11 @@ static const MemoryRegionOps spapr_msi_ops = {
|
|||
/*
|
||||
* PHB PCI device
|
||||
*/
|
||||
static DMAContext *spapr_pci_dma_context_fn(PCIBus *bus, void *opaque,
|
||||
int devfn)
|
||||
static AddressSpace *spapr_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
{
|
||||
sPAPRPHBState *phb = opaque;
|
||||
|
||||
return spapr_tce_get_dma(phb->tcet);
|
||||
return &phb->iommu_as;
|
||||
}
|
||||
|
||||
static int spapr_phb_init(SysBusDevice *s)
|
||||
|
@ -651,7 +650,8 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||
fprintf(stderr, "Unable to create TCE table for %s\n", sphb->dtbusname);
|
||||
return -1;
|
||||
}
|
||||
pci_setup_iommu(bus, spapr_pci_dma_context_fn, sphb);
|
||||
address_space_init(&sphb->iommu_as, spapr_tce_get_iommu(sphb->tcet));
|
||||
pci_setup_iommu(bus, spapr_pci_dma_iommu, sphb);
|
||||
|
||||
QLIST_INSERT_HEAD(&spapr->phbs, sphb, list);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue