[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2] x86/hyperv: use dynamically allocated page for hypercalls
Previously Xen placed the hypercall page at the highest possible MFN, but this caused problems on systems where there is more than 36 bits of physical address space. In general, it also seems unreliable to assume that the highest possible MFN is not already reserved for some other purpose. Changes from v1: - Continue to use fixmap infrastructure - Use panic in Hyper-V setup() function instead of returning -ENOMEM on hypercall page allocation failure Fixes: 620fc734f854 ("x86/hyperv: setup hypercall page") Cc: Alejandro Vallejo <agarciav@xxxxxxx> Cc: Alexander M. Merritt <alexander@xxxxxxxxx> Signed-off-by: Ariadne Conill <ariadne@ariadne.space> --- xen/arch/x86/guest/hyperv/hyperv.c | 17 +++++++---------- xen/arch/x86/include/asm/guest/hyperv.h | 3 --- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c index 6989af38f1..0305374a06 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -98,7 +98,13 @@ static void __init setup_hypercall_page(void) rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); if ( !hypercall_msr.enable ) { - mfn = HV_HCALL_MFN; + void *hcall_page = alloc_xenheap_page(); + if ( !hcall_page ) + panic("Hyper-V: Failed to allocate hypercall trampoline page"); + + printk("Hyper-V: Allocated hypercall page @ %p.\n", hcall_page); + + mfn = virt_to_mfn(hcall_page); hypercall_msr.enable = 1; hypercall_msr.guest_physical_address = mfn; wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); @@ -187,14 +193,6 @@ static int cf_check ap_setup(void) return setup_vp_assist(); } -static void __init cf_check e820_fixup(void) -{ - uint64_t s = HV_HCALL_MFN << PAGE_SHIFT; - - if ( !e820_add_range(s, s + PAGE_SIZE, E820_RESERVED) ) - panic("Unable to reserve Hyper-V hypercall range\n"); -} - static int cf_check flush_tlb( const cpumask_t *mask, const void *va, unsigned int flags) { @@ -211,7 +209,6 @@ static const struct hypervisor_ops __initconst_cf_clobber ops = { .name = "Hyper-V", .setup = setup, .ap_setup = ap_setup, - .e820_fixup = e820_fixup, .flush_tlb = flush_tlb, }; diff --git a/xen/arch/x86/include/asm/guest/hyperv.h b/xen/arch/x86/include/asm/guest/hyperv.h index c05efdce71..5792e77104 100644 --- a/xen/arch/x86/include/asm/guest/hyperv.h +++ b/xen/arch/x86/include/asm/guest/hyperv.h @@ -10,9 +10,6 @@ #include <xen/types.h> -/* Use top-most MFN for hypercall page */ -#define HV_HCALL_MFN (((1ull << paddr_bits) - 1) >> HV_HYP_PAGE_SHIFT) - /* * The specification says: "The partition reference time is computed * by the following formula: -- 2.39.5 (Apple Git-154)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |