[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v13 48/60] i386/xen: Reserve Xen special pages for console, xenst
From: |
David Woodhouse |
Subject: |
[PATCH v13 48/60] i386/xen: Reserve Xen special pages for console, xenstore rings |
Date: |
Thu, 23 Feb 2023 12:46:01 +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 2e697c9cc3..1bb84d8019 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 v13 40/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, (continued)
- [PATCH v13 40/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, David Woodhouse, 2023/02/23
- [PATCH v13 57/60] hw/xen: Support MSI mapping to PIRQ, David Woodhouse, 2023/02/23
- [PATCH v13 54/60] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/02/23
- [PATCH v13 17/60] i386/xen: implement HYPERVISOR_memory_op, David Woodhouse, 2023/02/23
- [PATCH v13 55/60] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/02/23
- [PATCH v13 12/60] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield, David Woodhouse, 2023/02/23
- [PATCH v13 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/02/23
- [PATCH v13 44/60] hw/xen: Support mapping grant frames, David Woodhouse, 2023/02/23
- [PATCH v13 56/60] hw/xen: Support GSI mapping to PIRQ, David Woodhouse, 2023/02/23
- [PATCH v13 33/60] hw/xen: Implement EVTCHNOP_bind_ipi, David Woodhouse, 2023/02/23
- [PATCH v13 48/60] i386/xen: Reserve Xen special pages for console, xenstore rings,
David Woodhouse <=
- [PATCH v13 46/60] hw/xen: Implement GNTTABOP_query_size, David Woodhouse, 2023/02/23
- [PATCH v13 24/60] i386/xen: implement HYPERVISOR_event_channel_op, David Woodhouse, 2023/02/23
- [PATCH v13 18/60] i386/xen: implement XENMEM_add_to_physmap_batch, David Woodhouse, 2023/02/23
- [PATCH v13 03/60] xen: Add XEN_DISABLED mode and make it default, David Woodhouse, 2023/02/23
- [PATCH v13 11/60] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/02/23
- [PATCH v13 51/60] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/02/23
- [PATCH v13 28/60] i386/xen: Add support for Xen event channel delivery to vCPU, David Woodhouse, 2023/02/23
- [PATCH v13 52/60] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/02/23
- [PATCH v13 19/60] i386/xen: implement HYPERVISOR_hvm_op, David Woodhouse, 2023/02/23
- Re: [PATCH v13 00/60] Xen HVM support under KVM, David Woodhouse, 2023/02/24