Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1321774yba; Tue, 2 Apr 2019 06:51:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs2gHsbFz/Y4Oq3NUfTqzNpoyo8TFeKRSvj6H/54fiCW20j6mZt59bkasOJdLtwbjk8Oj/ X-Received: by 2002:a17:902:b60d:: with SMTP id b13mr17665434pls.100.1554213062720; Tue, 02 Apr 2019 06:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554213062; cv=none; d=google.com; s=arc-20160816; b=l6A4P9Y/3V0y8z9sBiwSeiPqtslHSP5B8wRekyMn4KBci99t3UxdlfmE1INcFhuh2Y puxBxdN1NzOqic40bAVj+pn84tAZPKdNt9ldYVVeRLwcOiYqpO1MMDsTKCSFiLVFdYky FUWOYTfMXQ0bdZPK5Ukc9gr4EekD6apnzzCLOxPaSPbbR+Ylj8xWc99hi4yX4+esKlFk fnEia73cWfdX2ATyA5mxEsE6ZEmvaBbm2+UoGKG1ff1TSd4DFSqrVxVwtlGVm45PGNiK 2+NukO4CmIamol9ebuNv6/Tdd4oZgnsD7d15KwCGNR0ToaqCj94jZMK+4OgxXucU0EDy e1iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=4WZPeklygAQHdZLCaAujCXHcsWxyr8o8m8RlYgfEJXY=; b=cI28MBpgF9DtcM5um8ApZ9HhYL2wfWUKGKTGE/BWSYPy8OQZlESOnhdul53VQkZSIB pgigQWdXLMiZFdGqWac+7B6NjzAQ6Hs1/ElPAGFvOU7OkTRCcBMJufpLLakPs2mgzFua qTSbkIS6FisA+sCBbKPnf6lfE3HO7dC9Hf6qk7tnzO5KMDOu7Pg0HqDqeelY516Uux71 kA/LRok/bL1VKtMlbVFKARPthCMsVODahI8smBHhuwc8LAF7eo3f531CYEYe0n95mAsw WUhSKq1tbrNsTOoygJcPfgHIbjCOnF3gDRUX0KJCTkScej6ZdPy69InmfYzd6FYtfwbz 3qhg== 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 t11si10922226pgv.275.2019.04.02.06.50.47; Tue, 02 Apr 2019 06:51:02 -0700 (PDT) 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 S1732107AbfDBNsR (ORCPT + 99 others); Tue, 2 Apr 2019 09:48:17 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:42964 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731241AbfDBNkD (ORCPT ); Tue, 2 Apr 2019 09:40:03 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdw-0002nn-H9; Tue, 02 Apr 2019 14:40:00 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdv-0004tB-G6; Tue, 02 Apr 2019 14:39:59 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Marc Orr" , "Jim Mattson" , "Sean Christopherson" , "Liran Alon" , "Peter Shier" , "Paolo Bonzini" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 34/99] kvm: vmx: Set IA32_TSC_AUX for legacy mode guests In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jim Mattson commit 0023ef39dc35c773c436eaa46ca539a26b308b55 upstream. RDTSCP is supported in legacy mode as well as long mode. The IA32_TSC_AUX MSR should be set to the correct guest value before entering any guest that supports RDTSCP. Fixes: 4e47c7a6d714 ("KVM: VMX: Add instruction rdtscp support for guest") Signed-off-by: Jim Mattson Reviewed-by: Peter Shier Reviewed-by: Marc Orr Reviewed-by: Liran Alon Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini [bwh: Backported to 3.16: - Keep testing vmx->rdtscp_enabled instead of guest_cpuid_has() - Adjust filename] Signed-off-by: Ben Hutchings --- arch/x86/kvm/vmx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2077,9 +2077,6 @@ static void setup_msrs(struct vcpu_vmx * index = __find_msr_index(vmx, MSR_CSTAR); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); - index = __find_msr_index(vmx, MSR_TSC_AUX); - if (index >= 0 && vmx->rdtscp_enabled) - move_msr_up(vmx, index, save_nmsrs++); /* * MSR_STAR is only needed on long mode guests, and only * if efer.sce is enabled. @@ -2092,6 +2089,9 @@ static void setup_msrs(struct vcpu_vmx * index = __find_msr_index(vmx, MSR_EFER); if (index >= 0 && update_transition_efer(vmx, index)) move_msr_up(vmx, index, save_nmsrs++); + index = __find_msr_index(vmx, MSR_TSC_AUX); + if (index >= 0 && vmx->rdtscp_enabled) + move_msr_up(vmx, index, save_nmsrs++); vmx->save_nmsrs = save_nmsrs;