[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.10 5/5] pci: move dma_as init back to bus real
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH for-2.10 5/5] pci: move dma_as init back to bus realize |
Date: |
Fri, 31 Mar 2017 15:36:33 +0800 |
This patch partly reverted commit b86eacb ("hw/pci: delay
bus_master_enable_region initialization"). In that patch, we postponed
pci DMA address space initialization to support the new "-device"
interface for "intel-iommu" device. Now since we have vIOMMUs inited
back during machine init phase, we won't need this notifier mechanism
any more.
This brings us a benefit that all device realization will be able to
have a valid bus_master_as now.
Signed-off-by: Peter Xu <address@hidden>
---
hw/pci/pci.c | 21 +--------------------
include/hw/pci/pci_bus.h | 2 --
include/sysemu/sysemu.h | 1 -
vl.c | 5 -----
4 files changed, 1 insertion(+), 28 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bd8043c..dd32ddf 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -94,25 +94,10 @@ static void pci_init_bus_master(PCIDevice *pci_dev)
&pci_dev->bus_master_enable_region);
}
-static void pcibus_machine_done(Notifier *notifier, void *data)
-{
- PCIBus *bus = container_of(notifier, PCIBus, machine_done);
- int i;
-
- for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) {
- if (bus->devices[i]) {
- pci_init_bus_master(bus->devices[i]);
- }
- }
-}
-
static void pci_bus_realize(BusState *qbus, Error **errp)
{
PCIBus *bus = PCI_BUS(qbus);
- bus->machine_done.notify = pcibus_machine_done;
- qemu_add_machine_init_done_notifier(&bus->machine_done);
-
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
}
@@ -120,8 +105,6 @@ static void pci_bus_unrealize(BusState *qbus, Error **errp)
{
PCIBus *bus = PCI_BUS(qbus);
- qemu_remove_machine_init_done_notifier(&bus->machine_done);
-
vmstate_unregister(NULL, &vmstate_pcibus, bus);
}
@@ -1004,9 +987,7 @@ static PCIDevice *do_pci_register_device(PCIDevice
*pci_dev, PCIBus *bus,
address_space_init(&pci_dev->bus_master_as,
&pci_dev->bus_master_container_region, pci_dev->name);
- if (qdev_hotplug) {
- pci_init_bus_master(pci_dev);
- }
+ pci_init_bus_master(pci_dev);
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
pci_dev->irq_state = 0;
pci_config_alloc(pci_dev);
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index 5484a9b..403fec6 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -39,8 +39,6 @@ struct PCIBus {
Keep a count of the number of devices with raised IRQs. */
int nirq;
int *irq_count;
-
- Notifier machine_done;
};
typedef struct PCIBridgeWindows PCIBridgeWindows;
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..8b686b5 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -73,7 +73,6 @@ void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);
void qemu_add_machine_init_done_notifier(Notifier *notify);
-void qemu_remove_machine_init_done_notifier(Notifier *notify);
void hmp_savevm(Monitor *mon, const QDict *qdict);
int save_vmstate(Monitor *mon, const char *name);
diff --git a/vl.c b/vl.c
index b18bde7..3786a08 100644
--- a/vl.c
+++ b/vl.c
@@ -2660,11 +2660,6 @@ void qemu_add_machine_init_done_notifier(Notifier
*notify)
}
}
-void qemu_remove_machine_init_done_notifier(Notifier *notify)
-{
- notifier_remove(notify);
-}
-
static void qemu_run_machine_init_done_notifiers(void)
{
notifier_list_notify(&machine_init_done_notifiers, NULL);
--
2.7.4
- [Qemu-devel] [PATCH for-2.10 0/5] x86/vIOMMU: move init back to machine init phase, Peter Xu, 2017/03/31
- [Qemu-devel] [PATCH for-2.10 1/5] QemuOpts: introduce qemu_opts_extract(), Peter Xu, 2017/03/31
- [Qemu-devel] [PATCH for-2.10 2/5] util: export device_init_func(), Peter Xu, 2017/03/31
- [Qemu-devel] [PATCH for-2.10 3/5] util: propagate error for device_func_init(), Peter Xu, 2017/03/31
- [Qemu-devel] [PATCH for-2.10 4/5] q35: init vIOMMU during machine init, Peter Xu, 2017/03/31
- [Qemu-devel] [PATCH for-2.10 5/5] pci: move dma_as init back to bus realize,
Peter Xu <=
- Re: [Qemu-devel] [PATCH for-2.10 0/5] x86/vIOMMU: move init back to machine init phase, Michael S. Tsirkin, 2017/03/31