Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2017-12-11 11:42:40 +0100
committerJuergen Gross <jgross@suse.com>2017-12-11 11:42:56 +0100
commit31b9c9d22c0e2a6dfa96d213ad83e8c950a74e3e (patch)
treee6db9e8ef29dc6dbdedabcd6b9ed962f15f3ebcf
parent9ebe23d4b8a1c1a61970f5ade81de9fcf9b9641f (diff)
xen: fix hvm guest with kaslr enabled (bnc#1071891).
-rw-r--r--arch/x86/xen/enlighten_hvm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index f7bf3a7529c8..d1d37631d9c0 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -12,6 +12,7 @@
#include <asm/setup.h>
#include <asm/hypervisor.h>
#include <asm/e820/api.h>
+#include <asm/early_ioremap.h>
#include <asm/xen/cpuid.h>
#include <asm/xen/hypervisor.h>
@@ -21,6 +22,8 @@
#include "mmu.h"
#include "smp.h"
+static unsigned long shared_info_pfn;
+
void xen_hvm_init_shared_info(void)
{
int cpu;
@@ -29,7 +32,7 @@ void xen_hvm_init_shared_info(void)
xatp.domid = DOMID_SELF;
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
- xatp.gpfn = virt_to_pfn(HYPERVISOR_shared_info);
+ xatp.gpfn = shared_info_pfn;
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
BUG();
@@ -68,8 +71,16 @@ static void __init reserve_shared_info(void)
pa += PAGE_SIZE)
;
+ shared_info_pfn = PHYS_PFN(pa);
+
memblock_reserve(pa, PAGE_SIZE);
- HYPERVISOR_shared_info = __va(pa);
+ HYPERVISOR_shared_info = early_memremap(pa, PAGE_SIZE);
+}
+
+static void __init xen_hvm_init_mem_mapping(void)
+{
+ early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE);
+ HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
}
static void __init init_hvm_pv_info(void)
@@ -230,5 +241,6 @@ const struct hypervisor_x86 x86_hyper_xen_hvm = {
.init_platform = xen_hvm_guest_init,
.pin_vcpu = xen_pin_vcpu,
.x2apic_available = xen_x2apic_para_available,
+ .init_mem_mapping = xen_hvm_init_mem_mapping,
};
EXPORT_SYMBOL(x86_hyper_xen_hvm);