diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f7b20b417a3a..10a481b7674d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2168,7 +2168,10 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) | |||
2168 | { | 2168 | { |
2169 | unsigned long *msr_bitmap; | 2169 | unsigned long *msr_bitmap; |
2170 | 2170 | ||
2171 | if (irqchip_in_kernel(vcpu->kvm) && apic_x2apic_mode(vcpu->arch.apic)) { | 2171 | if (is_guest_mode(vcpu)) |
2172 | msr_bitmap = vmx_msr_bitmap_nested; | ||
2173 | else if (irqchip_in_kernel(vcpu->kvm) && | ||
2174 | apic_x2apic_mode(vcpu->arch.apic)) { | ||
2172 | if (is_long_mode(vcpu)) | 2175 | if (is_long_mode(vcpu)) |
2173 | msr_bitmap = vmx_msr_bitmap_longmode_x2apic; | 2176 | msr_bitmap = vmx_msr_bitmap_longmode_x2apic; |
2174 | else | 2177 | else |
@@ -9218,9 +9221,9 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) | |||
9218 | } | 9221 | } |
9219 | 9222 | ||
9220 | if (cpu_has_vmx_msr_bitmap() && | 9223 | if (cpu_has_vmx_msr_bitmap() && |
9221 | exec_control & CPU_BASED_USE_MSR_BITMAPS && | 9224 | exec_control & CPU_BASED_USE_MSR_BITMAPS) { |
9222 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12)) { | 9225 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12); |
9223 | vmcs_write64(MSR_BITMAP, __pa(vmx_msr_bitmap_nested)); | 9226 | /* MSR_BITMAP will be set by following vmx_set_efer. */ |
9224 | } else | 9227 | } else |
9225 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; | 9228 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; |
9226 | 9229 | ||