diff mbox

[RFC,1/3] pci-testdev: separate page for each mmio test

Message ID 1440926395-23540-2-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin Aug. 30, 2015, 9:20 a.m. UTC
note: this makes BAR > 4K, which requires kvm unit test
patch to support such BAR. Do we need to worry about
old kvm unit test binaries? I'm guessing not ...

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/misc/pci-testdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index b6e11d6..6edc1cd 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -48,7 +48,7 @@  typedef struct IOTest {
 #define IOTEST_NODATA  0xAB
 
 #define IOTEST_IOSIZE 128
-#define IOTEST_MEMSIZE 2048
+#define IOTEST_MEMSIZE 0x10000
 
 static const char *iotest_test[] = {
     "no-eventfd",
@@ -262,7 +262,7 @@  static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)
         test->hdr = g_malloc0(test->bufsize);
         memcpy(test->hdr->name, name, strlen(name) + 1);
         g_free(name);
-        test->hdr->offset = cpu_to_le32(IOTEST_SIZE(i) + i * IOTEST_ACCESS_WIDTH);
+        test->hdr->offset = cpu_to_le32(IOTEST_SIZE(i) + i * (IOTEST_IS_MEM(i) ? 0x1000 : IOTEST_ACCESS_WIDTH));
         test->size = strcmp(IOTEST_TEST(i), "nodata-eventfd") ? IOTEST_ACCESS_WIDTH : 0;
 
         test->match_data = strcmp(IOTEST_TEST(i), "wildcard-eventfd") &&
@@ -273,6 +273,7 @@  static void pci_testdev_realize(PCIDevice *pci_dev, Error **errp)
         test->mr = IOTEST_REGION(d, i);
 
         if (!test->size && !IOTEST_IS_MEM(i)) {
+            test->hdr->width = 0;
             test->hasnotifier = false;
             continue;
         }