Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3872103pxy; Tue, 4 May 2021 11:48:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQvpXb/aEkNLYefcSJdFp5FopvztcXfhJy9Q2ZdMoqV909kMm80YbaYSqIy0V3KRHcPCDt X-Received: by 2002:a17:906:6ad0:: with SMTP id q16mr4772439ejs.286.1620154087448; Tue, 04 May 2021 11:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620154087; cv=none; d=google.com; s=arc-20160816; b=Z9f4EHgxLKUmvrbH9MzyWSjJDW8Zngl6SvtXhlAQse+8XkGaG9kyg74EK034m77Qnu ukwTaKYMSnxBukgYDj+lNdN8P/ZBd0Vf7cVzck28I11Ha1le1vhcH4bK0hXSLhVbdNg3 8/7x//Gj8XMXK0Qr0QRpVs49+J72e0shM3hbV4o5L0aGCKLQ5DJ8OekFJV/+B9T4uIMD e9iO2lwRWqpZ9WhtgmRcoaSIpdY+tyEs1VmGYbCjmZi9VhUORnBt/nRRB8K48Xa6cC6G 4tRwFeDa/19U4c4uHzE3PWLLgCMs9BJa3eLh65SqMrdM7nHX0Hr1kDX6aHVY+bZD4UVb 1aVQ== 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=x9ju8Y95QmZw6Siui/FK/R18zMsSmb8w0Q5nDcsgnqg=; b=WpBeBctopMW3SucGXsNEuJfvE5oiwf2h/zJt8ZCWlNTgZg5C+oulIlG4YS3bpcAEPE BnVeleyTnNKP1cmipthINbm9AsuiqJgqRgqVf0rWMSfL12Lyro/5bepm7bYgbvafZkzW aC3cnywMPOtsXX8HQFBbY2yHI6qozG4VO0JRfhplpBMuNl4tp8NyFFn4EK+GabCL3Dv/ G3jvqz0BQBHE3E5/2jfcnwaMN2qImjs0TrmqltXjGf5PT2eZAZVTEGZeTB4mAni1+sMG 3+NAlEzslWx10RA2amMHzvy1qSZmrCkDoLsKl7qoAkI1J5K5cSbnH6+ymU5qxTAFsHEu q/UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="v/A3HzwL"; 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 z28si11988417edm.490.2021.05.04.11.47.40; Tue, 04 May 2021 11:48:07 -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="v/A3HzwL"; 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 S232195AbhEDRS7 (ORCPT + 99 others); Tue, 4 May 2021 13:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232100AbhEDRSr (ORCPT ); Tue, 4 May 2021 13:18:47 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66407C061574 for ; Tue, 4 May 2021 10:17:52 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id w5-20020a63a7450000b029020ee691d6a0so5654896pgo.13 for ; Tue, 04 May 2021 10:17:52 -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=x9ju8Y95QmZw6Siui/FK/R18zMsSmb8w0Q5nDcsgnqg=; b=v/A3HzwLp+vZV56pMiyGse3+Y7Ns38lqueNgFzl39BqNJ8/nNkwrQwLE7jj0HL6n3b bTksTsCS/rwy4KFIpqe8pt2TgSLjkyG/8jr8S2+csy2GFj3kf+Vk+b2KJ26ri0osQnAE 7zOM779YwH3NA+nudqbsxSiBW7gUOdYB7+pZA91l7wUgytk0IAsvHC0yI4FxxC1QaTRT EjKP0xq8zK8bmp7mNLxzwGD66AvagO8ZGcuyxa2AVrDT1g0uouUrsyQULAtR4oy9IMWQ hvXGsaW34984PFebHKAzJblE8fgtliDC98prZJTZwDWp655aymPS2gaOd3APbn2NyhSc m39w== 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=x9ju8Y95QmZw6Siui/FK/R18zMsSmb8w0Q5nDcsgnqg=; b=MqDDIZpxGKPrrA/45opea23dXKSUCc1Go2r+VHg+6f8KrJRNLE2qjaJ1CNuaWFadTH SPbpz1e9xHyxwPrEYp5+Zg3HzmBaWrKLF58873nZSOuDe1OsesuSdP2Lh+COGTZMw10C 6/oLyw1EWbi6BWtE1NYvWKmGDQ0i67+MnZBBOtrpAxR4YpG/+TdjKL7hEqA6NnMXtKt5 su3W+/b+bCtqWJ1AsBTpME2AzPhe/hJA+JIeZ+cPDhAOqSPS+ATSeTADrf2LE6rtK58D Ghts1y9nhDVLLHooG3FTi9GC1d9ZW6RTGApDl5KKqQXHk3XXgmHK+f0t0zUIO3kmeuhj NjPw== X-Gm-Message-State: AOAM530CrqL2NJTuQJ7HZxTYG67XEEAtUNnJ96UY09GaijBUrnrpcFys BZuejLAlvZ2GFpEXOqRBRUVodvkEZVs= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:df57:48cb:ea33:a156]) (user=seanjc job=sendgmr) by 2002:a17:90a:f690:: with SMTP id cl16mr29862523pjb.207.1620148671954; Tue, 04 May 2021 10:17:51 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 4 May 2021 10:17:23 -0700 In-Reply-To: <20210504171734.1434054-1-seanjc@google.com> Message-Id: <20210504171734.1434054-5-seanjc@google.com> Mime-Version: 1.0 References: <20210504171734.1434054-1-seanjc@google.com> X-Mailer: git-send-email 2.31.1.527.g47e6f16901-goog Subject: [PATCH 04/15] KVM: x86: Move RDPID emulation intercept to its own enum 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, Xiaoyao Li , Reiji Watanabe Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a dedicated intercept enum for RDPID instead of piggybacking RDTSCP. Unlike VMX's ENABLE_RDTSCP, RDPID is not bound to SVM's RDTSCP intercept. Fixes: fb6d4d340e05 ("KVM: x86: emulate RDPID") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/x86/kvm/emulate.c | 2 +- arch/x86/kvm/kvm_emulate.h | 1 + arch/x86/kvm/vmx/vmx.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index abd9a4db11a8..8fc71e70857d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -4502,7 +4502,7 @@ static const struct opcode group8[] = { * from the register case of group9. */ static const struct gprefix pfx_0f_c7_7 = { - N, N, N, II(DstMem | ModRM | Op3264 | EmulateOnUD, em_rdpid, rdtscp), + N, N, N, II(DstMem | ModRM | Op3264 | EmulateOnUD, em_rdpid, rdpid), }; diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h index 0d359115429a..f016838faedd 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -468,6 +468,7 @@ enum x86_intercept { x86_intercept_clgi, x86_intercept_skinit, x86_intercept_rdtscp, + x86_intercept_rdpid, x86_intercept_icebp, x86_intercept_wbinvd, x86_intercept_monitor, diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 82404ee2520e..99591e523b47 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7437,8 +7437,9 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu, /* * RDPID causes #UD if disabled through secondary execution controls. * Because it is marked as EmulateOnUD, we need to intercept it here. + * Note, RDPID is hidden behind ENABLE_RDTSCP. */ - case x86_intercept_rdtscp: + case x86_intercept_rdpid: if (!nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_RDTSCP)) { exception->vector = UD_VECTOR; exception->error_code_valid = false; -- 2.31.1.527.g47e6f16901-goog