diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-10-01 07:12:47 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-10-01 07:30:42 -0400 |
commit | 606decd67049217684e3cb5a54104d51ddd4ef35 (patch) | |
tree | cac2e61715bd29bdb93ab713b2764329d0d9b94a /arch | |
parent | 9bac175d8ed0b1dd3d3611c0713666b724eeace3 (diff) |
Revert "KVM: x86: apply guest MTRR virtualization on host reserved pages"
This reverts commit fd717f11015f673487ffc826e59b2bad69d20fe5.
It was reported to cause Machine Check Exceptions (bug 104091).
Reported-by: harn-solo@gmx.de
Cc: stable@vger.kernel.org # 4.2+
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/svm.c | 7 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 94b7d15db3fc..9e88078f4146 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1167,11 +1167,14 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |||
1167 | u8 mtrr; | 1167 | u8 mtrr; |
1168 | 1168 | ||
1169 | /* | 1169 | /* |
1170 | * 1. MMIO: trust guest MTRR, so same as item 3. | 1170 | * 1. MMIO: always map as UC |
1171 | * 2. No passthrough: always map as WB, and force guest PAT to WB as well | 1171 | * 2. No passthrough: always map as WB, and force guest PAT to WB as well |
1172 | * 3. Passthrough: can't guarantee the result, try to trust guest. | 1172 | * 3. Passthrough: can't guarantee the result, try to trust guest. |
1173 | */ | 1173 | */ |
1174 | if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm)) | 1174 | if (is_mmio) |
1175 | return _PAGE_NOCACHE; | ||
1176 | |||
1177 | if (!kvm_arch_has_assigned_device(vcpu->kvm)) | ||
1175 | return 0; | 1178 | return 0; |
1176 | 1179 | ||
1177 | if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED) && | 1180 | if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED) && |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 64076740251e..06ef4908ba61 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -8617,17 +8617,22 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |||
8617 | u64 ipat = 0; | 8617 | u64 ipat = 0; |
8618 | 8618 | ||
8619 | /* For VT-d and EPT combination | 8619 | /* For VT-d and EPT combination |
8620 | * 1. MMIO: guest may want to apply WC, trust it. | 8620 | * 1. MMIO: always map as UC |
8621 | * 2. EPT with VT-d: | 8621 | * 2. EPT with VT-d: |
8622 | * a. VT-d without snooping control feature: can't guarantee the | 8622 | * a. VT-d without snooping control feature: can't guarantee the |
8623 | * result, try to trust guest. So the same as item 1. | 8623 | * result, try to trust guest. |
8624 | * b. VT-d with snooping control feature: snooping control feature of | 8624 | * b. VT-d with snooping control feature: snooping control feature of |
8625 | * VT-d engine can guarantee the cache correctness. Just set it | 8625 | * VT-d engine can guarantee the cache correctness. Just set it |
8626 | * to WB to keep consistent with host. So the same as item 3. | 8626 | * to WB to keep consistent with host. So the same as item 3. |
8627 | * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep | 8627 | * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep |
8628 | * consistent with host MTRR | 8628 | * consistent with host MTRR |
8629 | */ | 8629 | */ |
8630 | if (!is_mmio && !kvm_arch_has_noncoherent_dma(vcpu->kvm)) { | 8630 | if (is_mmio) { |
8631 | cache = MTRR_TYPE_UNCACHABLE; | ||
8632 | goto exit; | ||
8633 | } | ||
8634 | |||
8635 | if (!kvm_arch_has_noncoherent_dma(vcpu->kvm)) { | ||
8631 | ipat = VMX_EPT_IPAT_BIT; | 8636 | ipat = VMX_EPT_IPAT_BIT; |
8632 | cache = MTRR_TYPE_WRBACK; | 8637 | cache = MTRR_TYPE_WRBACK; |
8633 | goto exit; | 8638 | goto exit; |