mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/pvh: Retrieve memory map from Xen
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
1 parent
765f921598
commit
ef3410a759
6 files changed
+36
-3
No files matched your search
+1
-2
@@ -134,8 +134,7 @@ static struct change_member *change_point[2*E820MAX] __initdata;
|
||||
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;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <xen/lib.h>
|
||||
#include <xen/mm.h>
|
||||
|
||||
#include <asm/e820.h>
|
||||
#include <asm/guest.h>
|
||||
|
||||
#include <public/arch-x86/hvm/start_info.h>
|
||||
@@ -70,10 +71,29 @@ static void __init convert_pvh_info(void)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ static void __init find_xen_leaves(void)
|
||||
|
||||
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;
|
||||
|
||||
@@ -796,7 +796,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
|
||||
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);
|
||||
|
||||
@@ -23,6 +23,7 @@ struct e820map {
|
||||
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(
|
||||
|
||||
@@ -91,6 +91,11 @@ static inline long xen_hypercall_sched_op(unsigned int cmd, void *arg)
|
||||
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
|
||||
*/
|
||||
|
||||