[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v1 11/15] hw/xen: Map guest XENSTORE_PFN grant in emulated Xe
From: |
David Woodhouse |
Subject: |
[RFC PATCH v1 11/15] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore |
Date: |
Tue, 10 Jan 2023 12:37:50 +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.35.3
- Re: [PATCH v6 17/51] i386/xen: implement XENMEM_add_to_physmap_batch, (continued)
- [PATCH v6 11/51] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/01/10
- [PATCH v6 51/51] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/01/10
- [PATCH v6 23/51] i386/xen: implement HYPERVISOR_event_channel_op, David Woodhouse, 2023/01/10
- [PATCH v6 31/51] hw/xen: Implement EVTCHNOP_bind_virq, David Woodhouse, 2023/01/10
- [PATCH v6 01/51] include: import Xen public headers to include/standard-headers/, David Woodhouse, 2023/01/10
- [RFC PATCH v1 00/15] Xen PV backend support for KVM/Xen guests, David Woodhouse, 2023/01/10
- [RFC PATCH v1 11/15] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore,
David Woodhouse <=
- [RFC PATCH v1 08/15] hw/xen: Use XEN_PAGE_SIZE in PV backend drivers, David Woodhouse, 2023/01/10
- [RFC PATCH v1 05/15] hw/xen: Add foreignmem operations to allow redirection to internal emulation, David Woodhouse, 2023/01/10
- [RFC PATCH v1 10/15] hw/xen: Build PV backend drivers for XENFV_MACHINE, David Woodhouse, 2023/01/10
- [RFC PATCH v1 09/15] hw/xen: Rename xen_common.h to xen_native.h, David Woodhouse, 2023/01/10
- [RFC PATCH v1 15/15] i386/xen: Initialize XenBus and legacy backends from pc_init1(), David Woodhouse, 2023/01/10
- [RFC PATCH v1 14/15] hw/xen: Remove old version of Xen headers, David Woodhouse, 2023/01/10
- [RFC PATCH v1 12/15] hw/xen: Add backend implementation of grant table operations, David Woodhouse, 2023/01/10
- [RFC PATCH v1 04/15] hw/xen: Pass grant ref to gnttab unmap, David Woodhouse, 2023/01/10
- [RFC PATCH v1 13/15] hw/xen: Implement soft reset for emulated gnttab, David Woodhouse, 2023/01/10
- [RFC PATCH v1 07/15] hw/xen: Move xenstore_store_pv_console_info to xen_console.c, David Woodhouse, 2023/01/10