diff mbox series

[SRU,Bionic,5/6] UBUNTU: SAUCE: [Fix] x86/KVM/VMX: Add L1D flush logic

Message ID 20190410101008.14726-6-juergh@canonical.com
State New
Headers show
Series Bionic: Sync to Xenial (Spectre) (LP: #1822760) | expand

Commit Message

Juerg Haefliger April 10, 2019, 10:10 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1822760

The backport of upstream commit c595ceee4570 ("x86/KVM/VMX: Add L1D flush
logic") incorrectly put the enabling of L1D flushing in
kvm_write_guest_virt_helper() instead of kvm_write_guest_virt_system().

Fixes: f0ace387064d ("x86/KVM/VMX: Add L1D flush logic")
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 arch/x86/kvm/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 058415af8de1..ac17f53812af 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4681,9 +4681,6 @@  static int kvm_write_guest_virt_helper(gva_t addr, void *val, unsigned int bytes
 	void *data = val;
 	int r = X86EMUL_CONTINUE;
 
-	/* kvm_write_guest_virt_system can pull in tons of pages. */
-	vcpu->arch.l1tf_flush_l1d = true;
-
 	while (bytes) {
 		gpa_t gpa =  vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr,
 							     access,
@@ -4725,6 +4722,9 @@  static int emulator_write_std(struct x86_emulate_ctxt *ctxt, gva_t addr, void *v
 int kvm_write_guest_virt_system(struct kvm_vcpu *vcpu, gva_t addr, void *val,
 				unsigned int bytes, struct x86_exception *exception)
 {
+	/* kvm_write_guest_virt_system can pull in tons of pages. */
+	vcpu->arch.l1tf_flush_l1d = true;
+
 	return kvm_write_guest_virt_helper(addr, val, bytes, vcpu,
 					   PFERR_WRITE_MASK, exception);
 }