Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp176476pxj; Tue, 18 May 2021 00:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnRnnxSK5dG1NfSZMyuJ8xvBeLYT+eFbeP+OaZTznozc3E2Enrb6eCLlwnFS/B4+oaHhlD X-Received: by 2002:aa7:dbc9:: with SMTP id v9mr5318373edt.183.1621322516989; Tue, 18 May 2021 00:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621322516; cv=none; d=google.com; s=arc-20160816; b=R8A9I4XR2tkRPCZArjFmi2wQbjyLf1nkpzKUiU38NpqUVIiei22n1qu0aFJq3+LEVc yHjKE5j1uTlWvR1Fxd9tOMAVa/svua1V9GgwJDFWnb465SZLFD3mbwxHU2QNDZBYqf86 5XjKUoZ7lk4Tf7VOEZW4aWk0lfLHs3UxohxccRdogJA8vpYkcMOb6XJ9bi/W4J+VsbR8 okxocCITsCGYODWHVrGxLh8bglzeD0P4Dkmbz5Tt4vOUoK0fy+YooFGLEiayCF24Da1g HtxHzCtwbzylE7HztIObdBNdZCxjbnIBiUmYsdur6igqua6sMqBDHrmFZibL58JuGgnf 9Dgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SN6haatmDyiGNkjo5Uw/wk9KDyVCJsFm+i47HLMCsdU=; b=M3RDtaMu/XWfMeFLK5Jj7OXXhqZpGT5MwEqfVeFcXa3AkEsN9qQ9O0Uk+n7afcBZ0J nCP64jDxzuYsUwAAyId6eLI/zsvPvdyRuDLcrTXh4Huoqt6snMA7Du9On9igLlTn3eJi HVP1NT90+QMDPWT4FHcpoib0o7JoWrUP5JWIu3lrt/Yb/43MT3/uMFtetVyqaD0XEUAH drrwgcaT/NWEAX2bH86M8OD2p+HvNr9QKfzA6sTHr2zmKb84D5/HhlrueYGLrLxl5YpM BSVP5WXaJ+ERfDoyZZG1jPThOBOAAud5o7cPoPTT3SJZt/YTMq9cPi40KsAMkhvjMGF+ XqKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=05MD7wHD; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si18295404edw.241.2021.05.18.00.21.34; Tue, 18 May 2021 00:21:56 -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=@linuxfoundation.org header.s=korg header.b=05MD7wHD; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242146AbhEQOyo (ORCPT + 99 others); Mon, 17 May 2021 10:54:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:37928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241795AbhEQOqC (ORCPT ); Mon, 17 May 2021 10:46:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C928B61019; Mon, 17 May 2021 14:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261294; bh=IFtL26QwaPxLBk/ivzYPQKVMQ9LXgQqQjQoY38t8KRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=05MD7wHDj+FDOupdyrXYB/UeIfXRN+p18tX8LXmZjsTm1+Mu673CuiXlR5abltD/j J/h0iUlS+Xu3a9QQLnT564avjSKif/nCoc8Io1SpKHq1d7J3qSpYMrUqO/6H5JA5oQ H5Ut8drKm4fPLjptEoLk789ab+aPM9TMFs5PB5rI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Paolo Bonzini Subject: [PATCH 5.12 330/363] KVM: x86: Move RDPID emulation intercept to its own enum Date: Mon, 17 May 2021 16:03:16 +0200 Message-Id: <20210517140313.766493322@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 2183de4161b90bd3851ccd3910c87b2c9adfc6ed upstream. 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 Message-Id: <20210504171734.1434054-5-seanjc@google.com> Reviewed-by: Jim Mattson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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), }; --- 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, --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7391,8 +7391,9 @@ static int vmx_check_intercept(struct kv /* * 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;