static struct e820entry *overlap_list[E820MAX] __initdata;
static struct e820entry new_bios[E820MAX] __initdata;
-static int __init sanitize_e820_map(struct e820entry *biosmap,
- unsigned int *pnr_map)
+int __init sanitize_e820_map(struct e820entry *biosmap, unsigned int *pnr_map)
{
struct change_member *change_tmp;
unsigned long current_type, last_type;
#include <xen/lib.h>
#include <xen/mm.h>
+#include <asm/e820.h>
#include <asm/guest.h>
#include <public/arch-x86/hvm/start_info.h>
}
}
+static void __init get_memory_map(void)
+{
+ struct xen_memory_map memmap = {
+ .nr_entries = E820MAX,
+ };
+
+ set_xen_guest_handle(memmap.buffer, e820_raw.map);
+ BUG_ON(xen_hypercall_memory_op(XENMEM_memory_map, &memmap));
+ e820_raw.nr_map = memmap.nr_entries;
+
+ /* :( Various toolstacks don't sort the memory map. */
+ sanitize_e820_map(e820_raw.map, &e820_raw.nr_map);
+}
+
multiboot_info_t *__init pvh_init(void)
{
convert_pvh_info();
+ probe_hypervisor();
+ ASSERT(xen_guest);
+
+ get_memory_map();
+
return &pvh_mbi;
}
void __init probe_hypervisor(void)
{
+ if ( xen_guest )
+ return;
+
/* Too early to use cpu_has_hypervisor */
if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) )
return;
if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
panic("dom0 kernel not specified. Check bootloader configuration.");
- if ( efi_enabled(EFI_LOADER) )
+ if ( pvh_boot )
+ {
+ /* pvh_init() already filled in e820_raw */
+ memmap_type = "PVH-e820";
+ }
+ else if ( efi_enabled(EFI_LOADER) )
{
set_pdx_range(xen_phys_start >> PAGE_SHIFT,
(xen_phys_start + BOOTSTRAP_MAP_BASE) >> PAGE_SHIFT);
struct e820entry map[E820MAX];
};
+extern int sanitize_e820_map(struct e820entry *biosmap, unsigned int *pnr_map);
extern int e820_all_mapped(u64 start, u64 end, unsigned type);
extern int reserve_e820_ram(struct e820map *e820, uint64_t s, uint64_t e);
extern int e820_change_range_type(
return _hypercall64_2(long, __HYPERVISOR_sched_op, cmd, arg);
}
+static inline long xen_hypercall_memory_op(unsigned int cmd, void *arg)
+{
+ return _hypercall64_2(long, __HYPERVISOR_memory_op, cmd, arg);
+}
+
/*
* Higher level hypercall helpers
*/