]> xenbits.xensource.com Git - people/pauldu/qemu.git/commit
hw/xen: Add xen_overlay device for emulating shared xenheap pages
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 7 Dec 2022 09:19:31 +0000 (09:19 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 29 Jan 2023 15:55:33 +0000 (16:55 +0100)
commit379af2dfb5cb9097d2a13b5d548ba04a400d8cf5
treeed3b063b5b8ccdb467e8a5918ade055d55ef8de8
parent1e203738a2b301a800dfa6f64499190a3284d2f9
hw/xen: Add xen_overlay device for emulating shared xenheap pages

For the shared info page and for grant tables, Xen shares its own pages
from the "Xen heap" to the guest. The guest requests that a given page
from a certain address space (XENMAPSPACE_shared_info, etc.) be mapped
to a given GPA using the XENMEM_add_to_physmap hypercall.

To support that in qemu when *emulating* Xen, create a memory region
(migratable) and allow it to be mapped as an overlay when requested.

Xen theoretically allows the same page to be mapped multiple times
into the guest, but that's hard to track and reinstate over migration,
so we automatically *unmap* any previous mapping when creating a new
one. This approach has been used in production with.... a non-trivial
number of guests expecting true Xen, without any problems yet being
noticed.

This adds just the shared info page for now. The grant tables will be
a larger region, and will need to be overlaid one page at a time. I
think that means I need to create separate aliases for each page of
the overall grant_frames region, so that they can be mapped individually.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
hw/i386/kvm/meson.build
hw/i386/kvm/xen_overlay.c [new file with mode: 0644]
hw/i386/kvm/xen_overlay.h [new file with mode: 0644]
include/sysemu/kvm_xen.h