From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nm3ls-0007Ju-7z for qemu-devel@nongnu.org; Mon, 01 Mar 2010 06:26:44 -0500 Received: from [199.232.76.173] (port=55625 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm3lr-0007Ig-4D for qemu-devel@nongnu.org; Mon, 01 Mar 2010 06:26:43 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nm3lo-0000H5-KO for qemu-devel@nongnu.org; Mon, 01 Mar 2010 06:26:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51610) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nm3lo-0000Gz-0S for qemu-devel@nongnu.org; Mon, 01 Mar 2010 06:26:40 -0500 Date: Mon, 1 Mar 2010 13:26:37 +0200 From: Gleb Natapov Subject: Re: [Qemu-devel] [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests Message-ID: <20100301112637.GH16909@redhat.com> References: <1252935086-8856-1-git-send-email-yvugenfi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Yan Vugenfirer , "qemu-devel@nongnu.org Developers" , "Michael S. Tsirkin" On Mon, Mar 01, 2010 at 12:14:43PM +0100, Alexander Graf wrote: > > On 14.09.2009, at 15:31, Yan Vugenfirer wrote: > > > Signed-off-by: Yan Vugenfirer > > > > --- > > hw/virtio-pci.c | 14 ++++++++++++-- > > 1 files changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c > > index f812ab7..a0a22c4 100644 > > --- a/hw/virtio-pci.c > > +++ b/hw/virtio-pci.c > > @@ -364,8 +364,17 @@ static void virtio_map(PCIDevice *pci_dev, int region_num, > > static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, > > uint32_t val, int len) > > { > > + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); > > + > > + if (PCI_COMMAND == address) { > > + if (!(val & PCI_COMMAND_MASTER)) { > > + proxy->vdev->status &= ~VIRTIO_CONFIG_S_DRIVER_OK; > > This part breaks PCI hotplug with Linux guests. > > What happens is the following: Looks like something is broken even without this patch. > > (qemu) pci_add auto nic model=virtio,vlan=0 > - Virtio dev 1 -> write config (0) > - Virtio dev 1 -> write config (0x3) > - Virtio dev 1 -> set status explicitly to OK Why Linux doesn't enable bus mastering on this device? > > (qemu) pci_add auto storage file=/tmp/image.raw,if=virtio > - Virtio dev 1 -> write config (0x3) Why Linux touches unrelated device's config space? > -> Unset DRIVER_OK bit > -> network device becomes unresponsive > - Virtio dev 2 -> write config (0) > - Virtio dev 2 -> write config (0x3) > - Virtio dev 2 -> set status explicitly to OK > > > Please either revert this patch or provide a proper fix. > > Alex -- Gleb.