On Tue, Feb 04, 2020 at 12:30:42PM +0100, i.kotrasi...@partner.samsung.com 
wrote:
> From: Igor Kotrasinski <i.kotrasi...@partner.samsung.com>
> 
> This patchset adds a "memory exposing" device that allows two QEMU
> instances to share arbitrary memory regions. Unlike ivshmem, it does not
> create a new region of memory that's shared between VMs, but instead
> allows one VM to access any memory region of the other VM we choose to
> share.
> 
> The motivation for this device is a sort of ARM Trustzone "emulation",
> where a rich system running on one machine (e.g. x86_64 linux) is able
> to perform SMCs to a trusted system running on another (e.g. OpTEE on
> ARM). With a device that allows sharing arbitrary memory between VMs,
> this can be achieved with minimal changes to the trusted system and its
> linux driver while allowing the rich system to run on a speedier x86
> emulator. I prepared additional patches for linux, OpTEE OS and OpTEE
> build system as a PoC that such emulation works and passes OpTEE tests;
> I'm not sure what would be the best way to share them.
> 
> This patchset is my first foray into QEMU source code and I'm certain
> it's not yet ready to be merged in. I'm not sure whether memory sharing
> code has any race conditions or breaks rules of working with memory
> regions, or if having VMs communicate synchronously via chardevs is the
> right way to do it. I do believe the basic idea for sharing memory
> regions is sound and that it could be useful for inter-VM communication.

Hi,
Without having looked into the patches yet, I'm already wondering if you
can use the existing -object
memory-backend-file,size=512M,mem-path=/my/shared/mem feature for your
use case?

That's the existing mechanism for fully sharing guest RAM and if you
want to share all of memory then maybe a device is not necessary - just
share the memory.

Stefan

> Igor Kotrasinski (9):
>   memory: Add function for finding flat memory ranges
>   memory: Support mmap offset for fd-backed memory regions
>   memory: Hack - use shared memory when possible
>   hw/misc/memexpose: Add documentation
>   hw/misc/memexpose: Add core memexpose files
>   hw/misc/memexpose: Add memexpose pci device
>   hw/misc/memexpose: Add memexpose memory region device
>   hw/misc/memexpose: Add simple tests
>   hw/arm/virt: Hack in support for memexpose device
> 
>  Kconfig.host                            |   3 +
>  MAINTAINERS                             |  12 +
>  Makefile                                |   1 +
>  backends/hostmem-memfd.c                |   2 +-
>  configure                               |   8 +
>  docs/specs/memexpose-spec.txt           | 168 +++++++++
>  exec.c                                  |  10 +-
>  hw/arm/virt.c                           | 110 +++++-
>  hw/core/numa.c                          |   4 +-
>  hw/mem/Kconfig                          |   3 +
>  hw/misc/Makefile.objs                   |   1 +
>  hw/misc/ivshmem.c                       |   3 +-
>  hw/misc/memexpose/Makefile.objs         |   4 +
>  hw/misc/memexpose/memexpose-core.c      | 630 
> ++++++++++++++++++++++++++++++++
>  hw/misc/memexpose/memexpose-core.h      | 109 ++++++
>  hw/misc/memexpose/memexpose-memregion.c | 142 +++++++
>  hw/misc/memexpose/memexpose-memregion.h |  41 +++
>  hw/misc/memexpose/memexpose-msg.c       | 261 +++++++++++++
>  hw/misc/memexpose/memexpose-msg.h       | 161 ++++++++
>  hw/misc/memexpose/memexpose-pci.c       | 218 +++++++++++
>  include/exec/memory.h                   |  20 +
>  include/exec/ram_addr.h                 |   2 +-
>  include/hw/arm/virt.h                   |   5 +
>  include/qemu/mmap-alloc.h               |   1 +
>  memory.c                                |  82 ++++-
>  tests/qtest/Makefile.include            |   2 +
>  tests/qtest/memexpose-test.c            | 364 ++++++++++++++++++
>  util/mmap-alloc.c                       |   7 +-
>  util/oslib-posix.c                      |   2 +-
>  29 files changed, 2360 insertions(+), 16 deletions(-)
>  create mode 100644 docs/specs/memexpose-spec.txt
>  create mode 100644 hw/misc/memexpose/Makefile.objs
>  create mode 100644 hw/misc/memexpose/memexpose-core.c
>  create mode 100644 hw/misc/memexpose/memexpose-core.h
>  create mode 100644 hw/misc/memexpose/memexpose-memregion.c
>  create mode 100644 hw/misc/memexpose/memexpose-memregion.h
>  create mode 100644 hw/misc/memexpose/memexpose-msg.c
>  create mode 100644 hw/misc/memexpose/memexpose-msg.h
>  create mode 100644 hw/misc/memexpose/memexpose-pci.c
>  create mode 100644 tests/qtest/memexpose-test.c
> 
> -- 
> 2.7.4
> 
> 

Attachment: signature.asc
Description: PGP signature

Reply via email to