[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/27] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore
From: |
David Woodhouse |
Subject: |
[PULL 23/27] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore |
Date: |
Tue, 7 Mar 2023 18:27:03 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
We don't actually access the guest's page through the grant, because
this isn't real Xen, and we can just use the page we gave it in the
first place. Map the grant anyway, mostly for cosmetic purposes so it
*looks* like it's in use in the guest-visible grant table.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
hw/i386/kvm/xen_xenstore.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c
index bf466c71ed..2cadafd56a 100644
--- a/hw/i386/kvm/xen_xenstore.c
+++ b/hw/i386/kvm/xen_xenstore.c
@@ -21,6 +21,7 @@
#include "hw/sysbus.h"
#include "hw/xen/xen.h"
+#include "hw/xen/xen_backend_ops.h"
#include "xen_overlay.h"
#include "xen_evtchn.h"
#include "xen_xenstore.h"
@@ -34,6 +35,7 @@
#include "hw/xen/interface/io/xs_wire.h"
#include "hw/xen/interface/event_channel.h"
+#include "hw/xen/interface/grant_table.h"
#define TYPE_XEN_XENSTORE "xen-xenstore"
OBJECT_DECLARE_SIMPLE_TYPE(XenXenstoreState, XEN_XENSTORE)
@@ -66,6 +68,9 @@ struct XenXenstoreState {
uint8_t *impl_state;
uint32_t impl_state_size;
+
+ struct xengntdev_handle *gt;
+ void *granted_xs;
};
struct XenXenstoreState *xen_xenstore_singleton;
@@ -1453,6 +1458,17 @@ int xen_xenstore_reset(void)
}
s->be_port = err;
+ /*
+ * We don't actually access the guest's page through the grant, because
+ * this isn't real Xen, and we can just use the page we gave it in the
+ * first place. Map the grant anyway, mostly for cosmetic purposes so
+ * it *looks* like it's in use in the guest-visible grant table.
+ */
+ s->gt = qemu_xen_gnttab_open();
+ uint32_t xs_gntref = GNTTAB_RESERVED_XENSTORE;
+ s->granted_xs = qemu_xen_gnttab_map_refs(s->gt, 1, xen_domid, &xs_gntref,
+ PROT_READ | PROT_WRITE);
+
return 0;
}
--
2.39.0
- [PULL 03/27] hw/xen: Implement XenStore watches, (continued)
- [PULL 03/27] hw/xen: Implement XenStore watches, David Woodhouse, 2023/03/07
- [PULL 09/27] hw/xen: Add evtchn operations to allow redirection to internal emulation, David Woodhouse, 2023/03/07
- [PULL 20/27] hw/xen: Hook up emulated implementation for event channel operations, David Woodhouse, 2023/03/07
- [PULL 19/27] hw/xen: Only advertise ring-page-order for xen-block if gnttab supports it, David Woodhouse, 2023/03/07
- [PULL 24/27] hw/xen: Implement soft reset for emulated gnttab, David Woodhouse, 2023/03/07
- [PULL 07/27] hw/xen: Implement core serialize/deserialize methods for xenstore_impl, David Woodhouse, 2023/03/07
- [PULL 15/27] hw/xen: Use XEN_PAGE_SIZE in PV backend drivers, David Woodhouse, 2023/03/07
- [PULL 06/27] hw/xen: Implement XenStore permissions, David Woodhouse, 2023/03/07
- [PULL 08/27] hw/xen: Create initial XenStore nodes, David Woodhouse, 2023/03/07
- [PULL 14/27] hw/xen: Move xenstore_store_pv_console_info to xen_console.c, David Woodhouse, 2023/03/07
- [PULL 23/27] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore,
David Woodhouse <=
- [PULL 04/27] hw/xen: Implement XenStore transactions, David Woodhouse, 2023/03/07
- [PULL 21/27] hw/xen: Add emulated implementation of grant table operations, David Woodhouse, 2023/03/07
- [PULL 12/27] hw/xen: Add foreignmem operations to allow redirection to internal emulation, David Woodhouse, 2023/03/07
- [PULL 18/27] hw/xen: Avoid crash when backend watch fires too early, David Woodhouse, 2023/03/07
- [PULL 16/27] hw/xen: Rename xen_common.h to xen_native.h, David Woodhouse, 2023/03/07
- [PULL 17/27] hw/xen: Build PV backend drivers for CONFIG_XEN_BUS, David Woodhouse, 2023/03/07
- [PULL 25/27] i386/xen: Initialize Xen backends from pc_basic_device_init() for emulation, David Woodhouse, 2023/03/07
- [PULL 26/27] MAINTAINERS: Add entry for Xen on KVM emulation, David Woodhouse, 2023/03/07
- [PULL 27/27] docs: Update Xen-on-KVM documentation for PV disk support, David Woodhouse, 2023/03/07
- Re: [PULL 00/27] Enable PV backends with Xen/KVM emulation, Philippe Mathieu-Daudé, 2023/03/07