[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v7bis 11/19] hw/xen: Map guest XENSTORE_PFN grant in emulated
From: |
David Woodhouse |
Subject: |
[RFC PATCH v7bis 11/19] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore |
Date: |
Mon, 16 Jan 2023 22:19:11 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
hw/i386/kvm/xen_xenstore.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c
index 6369e29f59..6e712816d3 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"
@@ -30,13 +31,11 @@
#include "standard-headers/xen/io/xs_wire.h"
#include "standard-headers/xen/event_channel.h"
+#include "standard-headers/xen/grant_table.h"
#define TYPE_XEN_XENSTORE "xen-xenstore"
OBJECT_DECLARE_SIMPLE_TYPE(XenXenstoreState, XEN_XENSTORE)
-#define XEN_PAGE_SHIFT 12
-#define XEN_PAGE_SIZE (1ULL << XEN_PAGE_SHIFT)
-
#define ENTRIES_PER_FRAME_V1 (XEN_PAGE_SIZE / sizeof(grant_entry_v1_t))
#define ENTRIES_PER_FRAME_V2 (XEN_PAGE_SIZE / sizeof(grant_entry_v2_t))
@@ -59,6 +58,8 @@ struct XenXenstoreState {
evtchn_port_t guest_port;
evtchn_port_t be_port;
struct xenevtchn_handle *eh;
+ struct xengntdev_handle *gt;
+ void *granted_xs;
};
struct XenXenstoreState *xen_xenstore_singleton;
@@ -461,5 +462,11 @@ int xen_xenstore_reset(void)
}
s->be_port = err;
+ 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);
+ printf("Granted XS %p\n", s->granted_xs);
+
return 0;
}
--
2.39.0
- [PATCH v7 45/51] hw/xen: Implement GNTTABOP_query_size, (continued)
- [PATCH v7 45/51] hw/xen: Implement GNTTABOP_query_size, David Woodhouse, 2023/01/16
- [PATCH v7 50/51] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/01/16
- [PATCH v7 15/51] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/01/16
- [PATCH v7 51/51] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/01/16
- [PATCH v7 01/51] include: import Xen public headers to include/standard-headers/, David Woodhouse, 2023/01/16
- [PATCH v7 33/51] hw/xen: Implement EVTCHNOP_send, David Woodhouse, 2023/01/16
- [PATCH v7 49/51] hw/xen: Add backend implementation of interdomain event channel support, David Woodhouse, 2023/01/16
- [PATCH v7 22/51] i386/xen: handle VCPUOP_register_runstate_memory_area, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 00/19] Emulated Xen PV backend and PIRQ support, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 13/19] hw/xen: Implement soft reset for emulated gnttab, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 11/19] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore,
David Woodhouse <=
- [RFC PATCH v7bis 16/19] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 03/19] hw/xen: Add gnttab operations to allow redirection to internal emulation, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 05/19] hw/xen: Add foreignmem operations to allow redirection to internal emulation, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 17/19] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 08/19] hw/xen: Use XEN_PAGE_SIZE in PV backend drivers, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 07/19] hw/xen: Move xenstore_store_pv_console_info to xen_console.c, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 06/19] hw/xen: Add xenstore operations to allow redirection to internal emulation, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 15/19] i386/xen: Initialize XenBus and legacy backends from pc_init1(), David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 12/19] hw/xen: Add backend implementation of grant table operations, David Woodhouse, 2023/01/16
- [RFC PATCH v7bis 14/19] hw/xen: Remove old version of Xen headers, David Woodhouse, 2023/01/16