WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [QEMU] Simpler workaround for guest write

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [QEMU] Simpler workaround for guest writes to PCI config
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Nov 2006 21:30:48 +0000
Delivery-date: Thu, 30 Nov 2006 13:32:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID f66f7c3a82a7420d80714b0d349ee9a24b50ec28
# Parent  ccc419cbe0bada0ae901e0d426dabce70a429876
[QEMU] Simpler workaround for guest writes to PCI config
space that extend past byte 0xff.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/ioemu/hw/pci.c |   24 ++++++++----------------
 tools/ioemu/vl.h     |    7 +++++--
 2 files changed, 13 insertions(+), 18 deletions(-)

diff -r ccc419cbe0ba -r f66f7c3a82a7 tools/ioemu/hw/pci.c
--- a/tools/ioemu/hw/pci.c      Thu Nov 30 17:27:00 2006 +0000
+++ b/tools/ioemu/hw/pci.c      Thu Nov 30 17:32:16 2006 +0000
@@ -221,23 +221,16 @@ uint32_t pci_default_read_config(PCIDevi
                                  uint32_t address, int len)
 {
     uint32_t val;
-
     switch(len) {
+    case 1:
+        val = d->config[address];
+        break;
+    case 2:
+        val = le16_to_cpu(*(uint16_t *)(d->config + address));
+        break;
     default:
     case 4:
-       if (address <= 0xfc) {
-           val = le32_to_cpu(*(uint32_t *)(d->config + address));
-           break;
-       }
-       /* fall through */
-    case 2:
-        if (address <= 0xfe) {
-           val = le16_to_cpu(*(uint16_t *)(d->config + address));
-           break;
-       }
-       /* fall through */
-    case 1:
-        val = d->config[address];
+        val = le32_to_cpu(*(uint32_t *)(d->config + address));
         break;
     }
     return val;
@@ -340,8 +333,7 @@ void pci_default_write_config(PCIDevice 
 
             d->config[addr] = val;
         }
-        if (++addr > 0xff)
-               break;
+        addr++;
         val >>= 8;
     }
 
diff -r ccc419cbe0ba -r f66f7c3a82a7 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Thu Nov 30 17:27:00 2006 +0000
+++ b/tools/ioemu/vl.h  Thu Nov 30 17:32:16 2006 +0000
@@ -650,8 +650,11 @@ typedef struct PCIIORegion {
 #define PCI_MAX_LAT            0x3f    /* 8 bits */
 
 struct PCIDevice {
-    /* PCI config space */
-    uint8_t config[256];
+    /*
+     * PCI config space. The 4 extra bytes are a safety buffer for guest
+     * word/dword writes that can extend past byte 0xff.
+     */
+    uint8_t config[256+4];
 
     /* the following fields are read only */
     PCIBus *bus;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [QEMU] Simpler workaround for guest writes to PCI config, Xen patchbot-unstable <=