#include <asm/e820/api.h>
#include <asm/x86_init.h>
-#include <asm/xen/interface.h>
-#include <asm/xen/hypercall.h>
-
#include <xen/xen.h>
-#include <xen/interface/memory.h>
#include <xen/interface/hvm/start_info.h>
/*
return pvh_start_info.rsdp_paddr;
}
-static void __init init_pvh_bootparams(void)
+/*
+ * Xen guests are able to obtain the memory map from the hypervisor via the
+ * HYPERVISOR_memory_op hypercall.
+ * If we are trying to boot a Xen PVH guest, it is expected that the kernel
+ * will have been configured to provide an override for this routine to do
+ * just that.
+ */
+void __init __weak mem_map_via_hcall(struct boot_params *ptr __maybe_unused)
{
- struct xen_memory_map memmap;
- int rc;
+ xen_raw_printk("Error: Could not find memory map\n");
+ BUG();
+}
+static void __init init_pvh_bootparams(void)
+{
memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
- memmap.nr_entries = ARRAY_SIZE(pvh_bootparams.e820_table);
- set_xen_guest_handle(memmap.buffer, pvh_bootparams.e820_table);
- rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
- if (rc) {
- xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
- BUG();
- }
- pvh_bootparams.e820_entries = memmap.nr_entries;
+ mem_map_via_hcall(&pvh_bootparams);
if (pvh_bootparams.e820_entries < E820_MAX_ENTRIES_ZEROPAGE - 1) {
pvh_bootparams.e820_table[pvh_bootparams.e820_entries].addr =
// SPDX-License-Identifier: GPL-2.0
#include <linux/acpi.h>
+#include <xen/hvc-console.h>
+
#include <asm/io_apic.h>
#include <asm/hypervisor.h>
+#include <asm/e820/api.h>
#include <xen/xen.h>
#include <asm/xen/interface.h>
#include <asm/xen/hypercall.h>
+#include <xen/interface/memory.h>
+
/*
* PVH variables.
*
pfn = __pa(hypercall_page);
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
}
+
+void __init mem_map_via_hcall(struct boot_params *boot_params_p)
+{
+ struct xen_memory_map memmap;
+ int rc;
+
+ memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
+ set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
+ rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
+ if (rc) {
+ xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
+ BUG();
+ }
+ boot_params_p->e820_entries = memmap.nr_entries;
+}