Received: by 10.223.185.116 with SMTP id b49csp3368511wrg; Tue, 13 Feb 2018 01:16:19 -0800 (PST) X-Google-Smtp-Source: AH8x226wEd5svNc9VJi4LbuIinxtr8l0kGhYWIL3WXh4tcS/iqaFGmpOgI6+cIWQlR84xX1pT+92 X-Received: by 2002:a17:902:b413:: with SMTP id x19-v6mr501818plr.420.1518513375561; Tue, 13 Feb 2018 01:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518513374; cv=none; d=google.com; s=arc-20160816; b=JuJPUa1NL15VenEkXfbnYqBWR4GlSjdhJWXeuG4jHET32W/OHsaD3SW21VHPID36kU Fd5g92Z1NtuIxdN9gSCrqXR5l3QRXB9ZEq5ZNlRzeoOFZFBOfnJdvYPqtVSfZU6GlZgo FHuc1/+7Z3SOxTd4P1tOO7p8aYfayAP8R11fzKURRjuaVZ0v8ciHPWavLmLB9fpMoVck 0aYEOtopdCF8vKNdDPTx1hGBw3CsbX/7x6zVL652+mICx3dacNxX+NsGHCseGEzCwucE vw1YCqzICtReO74hX5HM2SnQ/PNcQN/vYTtIdOlCA8Tdkxui2m2hFSpumMkFZrqDDxWV eRxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=1K39XiC3QZ2TfxMs/RczFLcYrgCfScmvj2qIh61hVsQ=; b=sKsa/EBvM3QibbhEuy9I9ywbYKM1Ja4RdujmLFZV7oBvsTQQ+IqCbhc6aKHYI8rCIm oHyBYYRsBARmYhuDITRFR/iri9kOIaqWORR5QzktxgOJN23+B8cD3J/TAxtH+5E6gaNd qWj7nKJje4hT3BlSjeq+1MtCT5nK9O6ZmpnDmKfocpbsF8LMvqNyqv/KUbwffJbzNLaf N1x/PaZ5S6l/Z0a05dmRYX3NMmBDJAqqxSHmulH5JyUVOcWS5DvJrSr5xxbI/+mHC+Kh Cl2ok/ikqdYP0tbpf/GHe4Y7bWE6liJJ0uPPOlMDZW2e7IHRcLVgJfpEZiUBQSbcddot +6MQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k72si978190pge.131.2018.02.13.01.16.00; Tue, 13 Feb 2018 01:16:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934601AbeBMJO5 (ORCPT + 99 others); Tue, 13 Feb 2018 04:14:57 -0500 Received: from terminus.zytor.com ([198.137.202.136]:44955 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934573AbeBMJOx (ORCPT ); Tue, 13 Feb 2018 04:14:53 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1D8xFSd024039; Tue, 13 Feb 2018 00:59:15 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1D8xFhc024036; Tue, 13 Feb 2018 00:59:15 -0800 Date: Tue, 13 Feb 2018 00:59:15 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for KarimAllah Ahmed Message-ID: Cc: rkrcmar@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, pbonzini@redhat.com, peterz@infradead.org, arjan@linux.intel.com, mingo@kernel.org, dwmw2@infradead.org, luto@kernel.org, dan.j.williams@intel.com, jmattson@google.com, karahmed@amazon.de, bp@alien8.de, dave.hansen@linux.intel.com, torvalds@linux-foundation.org, dwmw@amazon.co.uk, jpoimboe@redhat.com, hpa@zytor.com, gregkh@linuxfoundation.org Reply-To: rkrcmar@redhat.com, peterz@infradead.org, tglx@linutronix.de, pbonzini@redhat.com, linux-kernel@vger.kernel.org, arjan@linux.intel.com, dwmw2@infradead.org, mingo@kernel.org, karahmed@amazon.de, jmattson@google.com, dan.j.williams@intel.com, luto@kernel.org, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, bp@alien8.de, dwmw@amazon.co.uk, gregkh@linuxfoundation.org, hpa@zytor.com, jpoimboe@redhat.com In-Reply-To: <1518305967-31356-5-git-send-email-dwmw@amazon.co.uk> References: <1518305967-31356-5-git-send-email-dwmw@amazon.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs Git-Commit-ID: 206587a9fb764d71f035dc7f6d3b6488f5d5b304 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 206587a9fb764d71f035dc7f6d3b6488f5d5b304 Gitweb: https://git.kernel.org/tip/206587a9fb764d71f035dc7f6d3b6488f5d5b304 Author: KarimAllah Ahmed AuthorDate: Sat, 10 Feb 2018 23:39:25 +0000 Committer: Ingo Molnar CommitDate: Tue, 13 Feb 2018 09:00:06 +0100 X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs These two variables should check whether SPEC_CTRL and PRED_CMD are supposed to be passed through to L2 guests or not. While msr_write_intercepted_l01 would return 'true' if it is not passed through. So just invert the result of msr_write_intercepted_l01 to implement the correct semantics. Signed-off-by: KarimAllah Ahmed Signed-off-by: David Woodhouse Reviewed-by: Jim Mattson Acked-by: Paolo Bonzini Cc: Andy Lutomirski Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dan Williams Cc: Dave Hansen Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Radim Krčmář Cc: Thomas Gleixner Cc: arjan.van.de.ven@intel.com Cc: dave.hansen@intel.com Cc: kvm@vger.kernel.org Cc: sironi@amazon.de Fixes: 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL") Link: http://lkml.kernel.org/r/1518305967-31356-5-git-send-email-dwmw@amazon.co.uk Signed-off-by: Ingo Molnar --- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index bee4c49..599179b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -10219,8 +10219,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, * updated to reflect this when L1 (or its L2s) actually write to * the MSR. */ - bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD); - bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL); + bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD); + bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL); if (!nested_cpu_has_virt_x2apic_mode(vmcs12) && !pred_cmd && !spec_ctrl)