ivshmem: Implement shm=... with a memory backend
commit5503e285041979dd29698ecb41729b3b22622e8d
authorMarkus Armbruster <armbru@redhat.com>
Tue, 15 Mar 2016 18:34:46 +0000 (15 19:34 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 21 Mar 2016 20:29:02 +0000 (21 21:29 +0100)
treea5ab5180713ea767b96236b1d8b7134512325072
parent08183c20b8b0782e4c30156eb7202d1117ca22f5
ivshmem: Implement shm=... with a memory backend

ivshmem has its very own code to create and map shared memory.
Replace that with an implicitly created memory backend.  Reduces the
number of ways we create BAR 2 from three to two.

The memory-backend-file is currently available only with CONFIG_LINUX,
so this adds a second Linuxism to ivshmem (the other one is eventfd).
Should we ever need to make it portable to systems where
memory-backend-file can't be made to serve, we could create a
memory-backend-shmem that allocates memory with shm_open().

Bonus fix: shared memory files are now created with permissions 0655
instead of 0777.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1458066895-20632-32-git-send-email-armbru@redhat.com>
hw/misc/ivshmem.c