From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj3eu-0004yH-LY for qemu-devel@nongnu.org; Thu, 13 Dec 2012 02:56:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tj3er-0003LO-KQ for qemu-devel@nongnu.org; Thu, 13 Dec 2012 02:56:44 -0500 Received: from mail-ie0-f181.google.com ([209.85.223.181]:52993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj3er-0003Kg-F8 for qemu-devel@nongnu.org; Thu, 13 Dec 2012 02:56:41 -0500 Received: by mail-ie0-f181.google.com with SMTP id 16so3776150iea.12 for ; Wed, 12 Dec 2012 23:56:40 -0800 (PST) Sender: Paolo Bonzini Message-ID: <50C98A33.70307@redhat.com> Date: Thu, 13 Dec 2012 08:56:35 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1355322396-32026-1-git-send-email-pbonzini@redhat.com> <1355322396-32026-2-git-send-email-pbonzini@redhat.com> <20121212144448.GE15555@redhat.com> <50C8A0A8.3000303@redhat.com> <20121212153333.GC16750@redhat.com> <50C8B2BB.50606@redhat.com> <20121212170522.GA18597@redhat.com> <50C8BF12.1070906@redhat.com> <20121212213257.GD23087@redhat.com> In-Reply-To: <20121212213257.GD23087@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] virtio-pci: reset all qbuses too when writing to the status field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, agraf@suse.de Il 12/12/2012 22:32, Michael S. Tsirkin ha scritto: > > i.e. just implement a method on the bus to do the hard-reset, and let > > generic infrastructure call it. > > I dislike this approach. > A specific function call is easier to follow. "I dislike reading documentation, so I prefer to have ugly code than good documentation". The right way to fix it is to document the reset semantics, and use them. > > No, because that would also reset the virtio-pci bits (ioeventfd etc.) which > > virtio-scsi has no business with. What I could do is to call qbus_reset_all, > > but it makes no sense to me when there is a generic solution. > > > > The virtio reset just resets virtio registers and stops DMA > and interrupts. That is all. If it's not clear from spec > we should make it clear. > > The fact that virtio scsi needs to do something special > with qdev or whatever for this to happen is it's own business. Same for virtio-console. If you don't call qemu_chr_fe_close, the char device layer ends up calling chr_read in virtio-console.c which ultimately does DMA. It's how most qdev buses work. The bus callbacks includes a parent->child interface to submit request and a child->parent interface to DMA. If you do not reset the children, you do not reset DMA. Period. > E.g. -net does it differently it checks state > before processing packets. > Generic virtio core does not care. Generic qdev core cares. virtio is a qdev device and it should use services provided by the generic framework, as much as you hate it. Paolo