From patchwork Mon Dec 17 21:43:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 207003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24ACF2C008E for ; Tue, 18 Dec 2012 08:40:57 +1100 (EST) Received: from localhost ([::1]:36846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkiQh-0000VS-MS for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2012 16:40:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkiQX-0000V0-Uu for qemu-devel@nongnu.org; Mon, 17 Dec 2012 16:40:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkiQU-000502-Ow for qemu-devel@nongnu.org; Mon, 17 Dec 2012 16:40:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkiQU-0004zV-GI for qemu-devel@nongnu.org; Mon, 17 Dec 2012 16:40:42 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBHLecPB005503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Dec 2012 16:40:41 -0500 Received: from redhat.com (vpn1-6-198.ams2.redhat.com [10.36.6.198]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id qBHLeNOe017431; Mon, 17 Dec 2012 16:40:28 -0500 Date: Mon, 17 Dec 2012 23:43:36 +0200 From: "Michael S. Tsirkin" To: Paolo Bonzini Message-ID: <20121217214336.GA11991@redhat.com> References: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH 00/15] qdev: make reset semantics more clear and consistent, reset qbuses under virtio devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Dec 17, 2012 at 05:24:35PM +0100, Paolo Bonzini wrote: > After discussion with mst on the topic of resetting virtio devices, > here is a series that hopefully clarifies the semantics of bus and > device resets. > > After this series, there are two kinds of resets: So just to clarify, what I proposed was this (on top of my type safety patch). Then all transports can call virtio_config_reset when appropriate (e.g. when PA is set to 0). Signed-off-by: Michael S. Tsirkin diff --git a/hw/virtio.c b/hw/virtio.c index f40a8c5..e65d7c8 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -554,6 +554,14 @@ void virtio_reset(void *opaque) } } +/* Device-specific reset through virtio config space. + * Reset virtio config and backend child devices if any. + */ +void virtio_config_reset(VirtIODevice *vdev) +{ + qdev_reset_all(vdev->binding_opaque); +} + uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr) { uint8_t val; diff --git a/hw/virtio.h b/hw/virtio.h index 7c17f7b..e2e57a4 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -187,11 +187,12 @@ uint16_t virtio_queue_vector(VirtIODevice *vdev, int n); void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector); void virtio_set_status(VirtIODevice *vdev, uint8_t val); void virtio_reset(void *opaque); +void virtio_config_reset(VirtIODevice *vdev); void virtio_update_irq(VirtIODevice *vdev); int virtio_set_features(VirtIODevice *vdev, uint32_t val); void virtio_bind_device(VirtIODevice *vdev, const VirtIOBindings *binding, DeviceState *opaque); /* Base devices. */ typedef struct VirtIOBlkConf VirtIOBlkConf;