aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-06-20 14:20:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-06-20 14:20:34 +0100
commit7e56accdaf35234b69c33c85e4a44a5d56325e53 (patch)
tree1a29e22fa10915b32b125e6799f69e8f9789d415 /hw/misc
parent5135a1056d913186cc44ce78f2f6994ff23838f7 (diff)
parent49cc0340f8be18871319ffec6efc72147e73ff0b (diff)
downloadqemu-7e56accdaf35234b69c33c85e4a44a5d56325e53.zip
qemu-7e56accdaf35234b69c33c85e4a44a5d56325e53.tar.gz
qemu-7e56accdaf35234b69c33c85e4a44a5d56325e53.tar.bz2
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* nbd and qemu-nbd fixes (Eric, Max) * nbd refactoring (Vladimir) * vhost-user-scsi, take N+1 (Felipe) * replace memory_region_set_fd with memory_region_init_ram_from_fd (Marc-André) * docs/ movement (Paolo) * megasas TOCTOU fixes (Paolo) * make async_safe_run_on_cpu work on kvm/hax accelerators (Paolo) * Build system and poison.h improvements (Thomas) * -accel thread=xxx fix (Thomas) * move files to accel/ (Yang Zhong) # gpg: Signature made Thu 15 Jun 2017 10:51:55 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (41 commits) vhost-user-scsi: Introduce a vhost-user-scsi sample application vhost-user-scsi: Introduce vhost-user-scsi host device qemu-doc: include version number docs: create interop/ subdirectory include/exec/poison: Mark some CONFIG defines as poisoned, too include/exec/poison: Add missing TARGET defines nbd/server: refactor nbd_trip nbd/server: rename rc to ret nbd/server: get rid of fail: return rc nbd/server: nbd_negotiate: fix error path nbd/server: remove NBDClientNewData nbd/server: refactor nbd_co_receive_request nbd/server: get rid of EAGAIN dead code nbd/server: refactor nbd_co_send_reply nbd/server: get rid of ssize_t nbd/server: get rid of nbd_negotiate_read and friends nbd: make nbd_drop public nbd: rename read_sync and friends accel: move kvm related accelerator files into accel/ tcg: move tcg backend files into accel/tcg/ ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/ivshmem.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 6367d04..2f0819d 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -491,9 +491,9 @@ static void setup_interrupt(IVShmemState *s, int vector, Error **errp)
static void process_msg_shmem(IVShmemState *s, int fd, Error **errp)
{
+ Error *local_err = NULL;
struct stat buf;
size_t size;
- void *ptr;
if (s->ivshmem_bar2) {
error_setg(errp, "server sent unexpected shared memory message");
@@ -522,15 +522,13 @@ static void process_msg_shmem(IVShmemState *s, int fd, Error **errp)
}
/* mmap the region and map into the BAR2 */
- ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (ptr == MAP_FAILED) {
- error_setg_errno(errp, errno, "Failed to mmap shared memory");
- close(fd);
+ memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s),
+ "ivshmem.bar2", size, true, fd, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
return;
}
- memory_region_init_ram_ptr(&s->server_bar2, OBJECT(s),
- "ivshmem.bar2", size, ptr);
- memory_region_set_fd(&s->server_bar2, fd);
+
s->ivshmem_bar2 = &s->server_bar2;
}