qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Yan Vugenfirer" <yvugenfi@redhat.com>
To: 'Anthony Liguori' <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: RE: [Qemu-devel] [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests
Date: Sun, 13 Sep 2009 07:47:35 -0400 (EDT)	[thread overview]
Message-ID: <011701ca3467$fc540100$f4fc0300$@com> (raw)
In-Reply-To: <4AAA5248.6020008@codemonkey.ws>

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

> From: Anthony Liguori
> 
> Needs a Signed-off-by.
> 
> Regards,
> 
> Anthony Liguori
 
[YV] Resending with signed-off-by.

[-- Attachment #2: 0001-VirtIO-Fix-QEMU-crash-during-Windows-PNP-tests.patch --]
[-- Type: application/octet-stream, Size: 1844 bytes --]

>From d7b9ccc5c1a6a28367a550a5e55a40d482623ec7 Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <yvugenfi@redhat.com>
Date: Tue, 8 Sep 2009 10:08:14 -0400
Subject: [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests

Signed-off-by: Yan Vugenfirer <yvugenfi@redhat.com>

---
 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;
+        }
+    }
+
     pci_default_write_config(pci_dev, address, val, len);
-    msix_write_config(pci_dev, address, val, len);
+    if(proxy->vdev->nvectors)
+        msix_write_config(pci_dev, address, val, len);
 }
 
 static const VirtIOBindings virtio_pci_bindings = {
@@ -407,11 +416,12 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
                          msix_bar_size(&proxy->pci_dev),
                          PCI_ADDRESS_SPACE_MEM,
                          msix_mmio_map);
-        proxy->pci_dev.config_write = virtio_write_config;
         proxy->pci_dev.unregister = msix_uninit;
     } else
         vdev->nvectors = 0;
 
+    proxy->pci_dev.config_write = virtio_write_config;
+
     size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + vdev->config_len;
     if (size & (size-1))
         size = 1 << qemu_fls(size);
-- 
1.5.5.6


  reply	other threads:[~2009-09-13 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-08 14:49 [Qemu-devel] [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests Yan Vugenfirer
2009-09-11 13:36 ` Anthony Liguori
2009-09-13 11:47   ` Yan Vugenfirer [this message]
2009-09-14 12:50     ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2009-09-14 13:31 Yan Vugenfirer
2010-03-01 11:14 ` Alexander Graf
2010-03-01 11:26   ` Gleb Natapov
2010-03-02 10:09     ` Michael S. Tsirkin
2010-03-02 11:03       ` Alexander Graf
2010-03-02 11:05         ` Michael S. Tsirkin
2010-03-02 11:43           ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='011701ca3467$fc540100$f4fc0300$@com' \
    --to=yvugenfi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).