qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: tianyu.lan@intel.com, Paolo Bonzini <pbonzini@redhat.com>,
	kevin.tian@intel.com, yi.l.liu@intel.com,
	Marcel Apfelbaum <marcel@redhat.com>,
	"\\  Michael S . Tsirkin \\ " <mst@redhat.com>,
	peterx@redhat.com, Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
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	[thread overview]
Message-ID: <1490945793-21276-6-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1490945793-21276-1-git-send-email-peterx@redhat.com>

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 <peterx@redhat.com>
---
 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

  parent reply	other threads:[~2017-03-31  7:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  7:36 [Qemu-devel] [PATCH for-2.10 0/5] x86/vIOMMU: move init back to machine init phase Peter Xu
2017-03-31  7:36 ` [Qemu-devel] [PATCH for-2.10 1/5] QemuOpts: introduce qemu_opts_extract() Peter Xu
2017-03-31  7:36 ` [Qemu-devel] [PATCH for-2.10 2/5] util: export device_init_func() Peter Xu
2017-03-31  7:36 ` [Qemu-devel] [PATCH for-2.10 3/5] util: propagate error for device_func_init() Peter Xu
2017-03-31  7:36 ` [Qemu-devel] [PATCH for-2.10 4/5] q35: init vIOMMU during machine init Peter Xu
2017-03-31  7:36 ` Peter Xu [this message]
2017-03-31 16:17 ` [Qemu-devel] [PATCH for-2.10 0/5] x86/vIOMMU: move init back to machine init phase Michael S. Tsirkin
2017-04-01  1:29   ` Peter Xu
2017-04-11  9:22     ` Markus Armbruster
2017-04-11 10:08       ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490945793-21276-6-git-send-email-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tianyu.lan@intel.com \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).