aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-19 13:53:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-19 13:53:27 -0400
commit3d09c623947a855ab9a21267c31f926cafa2c5bb (patch)
tree718b7bfe9fbfb4843e473310c38d901a152e74a3 /arch
parent92b944170d67fec75ec20e1362fd8ecff078e7d1 (diff)
parent13cd36a37a06ae0318d23b7e60adf0dac3547238 (diff)
Merge tag 'stable/for-linus-3.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull Xen fixes from David Vrabel: "Xen regression and PVH fixes for 3.16-rc1 - fix dom0 PVH memory setup on latest unstable Xen releases - fix 64-bit x86 PV guest boot failure on Xen 3.1 and earlier - fix resume regression on non-PV (auto-translated physmap) guests" * tag 'stable/for-linus-3.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/grant-table: fix suspend for non-PV guests x86/xen: no need to explicitly register an NMI callback Revert "xen/pvh: Update E820 to work with PVH (v2)" x86/xen: fix memory setup for PVH dom0
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/setup.c60
-rw-r--r--arch/x86/xen/xen-ops.h1
3 files changed, 37 insertions, 29 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f17b29210ac4..ffb101e45731 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1537,7 +1537,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
1537 if (!xen_pvh_domain()) 1537 if (!xen_pvh_domain())
1538 pv_cpu_ops = xen_cpu_ops; 1538 pv_cpu_ops = xen_cpu_ops;
1539 1539
1540 x86_init.resources.memory_setup = xen_memory_setup; 1540 if (xen_feature(XENFEAT_auto_translated_physmap))
1541 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1542 else
1543 x86_init.resources.memory_setup = xen_memory_setup;
1541 x86_init.oem.arch_setup = xen_arch_setup; 1544 x86_init.oem.arch_setup = xen_arch_setup;
1542 x86_init.oem.banner = xen_banner; 1545 x86_init.oem.banner = xen_banner;
1543 1546
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 821a11ada590..2e555163c2fe 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,7 +27,6 @@
27#include <xen/interface/memory.h> 27#include <xen/interface/memory.h>
28#include <xen/interface/physdev.h> 28#include <xen/interface/physdev.h>
29#include <xen/features.h> 29#include <xen/features.h>
30#include "mmu.h"
31#include "xen-ops.h" 30#include "xen-ops.h"
32#include "vdso.h" 31#include "vdso.h"
33 32
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
82 81
83 memblock_reserve(start, size); 82 memblock_reserve(start, size);
84 83
85 if (xen_feature(XENFEAT_auto_translated_physmap))
86 return;
87
88 xen_max_p2m_pfn = PFN_DOWN(start + size); 84 xen_max_p2m_pfn = PFN_DOWN(start + size);
89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { 85 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
90 unsigned long mfn = pfn_to_mfn(pfn); 86 unsigned long mfn = pfn_to_mfn(pfn);
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
107 .domid = DOMID_SELF 103 .domid = DOMID_SELF
108 }; 104 };
109 unsigned long len = 0; 105 unsigned long len = 0;
110 int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
111 unsigned long pfn; 106 unsigned long pfn;
112 int ret; 107 int ret;
113 108
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
121 continue; 116 continue;
122 frame = mfn; 117 frame = mfn;
123 } else { 118 } else {
124 if (!xlated_phys && mfn != INVALID_P2M_ENTRY) 119 if (mfn != INVALID_P2M_ENTRY)
125 continue; 120 continue;
126 frame = pfn; 121 frame = pfn;
127 } 122 }
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
159static unsigned long __init xen_release_chunk(unsigned long start, 154static unsigned long __init xen_release_chunk(unsigned long start,
160 unsigned long end) 155 unsigned long end)
161{ 156{
162 /*
163 * Xen already ballooned out the E820 non RAM regions for us
164 * and set them up properly in EPT.
165 */
166 if (xen_feature(XENFEAT_auto_translated_physmap))
167 return end - start;
168
169 return xen_do_chunk(start, end, true); 157 return xen_do_chunk(start, end, true);
170} 158}
171 159
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk(
234 * (except for the ISA region which must be 1:1 mapped) to 222 * (except for the ISA region which must be 1:1 mapped) to
235 * release the refcounts (in Xen) on the original frames. 223 * release the refcounts (in Xen) on the original frames.
236 */ 224 */
237 225 for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
238 /*
239 * PVH E820 matches the hypervisor's P2M which means we need to
240 * account for the proper values of *release and *identity.
241 */
242 for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
243 pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
244 pte_t pte = __pte_ma(0); 226 pte_t pte = __pte_ma(0);
245 227
246 if (pfn < PFN_UP(ISA_END_ADDRESS)) 228 if (pfn < PFN_UP(ISA_END_ADDRESS))
@@ -518,6 +500,35 @@ char * __init xen_memory_setup(void)
518} 500}
519 501
520/* 502/*
503 * Machine specific memory setup for auto-translated guests.
504 */
505char * __init xen_auto_xlated_memory_setup(void)
506{
507 static struct e820entry map[E820MAX] __initdata;
508
509 struct xen_memory_map memmap;
510 int i;
511 int rc;
512
513 memmap.nr_entries = E820MAX;
514 set_xen_guest_handle(memmap.buffer, map);
515
516 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
517 if (rc < 0)
518 panic("No memory map (%d)\n", rc);
519
520 sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
521
522 for (i = 0; i < memmap.nr_entries; i++)
523 e820_add_region(map[i].addr, map[i].size, map[i].type);
524
525 memblock_reserve(__pa(xen_start_info->mfn_list),
526 xen_start_info->pt_base - xen_start_info->mfn_list);
527
528 return "Xen";
529}
530
531/*
521 * Set the bit indicating "nosegneg" library variants should be used. 532 * Set the bit indicating "nosegneg" library variants should be used.
522 * We only need to bother in pure 32-bit mode; compat 32-bit processes 533 * We only need to bother in pure 32-bit mode; compat 32-bit processes
523 * can have un-truncated segments, so wrapping around is allowed. 534 * can have un-truncated segments, so wrapping around is allowed.
@@ -590,13 +601,7 @@ void xen_enable_syscall(void)
590 } 601 }
591#endif /* CONFIG_X86_64 */ 602#endif /* CONFIG_X86_64 */
592} 603}
593void xen_enable_nmi(void) 604
594{
595#ifdef CONFIG_X86_64
596 if (register_callback(CALLBACKTYPE_nmi, (char *)nmi))
597 BUG();
598#endif
599}
600void __init xen_pvmmu_arch_setup(void) 605void __init xen_pvmmu_arch_setup(void)
601{ 606{
602 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 607 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
@@ -611,7 +616,6 @@ void __init xen_pvmmu_arch_setup(void)
611 616
612 xen_enable_sysenter(); 617 xen_enable_sysenter();
613 xen_enable_syscall(); 618 xen_enable_syscall();
614 xen_enable_nmi();
615} 619}
616 620
617/* This function is not called for HVM domains */ 621/* This function is not called for HVM domains */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index c834d4b231f0..97d87659f779 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void);
36void xen_set_pat(u64); 36void xen_set_pat(u64);
37 37
38char * __init xen_memory_setup(void); 38char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void);
39void __init xen_arch_setup(void); 40void __init xen_arch_setup(void);
40void xen_enable_sysenter(void); 41void xen_enable_sysenter(void);
41void xen_enable_syscall(void); 42void xen_enable_syscall(void);