Received: by 10.223.185.116 with SMTP id b49csp640626wrg; Sat, 10 Feb 2018 15:42:37 -0800 (PST) X-Google-Smtp-Source: AH8x225uGd/yb+bsNkUr/y0AGXzRKpaOLBvOrPgd784okNj2Uals8o25ml0Z50fAl85x5eHFKGX7 X-Received: by 2002:a17:902:7597:: with SMTP id j23-v6mr6713450pll.191.1518306157313; Sat, 10 Feb 2018 15:42:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518306157; cv=none; d=google.com; s=arc-20160816; b=Ht8kK70UqTuHb3aBD5UFJm6raP/juBWEVz/oj7qxDnTRvRzCFiQxAgPcwMhHlC38Ft a+pVKs6gtTZAWVVCoKkVPxD+NZFRfMjt9Ss6ffqa4sg9IO2Lj7huqiUqmvk+/CZaypSY C7qFwZ8QVQK18KJP/t21MqSqA7ipcl3VzS+n7GGX6JsWSZ/AJWiXBJJ6/U7vHytdxwFO 2rKsNmj5YOyXYXhafL6km73V3q04n0yNYSq8VM30aBwxhRLaSPmAZcEFwkMjxy2b9XmI qvedPLkkQLXnDJTFxQJMuQiR0gSrwdJkvMiypAugGwZ9kppeqHRxPYczXTEko8g/uRS/ 8PJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=6XNcdMJBsNL8aoRe+n6aoMc+O2F7jkJzHQqbpyqiAR0=; b=QaAz4iW+lWdmBVKMUPcV7xQ6vo8EFxTnfYT5AsFFgA0k5ImNDngIN8QhvYFUY6W4c7 jrrRhbIZacrUTPxYxe7SwDAXgy1z/zlATZdR88uD1/lYfRIBFo1f/KWuAVYefYbZvEAX 7v54z0/rNli+j4dvySmXqe5caFbR8/zM9RVGtMsoWaFEj53zy9nkDxNUSi9qv449kriL +o+KvIrnjqsSItaFo3pZXPZJ69tIAJ+UMOkhgSy7L1pUU+41EV1aJICChmOStmAfvaGp GkB+i3PzVYkYQVko+Fw7HPVQR8c7wUJFZXLZAPvc4vL8ZWXx0+Z2R9LHknXWPC+4uFQ4 57OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=PxoP1JPS; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b19si2647129pfe.50.2018.02.10.15.42.23; Sat, 10 Feb 2018 15:42:37 -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; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=PxoP1JPS; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753095AbeBJXkg (ORCPT + 99 others); Sat, 10 Feb 2018 18:40:36 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:60670 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752879AbeBJXju (ORCPT ); Sat, 10 Feb 2018 18:39:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.uk; i=@amazon.co.uk; q=dns/txt; s=amazon201209; t=1518305990; x=1549841990; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=6XNcdMJBsNL8aoRe+n6aoMc+O2F7jkJzHQqbpyqiAR0=; b=PxoP1JPSbG5B6BaNzwgtIf+I8+gc78dLZcPaDgkb7995F9enFhDL8pU2 d511QGoX8BaZKtSKSVeQleeCriwbLq9IAyN4Xm4Agigy7sRbFtER+JL5c 4DEo5QV4Rta3Ws9Br9cBqgKGEXuLcxuwghnTxYoDPwugfa8Zo961TA0jr w=; X-IronPort-AV: E=Sophos;i="5.46,492,1511827200"; d="scan'208";a="719069392" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-53356bf6.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2018 23:39:49 +0000 Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2a-53356bf6.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w1ANdhSl006052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Feb 2018 23:39:45 GMT Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (localhost [127.0.0.1]) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w1ANdg3c031609; Sat, 10 Feb 2018 23:39:42 GMT Received: (from dwmw@localhost) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Submit) id w1ANdgs6031608; Sat, 10 Feb 2018 23:39:42 GMT From: David Woodhouse To: tglx@linutronix.de, karahmed@amazon.de, sironi@amazon.de, x86@kernel.org, kvm@vger.kernel.org, torvalds@linux-foundation.org, pbonzini@redhat.com, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, jmattson@google.com, rkrcmar@redhat.com, arjan.van.de.ven@intel.com, dave.hansen@intel.com Subject: [PATCH v2 4/6] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs Date: Sat, 10 Feb 2018 23:39:25 +0000 Message-Id: <1518305967-31356-5-git-send-email-dwmw@amazon.co.uk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518305967-31356-1-git-send-email-dwmw@amazon.co.uk> References: <1518305967-31356-1-git-send-email-dwmw@amazon.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: KarimAllah Ahmed 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. Fixes: 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL") Signed-off-by: KarimAllah Ahmed Signed-off-by: David Woodhouse Reviewed-by: Jim Mattson Cc: Paolo Bonzini Cc: Radim Krčmář Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- 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) -- 2.7.4