Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3776931pxj; Mon, 24 May 2021 14:48:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9gex8s3JTtc3w2mo9PZMJp7yQsRe4pDDKqHFQOxZkC+GxC4GOQr6/neL5LDml8DBNkTKT X-Received: by 2002:a5e:a806:: with SMTP id c6mr14756840ioa.180.1621892904957; Mon, 24 May 2021 14:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621892904; cv=none; d=google.com; s=arc-20160816; b=c566M4VNJ3Re1icVDs8FulWfuxyNBio+aQLeky9USlrCNohEmPI3uVELNz/Oir1sC1 Kr0uAm1+HOVGI0UtDTnEXL34/jtoWyzrOal+j6uHx+StMlBB5hPadey6m2OKW3uwIa0K W4T0m6NmyVPdz6ofBLYbFbQDRQK7u/2kD3gTq7qbfw5HEk3f0vq62sMKqqwhzM1i8RtS 4uEqrOGtGZVznlwk6fcS5DgGoc9RDY5e5HEGdS4Hs7I/z2bzTnZWzqAfSMtUy7FX1Yyh Jy+PDgni2cJ90ie+Xb+TZpwRBJAjRTImjsCcDwJAuvj1BM5idcGvacgOU21t82MhRXRJ 9Dxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bK50K0ZuzWopvsRPDO/W9edrVLo3uYNgj7H36Mg20zU=; b=GAldzObDqyvm/fBa3spW7HQ2jZzyP1+AV63++esepsV6MB5wY6PmeCJf7WU6kbkwvv 5HG7UNUXnEnxY34gN69//tEp0QDNUh7gk3riLzK1yCsZg4gdTnZfMRHM8qdx2gSLjUMx hI3thSiQLC1yHJO00XJuWl29UGdFLObklfheVEwWOfGGUPGsRwisOWTfSpX2LKs8adlX ZGg0JcoE3+ixMwVAYRBTwDxTh+nQwRqIDwwvfA/nRPYQVVgEuSDHuO7YvRp+0mppiLmm aXkx7kfQusSAGguZxNbC/wF6HXxP6H/pX7hgAvceXyTagFgwwbwiNZY4Iigm9TpvNU8v CGnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rLfM8Es5; 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 m1si16584370ilu.13.2021.05.24.14.48.12; Mon, 24 May 2021 14:48:24 -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=rLfM8Es5; 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 S233969AbhEXVfl (ORCPT + 99 others); Mon, 24 May 2021 17:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232744AbhEXVfl (ORCPT ); Mon, 24 May 2021 17:35:41 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62049C061574 for ; Mon, 24 May 2021 14:34:12 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id pi6-20020a17090b1e46b029015cec51d7cdso11926775pjb.5 for ; Mon, 24 May 2021 14:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bK50K0ZuzWopvsRPDO/W9edrVLo3uYNgj7H36Mg20zU=; b=rLfM8Es5WWlEOUqQlzKFMrBsWdFS+YBM0GERCq4zR4U0U8d0oa3zPx8ltLXnFCF+M9 1HgkeNANlCEAbjeUebYF853F9yCjUr7ldIbCtq3bTF2gJBUjUwnierbTlYzb1gKf7iZz W0XzH189RCcLJRRFG6fyC1zKpSnFrCK1gKbXmaO0LHgCNWXHDe+44nmbmHuswCiNfvVr 6x7NQsEQfOygXQZuouwO2ECAPnnzCpF1yUNKvEfx/fxuLRRMy5ihCHZ58qTBaMC8D/co A5tBrYjvyVf0SJSj03RZ3qRgxSVcUthKaI6tfEXcJRiK9nhHTMfNVG1uezekObJZ+rjV O2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bK50K0ZuzWopvsRPDO/W9edrVLo3uYNgj7H36Mg20zU=; b=cN7O/CGnBIRIAlwYdb7iWYXhZYub3ffjcscKyou0hd6x28wVcBN2KESRzzKKtCH+Wy m6zJFINjKhcZbLX/W8pmFFsBvfusgYTb2y3Z20tn2AbYG8M08auEMc5Ioe9sPB123VfD AzaiXa4gvBAT0Kxvhyd+pgyi54tAbfq8b8PL3Zvy2+0gX6KaxtNKUHpEn8mBelw+JbQy xTwxPD0ZaxotA2mMQeNPr64YjvbwPMo541UY2s60kx6skaZiG2/dC3znBC3dQzEQcmyX BBO+5PaYK2GHjOXl+tbF098H9WzZmgQhGSLQQBllWn8+o7GINUM6rH5hX92TebUS2n2Y 20ZQ== X-Gm-Message-State: AOAM531aJzdnbbqANVIvyurwIBiX33tSZGj8uTDY6XY84ArAbJdw+YbX bsWUVbRAhen3o8DZx5K+bzjnTw== X-Received: by 2002:a17:90a:6402:: with SMTP id g2mr26855568pjj.82.1621892051796; Mon, 24 May 2021 14:34:11 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id h1sm11585614pfh.72.2021.05.24.14.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 14:34:11 -0700 (PDT) Date: Mon, 24 May 2021 21:34:07 +0000 From: Sean Christopherson To: Jing Liu Cc: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, jing2.liu@intel.com Subject: Re: [PATCH RFC 1/7] kvm: x86: Expose XFD CPUID to guest Message-ID: References: <20210207154256.52850-1-jing2.liu@linux.intel.com> <20210207154256.52850-2-jing2.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210207154256.52850-2-jing2.liu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I need a formletter for these... GET_SUPPORTED_CPUID advertises support to userspace, it does not expose anything to the guest. On Sun, Feb 07, 2021, Jing Liu wrote: > Intel's Extended Feature Disable (XFD) feature is an extension > to the XSAVE feature that allows an operating system to enable > a feature while preventing specific user threads from using > the feature. A processor that supports XFD enumerates > CPUID.(EAX=0DH,ECX=1):EAX[4] as 1. > > Signed-off-by: Jing Liu > --- > arch/x86/kvm/cpuid.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 83637a2ff605..04a73c395c71 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -437,7 +437,7 @@ void kvm_set_cpu_caps(void) > ); > > kvm_cpu_cap_mask(CPUID_D_1_EAX, > - F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1) | F(XSAVES) > + F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1) | F(XSAVES) | F(XFD) KVM must not advertise support until it actually has said support, i.e. this patch needs to go at the end of the series. Also, adding the kvm_cpu_cap flag in a separate patch isn't strictly required. In most cases, I would go so far as to say that if there is additional enabling to be done, advertising the feature should be done in the same patch that adds the last bits of enabling. Putting the CPUID stuff in its own patch doesn't usually add values, e.g. if there's a bug in the actual support code bisecting will point at the wrong patch if userspace conditions its vCPU model on GET_SUPPORTED_CPUID. > ); > > kvm_cpu_cap_mask(CPUID_8000_0001_ECX, > -- > 2.18.4 >