diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-07-18 09:35:51 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-07-18 09:35:51 +0100 |
commit | 4d121a549869b93475ccf8b9a0d3e693011d1abb (patch) | |
tree | d188f95c7c8c4297361bf80d033b71b67dbabec9 /tests | |
parent | 5734d031aa2fdb442410ca958ca5382d54fd71ff (diff) | |
parent | cd98639f673d92836b6b5fd60279b411748f2f1e (diff) |
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc,vhost,test fixes
Minor bugfixes all over the place.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Fri 18 Jul 2014 00:43:04 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg: aka "Michael S. Tsirkin <mst@redhat.com>"
* remotes/mst/tags/for_upstream:
vhost-user: minor cleanups
qtest: Adapt vhost-user-test to latest vhost-user changes
vhost-user: Fix VHOST_SET_MEM_TABLE processing
qtest: fix vhost-user-test compilation with old GLib
fix typo: apci -> acpi
pc_piix: Reuse pc_compat_1_2() for pc-0.1[0123]
pc: fix qemu exiting with error when -m X < 128 with old machines types
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vhost-user-test.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 406ba70941..75fedf0977 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -76,6 +76,7 @@ typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory { @@ -205,6 +206,7 @@ static void read_guest_mem(void) uint32_t *guest_mem; gint64 end_time; int i, j; + size_t size; g_mutex_lock(data_mutex); @@ -231,8 +233,13 @@ static void read_guest_mem(void) g_assert_cmpint(memory.regions[i].memory_size, >, 1024); - guest_mem = mmap(0, memory.regions[i].memory_size, - PROT_READ | PROT_WRITE, MAP_SHARED, fds[i], 0); + size = memory.regions[i].memory_size + memory.regions[i].mmap_offset; + + guest_mem = mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, fds[i], 0); + + g_assert(guest_mem != MAP_FAILED); + guest_mem += (memory.regions[i].mmap_offset / sizeof(*guest_mem)); for (j = 0; j < 256; j++) { uint32_t a = readl(memory.regions[i].guest_phys_addr + j*4); |