From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJRh-0001og-NS for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:49:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtJRf-0006SS-Dj for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:49:29 -0500 Received: from mail-vc0-f172.google.com ([209.85.220.172]:50189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJRf-0006Rd-9K for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:49:27 -0500 Received: by mail-vc0-f172.google.com with SMTP id fw7so476646vcb.17 for ; Thu, 10 Jan 2013 06:49:26 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 10 Jan 2013 15:49:07 +0100 Message-Id: <1357829348-3496-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1357829348-3496-1-git-send-email-pbonzini@redhat.com> References: <1357829348-3496-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] qdev: add qbus_reset_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, mst@redhat.com Signed-off-by: Paolo Bonzini --- hw/qdev-core.h | 12 ++++++++++++ hw/qdev.c | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index fdf14ec..853bd08 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -182,6 +182,18 @@ int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, qbus_walkerfn *busfn, void *opaque); void qdev_reset_all(DeviceState *dev); + +/** + * @qbus_reset_all: + * @bus: Bus to be reset. + * + * Reset @bus and perform a bus-level ("hard") reset of all devices connected + * to it, including recursive processing of all buses below @bus itself. A + * hard reset means that qbus_reset_all will reset all state of the device. + * For PCI devices, for example, this will include the base address registers + * or configuration space. + */ +void qbus_reset_all(BusState *bus); void qbus_reset_all_fn(void *opaque); void qbus_free(BusState *bus); diff --git a/hw/qdev.c b/hw/qdev.c index f2c2484..e2f957e 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -228,10 +228,15 @@ void qdev_reset_all(DeviceState *dev) qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL); } +void qbus_reset_all(BusState *bus) +{ + qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); +} + void qbus_reset_all_fn(void *opaque) { BusState *bus = opaque; - qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); + qbus_reset_all(bus); } /* can be used as ->unplug() callback for the simple cases */ -- 1.8.1