Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp657455pxj; Tue, 18 May 2021 11:10:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0DBVVXctoEaPINhtXkbV8eQvCcQBNAfsR0L0wkXepd1kHOsGkw5ljFolWR6D28DIqS7g5 X-Received: by 2002:a6b:b48d:: with SMTP id d135mr5386739iof.107.1621361419878; Tue, 18 May 2021 11:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361419; cv=none; d=google.com; s=arc-20160816; b=F3g7vPHz8GgKoc2p+j8+j1acT3gXCBIh9BGGCpd4+mnENvPcAFF+vS5VK3ePAWe/bi PlNx+fGV5Ad7SqpSn/t320Y3tZ0TV54RdmIpdCYCeEY0r9AZi28HtX6xXRGdYHRyUnzY LjNo7nrMhwwGbAia4hvsQtTFQq+Z6P4uySlYn7LGOfpRURH/CDyWkZzNlHa+3WoQQxgP nULch7wo+OGyv/2iKg8mdSVUr1n4F6LQ2h0NrWtYSBoKbgOWBr7upsaksIGcPKgxPc9u NHDSyVLvuds0+lk45S8j0fwgdTwE/q8kX6KB92Ne+vnnOGMsclu309eEhAgUAKJw9D3N Ji6A== 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=A3vdkpcMwVjhqnYIybJoXGmvA1zgcWI8+IZg1KiQgJg=; b=rdWIypUfRrukjlEnFVwjyetGGK5Un3C+Kxo9diZ8YxohXKwLRt5mld97j4pyuHI7gF nwxeu2RoycYE73fiRfm/ItrewNoy+VWSXV2wnHJhD1awAj+fgwop7y0twQQo5ruCkRln j01pDG/0wT44ljLq3w10j8UoxE28K7RGi6qpLI4MCZ/3aynV0+bypuUmv/2GwKTLhxbY ou+nOTrXXGTrVmOIQdOHK3erJz9aRmNjBwXCG/2FxKdkDvr20hF8y8kUzTZDmQDZMeeC Xi9tsp20VQk9yDHkB4nqnqJD8h0B6LQ+J/e0DumNEYQh0oM/Q5AYUh4NqcuegXVacYdR JL9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wFtKBpLq; 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 x5si23451950ilu.59.2021.05.18.11.10.03; Tue, 18 May 2021 11:10:19 -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=wFtKBpLq; 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 S1347005AbhEQQKx (ORCPT + 99 others); Mon, 17 May 2021 12:10:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242280AbhEQPrJ (ORCPT ); Mon, 17 May 2021 11:47:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61BD961D39; Mon, 17 May 2021 14:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262676; bh=UWAuHH+k11x/vZynb/+xEpgKYE2kwaW20XG/OLYUMuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wFtKBpLqnYDNqBE9D9lv8fpwAd4tzwYpbCCm+n1X6w9jVpF7wNKiHcXPO3XGhRi7z YnkeMiaJa9gJKcpbwkPJMvkawNVLVRg6m3TXxDSAeEydmC8sCDw8yKYJlNAQVdacx2 k40W4wfk6Ev9TTdG7Wk7TlSfTpLgvoZB2nEggwCA= 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.10 257/289] KVM: x86: Move RDPID emulation intercept to its own enum Date: Mon, 17 May 2021 16:03:02 +0200 Message-Id: <20210517140313.799801282@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -7360,8 +7360,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;