mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-vfio-20231106' of https://github.com/legoater/qemu into staging
vfio queue: * Support for non 64b IOVA space * Introduction of a PCIIOMMUOps callback structure to ease future extensions * Fix for a buffer overrun when writing the VF token * PPC cleanups preparing ground for IOMMUFD support # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmVI+bIACgkQUaNDx8/7 # 7KHW4g/9FmgX0k2Elm1BAul3slJtuBT8/iHKfK19rhXICxhxS5xBWJA8FmosTWAT # 91YqQJhOHARxLd9VROfv8Fq8sAo+Ys8bP3PTXh5satjY5gR9YtmMSVqvsAVLn7lv # a/0xp7wPJt2UeKzvRNUqFXNr7yHPwxFxbJbmmAJbNte8p+TfE2qvojbJnu7BjJbg # sTtS/vFWNJwtuNYTkMRoiZaUKEoEZ8LnslOqKUjgeO59g4i3Dq8e2JCmHANPFWUK # cWmr7AqcXgXEnLSDWTtfN53bjcSCYkFVb4WV4Wv1/7hUF5jQ4UR0l3B64xWe0M3/ # Prak3bWOM/o7JwLBsgaWPngXA9V0WFBTXVF4x5qTwhuR1sSV8MxUvTKxI+qqiEzA # FjU89oSZ+zXId/hEUuTL6vn1Th8/6mwD0L9ORchNOQUKzCjBzI4MVPB09nM3AdPC # LGThlufsZktdoU2KjMHpc+gMIXQYsxkgvm07K5iZTZ5eJ4tV5KB0aPvTZppGUxe1 # YY9og9F3hxjDHQtEuSY2rzBQI7nrUpd1ZI5ut/3ZgDWkqD6aGRtMme4n4GsGsYb2 # Ht9+d2RL9S8uPUh+7rV8K/N3+vXgXRaEYTuAScKtflEbA7YnZA5nUdMng8x0kMTQ # Y73XCd4UGWDfSSZsgaIHGkM/MRIHgmlrfcwPkWqWW9vF+92O6Hw= # =/Du0 # -----END PGP SIGNATURE----- # gpg: Signature made Mon 06 Nov 2023 22:35:30 HKT # gpg: using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1 # gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [unknown] # gpg: aka "Cédric Le Goater <clg@kaod.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: A0F6 6548 F048 95EB FE6B 0B60 51A3 43C7 CFFB ECA1 * tag 'pull-vfio-20231106' of https://github.com/legoater/qemu: (22 commits) vfio/common: Move vfio_host_win_add/del into spapr.c vfio/spapr: Make vfio_spapr_create/remove_window static vfio/container: Move spapr specific init/deinit into spapr.c vfio/container: Move vfio_container_add/del_section_window into spapr.c vfio/container: Move IBM EEH related functions into spapr_pci_vfio.c util/uuid: Define UUID_STR_LEN from UUID_NONE string util/uuid: Remove UUID_FMT_LEN vfio/pci: Fix buffer overrun when writing the VF token util/uuid: Add UUID_STR_LEN definition hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps test: Add some tests for range and resv-mem helpers virtio-iommu: Consolidate host reserved regions and property set ones virtio-iommu: Implement set_iova_ranges() callback virtio-iommu: Record whether a probe request has been issued range: Introduce range_inverse_array() virtio-iommu: Introduce per IOMMUDevice reserved regions util/reserved-region: Add new ReservedRegion helpers range: Make range_compare() public virtio-iommu: Rename reserved_regions into prop_resv_regions vfio: Collect container iova range info ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -130,7 +130,7 @@ static BdrvDirtyBitmap *parallels_load_bitmap(BlockDriverState *bs,
|
||||
g_autofree uint64_t *l1_table = NULL;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
QemuUUID uuid;
|
||||
char uuidstr[UUID_FMT_LEN + 1];
|
||||
char uuidstr[UUID_STR_LEN];
|
||||
int i;
|
||||
|
||||
if (data_size < sizeof(bf)) {
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ static void vdi_header_to_le(VdiHeader *header)
|
||||
|
||||
static void vdi_header_print(VdiHeader *header)
|
||||
{
|
||||
char uuidstr[37];
|
||||
char uuidstr[UUID_STR_LEN];
|
||||
QemuUUID uuid;
|
||||
logout("text %s", header->text);
|
||||
logout("signature 0x%08x\n", header->signature);
|
||||
|
||||
@@ -11,6 +11,7 @@ generated from in-code annotations to function prototypes.
|
||||
loads-stores
|
||||
memory
|
||||
modules
|
||||
pci
|
||||
qom-api
|
||||
qdev-api
|
||||
ui
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=============
|
||||
PCI subsystem
|
||||
=============
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
.. kernel-doc:: include/hw/pci/pci.h
|
||||
+5
-1
@@ -738,6 +738,10 @@ static AddressSpace *typhoon_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
return &s->pchip.iommu_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps typhoon_iommu_ops = {
|
||||
.get_address_space = typhoon_pci_dma_iommu,
|
||||
};
|
||||
|
||||
static void typhoon_set_irq(void *opaque, int irq, int level)
|
||||
{
|
||||
TyphoonState *s = opaque;
|
||||
@@ -897,7 +901,7 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,
|
||||
"iommu-typhoon", UINT64_MAX);
|
||||
address_space_init(&s->pchip.iommu_as, MEMORY_REGION(&s->pchip.iommu),
|
||||
"pchip0-pci");
|
||||
pci_setup_iommu(b, typhoon_pci_dma_iommu, s);
|
||||
pci_setup_iommu(b, &typhoon_iommu_ops, s);
|
||||
|
||||
/* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */
|
||||
memory_region_init_io(&s->pchip.reg_iack, OBJECT(s), &alpha_pci_iack_ops,
|
||||
|
||||
@@ -605,6 +605,10 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
|
||||
return &sdev->as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps smmu_ops = {
|
||||
.get_address_space = smmu_find_add_as,
|
||||
};
|
||||
|
||||
IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid)
|
||||
{
|
||||
uint8_t bus_n, devfn;
|
||||
@@ -661,7 +665,7 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
|
||||
s->smmu_pcibus_by_busptr = g_hash_table_new(NULL, NULL);
|
||||
|
||||
if (s->primary_bus) {
|
||||
pci_setup_iommu(s->primary_bus, smmu_find_add_as, s);
|
||||
pci_setup_iommu(s->primary_bus, &smmu_ops, s);
|
||||
} else {
|
||||
error_setg(errp, "SMMU is not attached to any PCI bus!");
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
int rc;
|
||||
|
||||
rc = snprintf(buffer, sizeof(buffer), "0x%"PRIx64":0x%"PRIx64":%u",
|
||||
rr->low, rr->high, rr->type);
|
||||
range_lob(&rr->range), range_upb(&rr->range), rr->type);
|
||||
assert(rc < sizeof(buffer));
|
||||
|
||||
visit_type_str(v, name, &p, errp);
|
||||
@@ -717,6 +717,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
Property *prop = opaque;
|
||||
ReservedRegion *rr = object_field_prop_ptr(obj, prop);
|
||||
const char *endptr;
|
||||
uint64_t lob, upb;
|
||||
char *str;
|
||||
int ret;
|
||||
|
||||
@@ -724,7 +725,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = qemu_strtou64(str, &endptr, 16, &rr->low);
|
||||
ret = qemu_strtou64(str, &endptr, 16, &lob);
|
||||
if (ret) {
|
||||
error_setg(errp, "start address of '%s'"
|
||||
" must be a hexadecimal integer", name);
|
||||
@@ -734,7 +735,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
goto separator_error;
|
||||
}
|
||||
|
||||
ret = qemu_strtou64(endptr + 1, &endptr, 16, &rr->high);
|
||||
ret = qemu_strtou64(endptr + 1, &endptr, 16, &upb);
|
||||
if (ret) {
|
||||
error_setg(errp, "end address of '%s'"
|
||||
" must be a hexadecimal integer", name);
|
||||
@@ -744,6 +745,8 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
goto separator_error;
|
||||
}
|
||||
|
||||
range_set_bounds(&rr->range, lob, upb);
|
||||
|
||||
ret = qemu_strtoui(endptr + 1, &endptr, 10, &rr->type);
|
||||
if (ret) {
|
||||
error_setg(errp, "type of '%s'"
|
||||
@@ -1111,7 +1114,7 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
{
|
||||
Property *prop = opaque;
|
||||
QemuUUID *uuid = object_field_prop_ptr(obj, prop);
|
||||
char buffer[UUID_FMT_LEN + 1];
|
||||
char buffer[UUID_STR_LEN];
|
||||
char *p = buffer;
|
||||
|
||||
qemu_uuid_unparse(uuid, buffer);
|
||||
|
||||
+2
-2
@@ -2271,7 +2271,7 @@ static void vmbus_dev_realize(DeviceState *dev, Error **errp)
|
||||
VMBus *vmbus = VMBUS(qdev_get_parent_bus(dev));
|
||||
BusChild *child;
|
||||
Error *err = NULL;
|
||||
char idstr[UUID_FMT_LEN + 1];
|
||||
char idstr[UUID_STR_LEN];
|
||||
|
||||
assert(!qemu_uuid_is_null(&vdev->instanceid));
|
||||
|
||||
@@ -2467,7 +2467,7 @@ static char *vmbus_get_dev_path(DeviceState *dev)
|
||||
static char *vmbus_get_fw_dev_path(DeviceState *dev)
|
||||
{
|
||||
VMBusDevice *vdev = VMBUS_DEVICE(dev);
|
||||
char uuid[UUID_FMT_LEN + 1];
|
||||
char uuid[UUID_STR_LEN];
|
||||
|
||||
qemu_uuid_unparse(&vdev->instanceid, uuid);
|
||||
return g_strdup_printf("%s@%s", qdev_fw_name(dev), uuid);
|
||||
|
||||
+5
-1
@@ -1450,6 +1450,10 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
return &iommu_as[devfn]->as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps amdvi_iommu_ops = {
|
||||
.get_address_space = amdvi_host_dma_iommu,
|
||||
};
|
||||
|
||||
static const MemoryRegionOps mmio_mem_ops = {
|
||||
.read = amdvi_mmio_read,
|
||||
.write = amdvi_mmio_write,
|
||||
@@ -1581,7 +1585,7 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
|
||||
AMDVI_MMIO_SIZE);
|
||||
memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR,
|
||||
&s->mmio);
|
||||
pci_setup_iommu(bus, amdvi_host_dma_iommu, s);
|
||||
pci_setup_iommu(bus, &amdvi_iommu_ops, s);
|
||||
amdvi_init(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -4088,6 +4088,10 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
return &vtd_as->as;
|
||||
}
|
||||
|
||||
static PCIIOMMUOps vtd_iommu_ops = {
|
||||
.get_address_space = vtd_host_dma_iommu,
|
||||
};
|
||||
|
||||
static bool vtd_decide_config(IntelIOMMUState *s, Error **errp)
|
||||
{
|
||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
|
||||
@@ -4210,7 +4214,7 @@ static void vtd_realize(DeviceState *dev, Error **errp)
|
||||
s->vtd_address_spaces = g_hash_table_new_full(vtd_as_hash, vtd_as_equal,
|
||||
g_free, g_free);
|
||||
vtd_init(s);
|
||||
pci_setup_iommu(bus, vtd_host_dma_iommu, dev);
|
||||
pci_setup_iommu(bus, &vtd_iommu_ops, dev);
|
||||
/* Pseudo address space under root PCI bus. */
|
||||
x86ms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);
|
||||
qemu_add_machine_init_done_notifier(&vtd_machine_done_notify);
|
||||
|
||||
+5
-1
@@ -345,6 +345,10 @@ static AddressSpace *elroy_pcihost_set_iommu(PCIBus *bus, void *opaque,
|
||||
return &s->astro->iommu_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps elroy_pcihost_iommu_ops = {
|
||||
.get_address_space = elroy_pcihost_set_iommu,
|
||||
};
|
||||
|
||||
/*
|
||||
* Encoding in IOSAPIC:
|
||||
* base_addr == 0xfffa0000, we want to get 0xa0ff0000.
|
||||
@@ -834,7 +838,7 @@ static void astro_realize(DeviceState *obj, Error **errp)
|
||||
&elroy->pci_io);
|
||||
|
||||
/* Host memory as seen from the PCI side, via the IOMMU. */
|
||||
pci_setup_iommu(PCI_HOST_BRIDGE(elroy)->bus, elroy_pcihost_set_iommu,
|
||||
pci_setup_iommu(PCI_HOST_BRIDGE(elroy)->bus, &elroy_pcihost_iommu_ops,
|
||||
elroy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,6 +663,10 @@ static AddressSpace *designware_pcie_host_set_iommu(PCIBus *bus, void *opaque,
|
||||
return &s->pci.address_space;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps designware_iommu_ops = {
|
||||
.get_address_space = designware_pcie_host_set_iommu,
|
||||
};
|
||||
|
||||
static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
|
||||
@@ -705,7 +709,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
|
||||
address_space_init(&s->pci.address_space,
|
||||
&s->pci.address_space_root,
|
||||
"pcie-bus-address-space");
|
||||
pci_setup_iommu(pci->bus, designware_pcie_host_set_iommu, s);
|
||||
pci_setup_iommu(pci->bus, &designware_iommu_ops, s);
|
||||
|
||||
qdev_realize(DEVICE(&s->root), BUS(pci->bus), &error_fatal);
|
||||
}
|
||||
|
||||
+5
-1
@@ -354,6 +354,10 @@ static AddressSpace *dino_pcihost_set_iommu(PCIBus *bus, void *opaque,
|
||||
return &s->bm_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps dino_iommu_ops = {
|
||||
.get_address_space = dino_pcihost_set_iommu,
|
||||
};
|
||||
|
||||
/*
|
||||
* Dino interrupts are connected as shown on Page 78, Table 23
|
||||
* (Little-endian bit numbers)
|
||||
@@ -481,7 +485,7 @@ static void dino_pcihost_init(Object *obj)
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
pci_setup_iommu(phb->bus, dino_pcihost_set_iommu, s);
|
||||
pci_setup_iommu(phb->bus, &dino_iommu_ops, s);
|
||||
|
||||
sysbus_init_mmio(sbd, &s->this_mem);
|
||||
|
||||
|
||||
@@ -968,6 +968,10 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
return &ds->dma_as;
|
||||
}
|
||||
|
||||
static PCIIOMMUOps pnv_phb3_iommu_ops = {
|
||||
.get_address_space = pnv_phb3_dma_iommu,
|
||||
};
|
||||
|
||||
static void pnv_phb3_instance_init(Object *obj)
|
||||
{
|
||||
PnvPHB3 *phb = PNV_PHB3(obj);
|
||||
@@ -1012,7 +1016,7 @@ void pnv_phb3_bus_init(DeviceState *dev, PnvPHB3 *phb)
|
||||
object_property_set_int(OBJECT(pci->bus), "chip-id", phb->chip_id,
|
||||
&error_abort);
|
||||
|
||||
pci_setup_iommu(pci->bus, pnv_phb3_dma_iommu, phb);
|
||||
pci_setup_iommu(pci->bus, &pnv_phb3_iommu_ops, phb);
|
||||
}
|
||||
|
||||
static void pnv_phb3_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
@@ -1518,6 +1518,10 @@ static void pnv_phb4_xscom_realize(PnvPHB4 *phb)
|
||||
&phb->phb_regs_mr);
|
||||
}
|
||||
|
||||
static PCIIOMMUOps pnv_phb4_iommu_ops = {
|
||||
.get_address_space = pnv_phb4_dma_iommu,
|
||||
};
|
||||
|
||||
static void pnv_phb4_instance_init(Object *obj)
|
||||
{
|
||||
PnvPHB4 *phb = PNV_PHB4(obj);
|
||||
@@ -1557,7 +1561,7 @@ void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb)
|
||||
object_property_set_int(OBJECT(pci->bus), "chip-id", phb->chip_id,
|
||||
&error_abort);
|
||||
|
||||
pci_setup_iommu(pci->bus, pnv_phb4_dma_iommu, phb);
|
||||
pci_setup_iommu(pci->bus, &pnv_phb4_iommu_ops, phb);
|
||||
pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE;
|
||||
}
|
||||
|
||||
|
||||
@@ -435,6 +435,10 @@ static AddressSpace *e500_pcihost_set_iommu(PCIBus *bus, void *opaque,
|
||||
return &s->bm_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps ppce500_iommu_ops = {
|
||||
.get_address_space = e500_pcihost_set_iommu,
|
||||
};
|
||||
|
||||
static void e500_pcihost_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||
@@ -469,7 +473,7 @@ static void e500_pcihost_realize(DeviceState *dev, Error **errp)
|
||||
memory_region_init(&s->bm, OBJECT(s), "bm-e500", UINT64_MAX);
|
||||
memory_region_add_subregion(&s->bm, 0x0, &s->busmem);
|
||||
address_space_init(&s->bm_as, &s->bm, "pci-bm");
|
||||
pci_setup_iommu(b, e500_pcihost_set_iommu, s);
|
||||
pci_setup_iommu(b, &ppce500_iommu_ops, s);
|
||||
|
||||
pci_create_simple(b, 0, "e500-host-bridge");
|
||||
|
||||
|
||||
+5
-1
@@ -223,6 +223,10 @@ static AddressSpace *raven_pcihost_set_iommu(PCIBus *bus, void *opaque,
|
||||
return &s->bm_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps raven_iommu_ops = {
|
||||
.get_address_space = raven_pcihost_set_iommu,
|
||||
};
|
||||
|
||||
static void raven_change_gpio(void *opaque, int n, int level)
|
||||
{
|
||||
PREPPCIState *s = opaque;
|
||||
@@ -320,7 +324,7 @@ static void raven_pcihost_initfn(Object *obj)
|
||||
memory_region_add_subregion(&s->bm, 0 , &s->bm_pci_memory_alias);
|
||||
memory_region_add_subregion(&s->bm, 0x80000000, &s->bm_ram_alias);
|
||||
address_space_init(&s->bm_as, &s->bm, "raven-bm");
|
||||
pci_setup_iommu(&s->pci_bus, raven_pcihost_set_iommu, s);
|
||||
pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s);
|
||||
|
||||
h->bus = &s->pci_bus;
|
||||
|
||||
|
||||
+5
-1
@@ -112,6 +112,10 @@ static AddressSpace *sabre_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
||||
return &is->iommu_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps sabre_iommu_ops = {
|
||||
.get_address_space = sabre_pci_dma_iommu,
|
||||
};
|
||||
|
||||
static void sabre_config_write(void *opaque, hwaddr addr,
|
||||
uint64_t val, unsigned size)
|
||||
{
|
||||
@@ -384,7 +388,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
|
||||
/* IOMMU */
|
||||
memory_region_add_subregion_overlap(&s->sabre_config, 0x200,
|
||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(s->iommu), 0), 1);
|
||||
pci_setup_iommu(phb->bus, sabre_pci_dma_iommu, s->iommu);
|
||||
pci_setup_iommu(phb->bus, &sabre_iommu_ops, s->iommu);
|
||||
|
||||
/* APB secondary busses */
|
||||
pci_dev = pci_new_multifunction(PCI_DEVFN(1, 0), TYPE_SIMBA_PCI_BRIDGE);
|
||||
|
||||
+13
-5
@@ -2678,7 +2678,7 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
|
||||
PCIBus *iommu_bus = bus;
|
||||
uint8_t devfn = dev->devfn;
|
||||
|
||||
while (iommu_bus && !iommu_bus->iommu_fn && iommu_bus->parent_dev) {
|
||||
while (iommu_bus && !iommu_bus->iommu_ops && iommu_bus->parent_dev) {
|
||||
PCIBus *parent_bus = pci_get_bus(iommu_bus->parent_dev);
|
||||
|
||||
/*
|
||||
@@ -2717,15 +2717,23 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
|
||||
|
||||
iommu_bus = parent_bus;
|
||||
}
|
||||
if (!pci_bus_bypass_iommu(bus) && iommu_bus && iommu_bus->iommu_fn) {
|
||||
return iommu_bus->iommu_fn(bus, iommu_bus->iommu_opaque, devfn);
|
||||
if (!pci_bus_bypass_iommu(bus) && iommu_bus->iommu_ops) {
|
||||
return iommu_bus->iommu_ops->get_address_space(bus,
|
||||
iommu_bus->iommu_opaque, devfn);
|
||||
}
|
||||
return &address_space_memory;
|
||||
}
|
||||
|
||||
void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque)
|
||||
void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque)
|
||||
{
|
||||
bus->iommu_fn = fn;
|
||||
/*
|
||||
* If called, pci_setup_iommu() should provide a minimum set of
|
||||
* useful callbacks for the bus.
|
||||
*/
|
||||
assert(ops);
|
||||
assert(ops->get_address_space);
|
||||
|
||||
bus->iommu_ops = ops;
|
||||
bus->iommu_opaque = opaque;
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +449,10 @@ static AddressSpace *ppc440_pcix_set_iommu(PCIBus *b, void *opaque, int devfn)
|
||||
return &s->bm_as;
|
||||
}
|
||||
|
||||
static const PCIIOMMUOps ppc440_iommu_ops = {
|
||||
.get_address_space = ppc440_pcix_set_iommu,
|
||||
};
|
||||
|
||||
/*
|
||||
* Some guests on sam460ex write all kinds of garbage here such as
|
||||
* missing enable bit and low bits set and still expect this to work
|
||||
@@ -503,7 +507,7 @@ static void ppc440_pcix_realize(DeviceState *dev, Error **errp)
|
||||
memory_region_init(&s->bm, OBJECT(s), "bm-ppc440-pcix", UINT64_MAX);
|
||||
memory_region_add_subregion(&s->bm, 0x0, &s->busmem);
|
||||
address_space_init(&s->bm_as, &s->bm, "pci-bm");
|
||||
pci_setup_iommu(h->bus, ppc440_pcix_set_iommu, s);
|
||||
pci_setup_iommu(h->bus, &ppc440_iommu_ops, s);
|
||||
|
||||
memory_region_init(&s->container, OBJECT(s), "pci-container", PCI_ALL_SIZE);
|
||||
memory_region_init_io(&h->conf_mem, OBJECT(s), &ppc440_pcix_host_conf_ops,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user