Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4052021pxv; Tue, 13 Jul 2021 09:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+zcJMsNKxMDhhdZV/0I8TxAIt3iiHePSCtRcGH5xcy4XRk39VOfxDfSdFjef2nblbjLqM X-Received: by 2002:a05:6402:524e:: with SMTP id t14mr6978449edd.212.1626194269941; Tue, 13 Jul 2021 09:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626194269; cv=none; d=google.com; s=arc-20160816; b=pXL8GB0kmHva6/xki33CbKe1ytsc0hNMm2llM5PATpWFb1+qbmZOegCD9EUFyi+Ogy yq6/ggHAuMgHvnpEBhkLkfL6lOFhrX8Dew+wlf5k4dzMrmYOjQUxpdUcMvYtOtbZp8kg /7dkYuswuVR/gQ5mcpLs+4mc/BmwnOd+8bDks5cXW3Quai7LYH83qArILLoYcezReOou H1GF88S3+YsVG6MYQFadUGu1ahs5sl1fTX3ABuYWiH9jJRRoH18jqqOXZtNg6uFQLS0y p5lfFgtodmOI/Dh7z5ykojcwnYQMNUiZmRExCaKEkEUvdNS3/N8+6LVEGHhP9NKnGxwJ TajA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=skFR+CsoOPtmRzhI0uP937m12Z4yOYLQ+FONgUtSivg=; b=p9x1Oz1NlegTrLO+cDTxVzJSW1CX9P/Dkm6zwlcXdKgYJwkj5H4WW/gHs6DRkSegYh IAf05s59rJ6mkvKm6J0NeKJrixJMmkhHAXqMBJYnDspMVWGsu4P0gDiADj3pSzDOEzqq VsE4zrLBM9VTlwAcEohyuvoUFuvjBLdw9Zt5gxM7au4rcXg+2gC6/is0E6Mul6Ors1Nm AF3ZE3jPxWxAHKSTN0X2LYVGrPOJpvaBlkj5dVohu2rCqVCwutIwpH6NzLLcfZgAMH3d R0vupcYM80NxPrt3N9W9V+35Tzpfe80gj+5WTJxCkU1iNEz89cRlPUtRpxEm+Xv30eGG j09Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VUNyEnJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si15668625edu.548.2021.07.13.09.37.27; Tue, 13 Jul 2021 09:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VUNyEnJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235717AbhGMQiZ (ORCPT + 99 others); Tue, 13 Jul 2021 12:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235788AbhGMQiN (ORCPT ); Tue, 13 Jul 2021 12:38:13 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE032C061787 for ; Tue, 13 Jul 2021 09:34:39 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id o11-20020a056902110bb029055b266be219so27631026ybu.13 for ; Tue, 13 Jul 2021 09:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=skFR+CsoOPtmRzhI0uP937m12Z4yOYLQ+FONgUtSivg=; b=VUNyEnJAv35fM9G5xqTp30Qf15uHEjgktioN/MXNnOgqOjgJyiLtOthrNo4CVzFWOq 7FR+Pn31WLI7alKgLgS/XhMvOfGAxaHe4IpK9ljxYyt3+SKc1idY430RXnjcELjuIXVD sbBtVq8I51qkeIQANBerUbKhsae8izm7tPGNzxndhYKXxC8DobNsKY5xbUiwWfW4OLEa pmlxZoO9XW0evRHpDwEDCPodNs+K2b9LyydThD520BX4vFv3xRVwDVj5lLAlkcQCfCBe D5rpSDfu6aWIfZXmj0y2PWCz6Ni50PEaTJUukiQh+IPNpu+Wn33QsKFOPTQuWPp+yua6 tvKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=skFR+CsoOPtmRzhI0uP937m12Z4yOYLQ+FONgUtSivg=; b=edzm6az0axfKZAYoU+fmJ5udjKnPAI4FPjb+0xG9jWqUhlDLXvRLj4narp7bEnH4Vb xJxPxktai52gGOq+/EpnE08lhSg/0tMjyzYzbPF8IJQ3Dwm7h07HSOdV1k4OchSRG8Nk AekpToAXrhdW3AErwa3kxA3ixSPd+SLJ0tGqJtcODZcsqe0OwlHbf22e8FHqA2Q4g2vw LRDOVUGj1tnVcC87KtgoRL6rXVqvDxnaoXuMmFtILXZqqDczaStFAe1wu3T8wnr9Ge6w +/VnA/yjKq8W0pS75fyCY0IcqgIcaIWiCOxNJNaVZaROah3j2C/ely1Tfr/TD1ri6+cX 60Cw== X-Gm-Message-State: AOAM5324+9mfHrtaAN64xftVHbjCdp3A1HBWG3Bhk5FhujLO6swpXY0m WuaK5BnSf5mY6bhCwAq4TK5ZkYz5z30= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:825e:11a1:364b:8109]) (user=seanjc job=sendgmr) by 2002:a25:2e49:: with SMTP id b9mr7359056ybn.250.1626194078968; Tue, 13 Jul 2021 09:34:38 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 13 Jul 2021 09:33:12 -0700 In-Reply-To: <20210713163324.627647-1-seanjc@google.com> Message-Id: <20210713163324.627647-35-seanjc@google.com> Mime-Version: 1.0 References: <20210713163324.627647-1-seanjc@google.com> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog Subject: [PATCH v2 34/46] KVM: VMX: Refresh list of user return MSRs after setting guest CPUID From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Reiji Watanabe Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After a CPUID update, refresh the list of user return MSRs that are loaded into hardware when running the vCPU. This is necessary to handle the oddball case where userspace exposes X86_FEATURE_RDTSCP to the guest after the vCPU is running. Fixes: 0023ef39dc35 ("kvm: vmx: Set IA32_TSC_AUX for legacy mode guests") Fixes: 4e47c7a6d714 ("KVM: VMX: Add instruction rdtscp support for guest") Reviewed-by: Reiji Watanabe Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d7a4db15a169..3045daa3ec30 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7159,6 +7159,8 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) /* xsaves_enabled is recomputed in vmx_compute_secondary_exec_control(). */ vcpu->arch.xsaves_enabled = false; + vmx_setup_uret_msrs(vmx); + if (cpu_has_secondary_exec_ctrls()) { vmx_compute_secondary_exec_control(vmx); vmcs_set_secondary_exec_control(vmx); -- 2.32.0.93.g670b81a890-goog