From nobody Sun Feb 8 18:43:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490946141232500.8484135309218; Fri, 31 Mar 2017 00:42:21 -0700 (PDT) Received: from localhost ([::1]:39365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctrCO-0004Y7-2B for importer@patchew.org; Fri, 31 Mar 2017 03:42:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctr7z-0001fc-46 for qemu-devel@nongnu.org; Fri, 31 Mar 2017 03:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctr7w-0007Db-19 for qemu-devel@nongnu.org; Fri, 31 Mar 2017 03:37:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60902) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctr7v-0007DD-Pj for qemu-devel@nongnu.org; Fri, 31 Mar 2017 03:37:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB03080463; Fri, 31 Mar 2017 07:37:42 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-8-59.pek2.redhat.com [10.72.8.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2E1B18146; Fri, 31 Mar 2017 07:37:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BB03080463 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BB03080463 From: Peter Xu To: qemu-devel@nongnu.org Date: Fri, 31 Mar 2017 15:36:33 +0800 Message-Id: <1490945793-21276-6-git-send-email-peterx@redhat.com> In-Reply-To: <1490945793-21276-1-git-send-email-peterx@redhat.com> References: <1490945793-21276-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 31 Mar 2017 07:37:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 5/5] pci: move dma_as init back to bus realize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tianyu.lan@intel.com, kevin.tian@intel.com, yi.l.liu@intel.com, "\\ Michael S . Tsirkin \\ " , Jason Wang , Markus Armbruster , peterx@redhat.com, Marcel Apfelbaum , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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); } =20 -static void pcibus_machine_done(Notifier *notifier, void *data) -{ - PCIBus *bus =3D container_of(notifier, PCIBus, machine_done); - int i; - - for (i =3D 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 =3D PCI_BUS(qbus); =20 - bus->machine_done.notify =3D pcibus_machine_done; - qemu_add_machine_init_done_notifier(&bus->machine_done); - vmstate_register(NULL, -1, &vmstate_pcibus, bus); } =20 @@ -120,8 +105,6 @@ static void pci_bus_unrealize(BusState *qbus, Error **e= rrp) { PCIBus *bus =3D PCI_BUS(qbus); =20 - qemu_remove_machine_init_done_notifier(&bus->machine_done); - vmstate_unregister(NULL, &vmstate_pcibus, bus); } =20 @@ -1004,9 +987,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pc= i_dev, PCIBus *bus, address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_container_region, pci_dev->nam= e); =20 - 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 =3D 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; }; =20 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); =20 void qemu_add_machine_init_done_notifier(Notifier *notify); -void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 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 *n= otify) } } =20 -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); --=20 2.7.4