diff options
| author | Eddie Dong <eddie.dong@intel.com> | 2007-11-11 05:28:35 -0500 |
|---|---|---|
| committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:01 -0500 |
| commit | e5edaa01c4cea5f60c617fac989c6458df0ecc4e (patch) | |
| tree | 39f9d423a89e7447bfbe5c2aeb4704a0ccfbbfd1 | |
| parent | 8a70cc3d0f4877f862ac9cace2e61e4e5116b502 (diff) | |
KVM: VMX: wbinvd exiting
Add wbinvd VM Exit support to prepare for pass-through
device cache emulation and also enhance real time
responsiveness.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
| -rw-r--r-- | drivers/kvm/vmx.c | 11 | ||||
| -rw-r--r-- | drivers/kvm/vmx.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 26719aa9701e..c3bde7532714 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
| @@ -980,7 +980,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
| 980 | #endif | 980 | #endif |
| 981 | if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { | 981 | if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { |
| 982 | min = 0; | 982 | min = 0; |
| 983 | opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; | 983 | opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | |
| 984 | SECONDARY_EXEC_WBINVD_EXITING; | ||
| 984 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS2, | 985 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS2, |
| 985 | &_cpu_based_2nd_exec_control) < 0) | 986 | &_cpu_based_2nd_exec_control) < 0) |
| 986 | return -EIO; | 987 | return -EIO; |
| @@ -2133,6 +2134,13 @@ static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
| 2133 | return 1; | 2134 | return 1; |
| 2134 | } | 2135 | } |
| 2135 | 2136 | ||
| 2137 | static int handle_wbinvd(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
| 2138 | { | ||
| 2139 | skip_emulated_instruction(vcpu); | ||
| 2140 | /* TODO: Add support for VT-d/pass-through device */ | ||
| 2141 | return 1; | ||
| 2142 | } | ||
| 2143 | |||
| 2136 | static int handle_apic_access(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 2144 | static int handle_apic_access(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
| 2137 | { | 2145 | { |
| 2138 | u64 exit_qualification; | 2146 | u64 exit_qualification; |
| @@ -2174,6 +2182,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
| 2174 | [EXIT_REASON_VMCALL] = handle_vmcall, | 2182 | [EXIT_REASON_VMCALL] = handle_vmcall, |
| 2175 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, | 2183 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, |
| 2176 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, | 2184 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, |
| 2185 | [EXIT_REASON_WBINVD] = handle_wbinvd, | ||
| 2177 | }; | 2186 | }; |
| 2178 | 2187 | ||
| 2179 | static const int kvm_vmx_max_exit_handlers = | 2188 | static const int kvm_vmx_max_exit_handlers = |
diff --git a/drivers/kvm/vmx.h b/drivers/kvm/vmx.h index 6d32bc69285e..d52ae8d7303d 100644 --- a/drivers/kvm/vmx.h +++ b/drivers/kvm/vmx.h | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | * Definitions of Secondary Processor-Based VM-Execution Controls. | 49 | * Definitions of Secondary Processor-Based VM-Execution Controls. |
| 50 | */ | 50 | */ |
| 51 | #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 | 51 | #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 |
| 52 | #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 | ||
| 52 | 53 | ||
| 53 | 54 | ||
| 54 | #define PIN_BASED_EXT_INTR_MASK 0x00000001 | 55 | #define PIN_BASED_EXT_INTR_MASK 0x00000001 |
| @@ -223,6 +224,7 @@ enum vmcs_field { | |||
| 223 | #define EXIT_REASON_MWAIT_INSTRUCTION 36 | 224 | #define EXIT_REASON_MWAIT_INSTRUCTION 36 |
| 224 | #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 | 225 | #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 |
| 225 | #define EXIT_REASON_APIC_ACCESS 44 | 226 | #define EXIT_REASON_APIC_ACCESS 44 |
| 227 | #define EXIT_REASON_WBINVD 54 | ||
| 226 | 228 | ||
| 227 | /* | 229 | /* |
| 228 | * Interruption-information format | 230 | * Interruption-information format |
