VMX: add boot parameter to enable/disable APIC-v dynamically
authorYang Zhang <yang.z.zhang@Intel.com>
Tue, 13 Aug 2013 15:47:16 +0000 (17:47 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 13 Aug 2013 15:47:16 +0000 (17:47 +0200)
Add a boot parameter to enable/disable the APIC-v dynamically. APIC-v is
enabled by default. User can use apicv=0 to disable it.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
xen/arch/x86/hvm/vmx/vmcs.c

index de9f592892867d4915e02f0617bdb6935518b5f3..79efb3f639551be4fb82b33e97599b1858e4656e 100644 (file)
@@ -46,6 +46,9 @@ boolean_param("vpid", opt_vpid_enabled);
 static bool_t __read_mostly opt_unrestricted_guest_enabled = 1;
 boolean_param("unrestricted_guest", opt_unrestricted_guest_enabled);
 
+static bool_t __read_mostly opt_apicv_enabled = 1;
+boolean_param("apicv", opt_apicv_enabled);
+
 /*
  * These two parameters are used to config the controls for Pause-Loop Exiting:
  * ple_gap:    upper bound on the amount of time between two successive
@@ -196,12 +199,12 @@ static int vmx_init_vmcs_config(void)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
          * can be set only when "use TPR shadow" is set
          */
-        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
+        if ( (_vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW) &&
+             opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 
-
         _vmx_secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);