From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TktkV-0002fQ-H9 for qemu-devel@nongnu.org; Tue, 18 Dec 2012 04:46:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TktkS-0007kM-Rm for qemu-devel@nongnu.org; Tue, 18 Dec 2012 04:46:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TktkS-0007kC-Ik for qemu-devel@nongnu.org; Tue, 18 Dec 2012 04:46:04 -0500 Date: Tue, 18 Dec 2012 11:49:13 +0200 From: "Michael S. Tsirkin" Message-ID: <20121218094913.GC19090@redhat.com> References: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> <20121217214336.GA11991@redhat.com> <50D01AEE.2010508@redhat.com> <50D02AB6.9050208@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50D02AB6.9050208@redhat.com> Subject: Re: [Qemu-devel] [PATCH 00/15] qdev: make reset semantics more clear and consistent, reset qbuses under virtio devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Tue, Dec 18, 2012 at 09:35:02AM +0100, Paolo Bonzini wrote: > Il 18/12/2012 08:27, Paolo Bonzini ha scritto: > > Il 17/12/2012 22:43, Michael S. Tsirkin ha scritto: > >> 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); > >> +} > > > > Yes, I had understood. As I said, this is the wrong direction. > > Resetting happens from vdev->binding_opaque, it can just do > > qdev_reset_all(myself). It can but it's the wrong thing for transport to know about. Let PCI worry about PCI things. This is not a transport specific thing so belongs in virtio.c > ... besides, this only works if the reset callback of > vdev->binding_opaque remembers to call virtio_reset (in the s390 > bindings, it doesn't and this series fixes it). That's a separate bug I think. > So IMO it is not only > useless, it is also misleading. > > Paolo