[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v11 48/59] i386/xen: Reserve Xen special pages for console, xenst
From: |
David Woodhouse |
Subject: |
[PATCH v11 48/59] i386/xen: Reserve Xen special pages for console, xenstore rings |
Date: |
Thu, 16 Feb 2023 06:24:33 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
Xen has eight frames at 0xfeff8000 for this; we only really need two for
now and KVM puts the identity map at 0xfeffc000, so limit ourselves to
four.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
include/sysemu/kvm_xen.h | 8 ++++++++
target/i386/kvm/xen-emu.c | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/sysemu/kvm_xen.h b/include/sysemu/kvm_xen.h
index 7fee28dec7..0b63bb81df 100644
--- a/include/sysemu/kvm_xen.h
+++ b/include/sysemu/kvm_xen.h
@@ -30,4 +30,12 @@ uint16_t kvm_xen_get_gnttab_max_frames(void);
#define kvm_xen_has_cap(cap) (!!(kvm_xen_get_caps() & \
KVM_XEN_HVM_CONFIG_ ## cap))
+#define XEN_SPECIAL_AREA_ADDR 0xfeff8000UL
+#define XEN_SPECIAL_AREA_SIZE 0x4000UL
+
+#define XEN_SPECIALPAGE_CONSOLE 0
+#define XEN_SPECIALPAGE_XENSTORE 1
+
+#define XEN_SPECIAL_PFN(x) ((XEN_SPECIAL_AREA_ADDR >> TARGET_PAGE_BITS) +
XEN_SPECIALPAGE_##x)
+
#endif /* QEMU_SYSEMU_KVM_XEN_H */
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 4781b1fa97..f55ab08959 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -23,6 +23,7 @@
#include "hw/pci/msi.h"
#include "hw/i386/apic-msidef.h"
+#include "hw/i386/e820_memory_layout.h"
#include "hw/i386/kvm/xen_overlay.h"
#include "hw/i386/kvm/xen_evtchn.h"
#include "hw/i386/kvm/xen_gnttab.h"
@@ -169,6 +170,15 @@ int kvm_xen_init(KVMState *s, uint32_t hypercall_msr)
}
s->xen_caps = xen_caps;
+
+ /* Tell fw_cfg to notify the BIOS to reserve the range. */
+ ret = e820_add_entry(XEN_SPECIAL_AREA_ADDR, XEN_SPECIAL_AREA_SIZE,
+ E820_RESERVED);
+ if (ret < 0) {
+ fprintf(stderr, "e820_add_entry() table is full\n");
+ return ret;
+ }
+
return 0;
}
--
2.39.0
- [PATCH v11 16/59] i386/xen: manage and save/restore Xen guest long_mode setting, (continued)
- [PATCH v11 16/59] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/02/16
- [PATCH v11 35/59] hw/xen: Implement EVTCHNOP_alloc_unbound, David Woodhouse, 2023/02/16
- [PATCH v11 53/59] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests, David Woodhouse, 2023/02/16
- [PATCH v11 37/59] hw/xen: Implement EVTCHNOP_bind_vcpu, David Woodhouse, 2023/02/16
- [PATCH v11 38/59] hw/xen: Implement EVTCHNOP_reset, David Woodhouse, 2023/02/16
- [PATCH v11 11/59] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/02/16
- [PATCH v11 25/59] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/02/16
- [PATCH v11 58/59] kvm/i386: Add xen-evtchn-max-pirq property, David Woodhouse, 2023/02/16
- [PATCH v11 04/59] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2023/02/16
- [PATCH v11 07/59] xen-platform: exclude vfio-pci from the PCI platform unplug, David Woodhouse, 2023/02/16
- [PATCH v11 48/59] i386/xen: Reserve Xen special pages for console, xenstore rings,
David Woodhouse <=
- [PATCH v11 51/59] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/02/16
- [PATCH v11 01/59] include: import Xen public headers to hw/xen/interface, David Woodhouse, 2023/02/16
- [PATCH v11 12/59] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield, David Woodhouse, 2023/02/16
- [PATCH v11 55/59] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/02/16
- [PATCH v11 29/59] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/02/16
- [PATCH v11 18/59] i386/xen: implement XENMEM_add_to_physmap_batch, David Woodhouse, 2023/02/16
- [PATCH v11 54/59] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/02/16
- [PATCH v11 03/59] xen: Add XEN_DISABLED mode and make it default, David Woodhouse, 2023/02/16
- [PATCH v11 52/59] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/02/16
- [PATCH v11 28/59] i386/xen: Add support for Xen event channel delivery to vCPU, David Woodhouse, 2023/02/16