aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMukesh Rathor <mukesh.rathor@oracle.com>2013-12-13 12:45:31 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-01-06 10:43:59 -0500
commitd285d68314af49c4456b71d248e355dd33ae375c (patch)
treeb189dbf02b54ee5688ca5d985c69e955ca99d534 /arch
parentddc416cbc4e34f52bebca027de1c099bd30795f8 (diff)
xen/pvh: Early bootup changes in PV code (v4).
We don't use the filtering that 'xen_cpuid' is doing because the hypervisor treats 'XEN_EMULATE_PREFIX' as an invalid instruction. This means that all of the filtering will have to be done in the hypervisor/toolstack. Without the filtering we expose to the guest the: - cpu topology (sockets, cores, etc); - the APERF (which the generic scheduler likes to use), see 5e626254206a709c6e937f3dda69bf26c7344f6f "xen/setup: filter APERFMPERF cpuid feature out" - and the inability to figure out whether MWAIT_LEAF should be exposed or not. See df88b2d96e36d9a9e325bfcd12eb45671cbbc937 "xen/enlighten: Disable MWAIT_LEAF so that acpi-pad won't be loaded." - x2apic, see 4ea9b9aca90cfc71e6872ed3522356755162932c "xen: mask x2APIC feature in PV" We also check for vector callback early on, as it is a required feature. PVH also runs at default kernel IOPL. Finally, pure PV settings are moved to a separate function that are only called for pure PV, ie, pv with pvmmu. They are also #ifdef with CONFIG_XEN_PVMMU. Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/enlighten.c48
-rw-r--r--arch/x86/xen/setup.c18
2 files changed, 46 insertions, 20 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fa6ade76ef3f..eb0efc2f9d3c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -46,6 +46,7 @@
46#include <xen/hvm.h> 46#include <xen/hvm.h>
47#include <xen/hvc-console.h> 47#include <xen/hvc-console.h>
48#include <xen/acpi.h> 48#include <xen/acpi.h>
49#include <xen/features.h>
49 50
50#include <asm/paravirt.h> 51#include <asm/paravirt.h>
51#include <asm/apic.h> 52#include <asm/apic.h>
@@ -262,8 +263,9 @@ static void __init xen_banner(void)
262 struct xen_extraversion extra; 263 struct xen_extraversion extra;
263 HYPERVISOR_xen_version(XENVER_extraversion, &extra); 264 HYPERVISOR_xen_version(XENVER_extraversion, &extra);
264 265
265 printk(KERN_INFO "Booting paravirtualized kernel on %s\n", 266 pr_info("Booting paravirtualized kernel %son %s\n",
266 pv_info.name); 267 xen_feature(XENFEAT_auto_translated_physmap) ?
268 "with PVH extensions " : "", pv_info.name);
267 printk(KERN_INFO "Xen version: %d.%d%s%s\n", 269 printk(KERN_INFO "Xen version: %d.%d%s%s\n",
268 version >> 16, version & 0xffff, extra.extraversion, 270 version >> 16, version & 0xffff, extra.extraversion,
269 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); 271 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
@@ -433,7 +435,7 @@ static void __init xen_init_cpuid_mask(void)
433 435
434 ax = 1; 436 ax = 1;
435 cx = 0; 437 cx = 0;
436 xen_cpuid(&ax, &bx, &cx, &dx); 438 cpuid(1, &ax, &bx, &cx, &dx);
437 439
438 xsave_mask = 440 xsave_mask =
439 (1 << (X86_FEATURE_XSAVE % 32)) | 441 (1 << (X86_FEATURE_XSAVE % 32)) |
@@ -1420,6 +1422,19 @@ static void __init xen_setup_stackprotector(void)
1420 pv_cpu_ops.load_gdt = xen_load_gdt; 1422 pv_cpu_ops.load_gdt = xen_load_gdt;
1421} 1423}
1422 1424
1425static void __init xen_pvh_early_guest_init(void)
1426{
1427 if (!xen_feature(XENFEAT_auto_translated_physmap))
1428 return;
1429
1430 if (xen_feature(XENFEAT_hvm_callback_vector))
1431 xen_have_vector_callback = 1;
1432
1433#ifdef CONFIG_X86_32
1434 BUG(); /* PVH: Implement proper support. */
1435#endif
1436}
1437
1423/* First C function to be called on Xen boot */ 1438/* First C function to be called on Xen boot */
1424asmlinkage void __init xen_start_kernel(void) 1439asmlinkage void __init xen_start_kernel(void)
1425{ 1440{
@@ -1431,13 +1446,16 @@ asmlinkage void __init xen_start_kernel(void)
1431 1446
1432 xen_domain_type = XEN_PV_DOMAIN; 1447 xen_domain_type = XEN_PV_DOMAIN;
1433 1448
1449 xen_setup_features();
1450 xen_pvh_early_guest_init();
1434 xen_setup_machphys_mapping(); 1451 xen_setup_machphys_mapping();
1435 1452
1436 /* Install Xen paravirt ops */ 1453 /* Install Xen paravirt ops */
1437 pv_info = xen_info; 1454 pv_info = xen_info;
1438 pv_init_ops = xen_init_ops; 1455 pv_init_ops = xen_init_ops;
1439 pv_cpu_ops = xen_cpu_ops;
1440 pv_apic_ops = xen_apic_ops; 1456 pv_apic_ops = xen_apic_ops;
1457 if (!xen_pvh_domain())
1458 pv_cpu_ops = xen_cpu_ops;
1441 1459
1442 x86_init.resources.memory_setup = xen_memory_setup; 1460 x86_init.resources.memory_setup = xen_memory_setup;
1443 x86_init.oem.arch_setup = xen_arch_setup; 1461 x86_init.oem.arch_setup = xen_arch_setup;
@@ -1469,8 +1487,6 @@ asmlinkage void __init xen_start_kernel(void)
1469 /* Work out if we support NX */ 1487 /* Work out if we support NX */
1470 x86_configure_nx(); 1488 x86_configure_nx();
1471 1489
1472 xen_setup_features();
1473
1474 /* Get mfn list */ 1490 /* Get mfn list */
1475 if (!xen_feature(XENFEAT_auto_translated_physmap)) 1491 if (!xen_feature(XENFEAT_auto_translated_physmap))
1476 xen_build_dynamic_phys_to_machine(); 1492 xen_build_dynamic_phys_to_machine();
@@ -1548,14 +1564,18 @@ asmlinkage void __init xen_start_kernel(void)
1548 /* set the limit of our address space */ 1564 /* set the limit of our address space */
1549 xen_reserve_top(); 1565 xen_reserve_top();
1550 1566
1551 /* We used to do this in xen_arch_setup, but that is too late on AMD 1567 /* PVH: runs at default kernel iopl of 0 */
1552 * were early_cpu_init (run before ->arch_setup()) calls early_amd_init 1568 if (!xen_pvh_domain()) {
1553 * which pokes 0xcf8 port. 1569 /*
1554 */ 1570 * We used to do this in xen_arch_setup, but that is too late
1555 set_iopl.iopl = 1; 1571 * on AMD were early_cpu_init (run before ->arch_setup()) calls
1556 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); 1572 * early_amd_init which pokes 0xcf8 port.
1557 if (rc != 0) 1573 */
1558 xen_raw_printk("physdev_op failed %d\n", rc); 1574 set_iopl.iopl = 1;
1575 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
1576 if (rc != 0)
1577 xen_raw_printk("physdev_op failed %d\n", rc);
1578 }
1559 1579
1560#ifdef CONFIG_X86_32 1580#ifdef CONFIG_X86_32
1561 /* set up basic CPUID stuff */ 1581 /* set up basic CPUID stuff */
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 68c054f59de6..2137c5101dac 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -563,16 +563,13 @@ void xen_enable_nmi(void)
563 BUG(); 563 BUG();
564#endif 564#endif
565} 565}
566void __init xen_arch_setup(void) 566void __init xen_pvmmu_arch_setup(void)
567{ 567{
568 xen_panic_handler_init();
569
570 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 568 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
571 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); 569 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
572 570
573 if (!xen_feature(XENFEAT_auto_translated_physmap)) 571 HYPERVISOR_vm_assist(VMASST_CMD_enable,
574 HYPERVISOR_vm_assist(VMASST_CMD_enable, 572 VMASST_TYPE_pae_extended_cr3);
575 VMASST_TYPE_pae_extended_cr3);
576 573
577 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) || 574 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
578 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback)) 575 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
@@ -581,6 +578,15 @@ void __init xen_arch_setup(void)
581 xen_enable_sysenter(); 578 xen_enable_sysenter();
582 xen_enable_syscall(); 579 xen_enable_syscall();
583 xen_enable_nmi(); 580 xen_enable_nmi();
581}
582
583/* This function is not called for HVM domains */
584void __init xen_arch_setup(void)
585{
586 xen_panic_handler_init();
587 if (!xen_feature(XENFEAT_auto_translated_physmap))
588 xen_pvmmu_arch_setup();
589
584#ifdef CONFIG_ACPI 590#ifdef CONFIG_ACPI
585 if (!(xen_start_info->flags & SIF_INITDOMAIN)) { 591 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
586 printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); 592 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");