From patchwork Thu Sep 2 09:25:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 63460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E6632B7171 for ; Thu, 2 Sep 2010 19:20:31 +1000 (EST) Received: from localhost ([127.0.0.1]:53731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Or5y8-0002Fk-LX for incoming@patchwork.ozlabs.org; Thu, 02 Sep 2010 05:20:28 -0400 Received: from [140.186.70.92] (port=45587 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Or5qZ-0006kL-8O for qemu-devel@nongnu.org; Thu, 02 Sep 2010 05:12:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Or5qX-0002En-Co for qemu-devel@nongnu.org; Thu, 02 Sep 2010 05:12:39 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:44584) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Or5qX-0002EV-2L for qemu-devel@nongnu.org; Thu, 02 Sep 2010 05:12:37 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 4655E107A8B; Thu, 2 Sep 2010 18:12:34 +0900 (JST) Received: (nullmailer pid 18571 invoked by uid 1000); Thu, 02 Sep 2010 09:25:09 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Thu, 2 Sep 2010 18:25:05 +0900 Message-Id: <5b44fda814a73ac84c177db21bad6e1c4526b38a.1283417726.git.yamahata@valinux.co.jp> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: gleb@redhat.com, glommer@redhat.com, blauwirbel@gmail.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, avi@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 2/6] qdev: introduce reset call back for qbus level. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org and make it called via qbus_reset_all(). The qbus reset callback will be used by pci bus reset. Signed-off-by: Isaku Yamahata --- hw/qdev-core.h | 3 +++ hw/qdev.c | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index a9b7692..49ac87a 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -58,12 +58,15 @@ typedef int (qbus_del_devfn)(BusState *bus, DeviceState *dev); typedef void (qbus_realizefn)(BusState *bus); +typedef int (qbus_resetfn)(BusState *bus); + struct BusInfo { const char *name; size_t size; qbus_add_devfn *add_dev; qbus_del_devfn *del_dev; qbus_realizefn *realize; + qbus_resetfn *reset; bus_get_dev_path get_dev_path; Property *props; }; diff --git a/hw/qdev.c b/hw/qdev.c index c1ba6b8..9300d7f 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -166,9 +166,17 @@ static int qdev_reset_one(DeviceState *dev, void *opaque) return 0; } +static int qbus_reset_one(BusState *bus, void *opaque) +{ + if (bus->info->reset) { + return bus->info->reset(bus); + } + return 0; +} + void qbus_reset_all(BusState *bus) { - qbus_walk_children(bus, qdev_reset_one, NULL, NULL); + qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); } static int qdev_realize_one(DeviceState *dev, void *opaque)