From patchwork Tue Dec 5 10:49:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 173990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3359301vqy; Tue, 5 Dec 2023 03:22:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbeNic1VhPg3O788/mu1TbmSqumTwnrJhsuweNhj1hCwhSZUpC95uKx/mHrLK0Xq6pyFiP X-Received: by 2002:a17:903:120f:b0:1d0:6ffd:adfe with SMTP id l15-20020a170903120f00b001d06ffdadfemr2800736plh.101.1701775378854; Tue, 05 Dec 2023 03:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701775378; cv=none; d=google.com; s=arc-20160816; b=f4YPE7M4WMovBNLQptkfFEi0d6PiLEPkCPSn/zNpNtl5KD+eB1fM9ZvCbTZiZq14Fp V0mk+J4nGD3StSOZCJ0+pnBW7qOqPBsEW1n6u5LeQclTwKOZLBVINFwoOK/02j3a2fAK YxisFuPzKUu7PSgB0lf941CzWjb6VQvRtRViTuHt+pBk2PHIlRMz35g2i6LPALF8VKK4 U3LGtCGRFCXtWutsuSO3FXfNobgI7IwJf32TwWtz2YR/g0fprsq+O2tmiH4E5iIoSjZ5 eOF775K6tZfTv/wOE02H2r57qrK8wCKKxHH3hHFRqlJSxHOPqAd2n5dKTLWU2KbJd9aY qhTg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=weLqfonz8Y9QNLitrw5l9ORWRxzUoxz6mBUoHq0cT8c=; fh=uCCWEUVpLc/xDP/D3WvGY/BxHU9d0NQYu/T71GEsNmA=; b=F+Z6REbttBwFxegVlKmAx6/85Kz4Gm0Yte2fDRpt2MLjeenuqJCaIVXUMCZghfvWw5 lNDiurr8XmBfVb9XqWcAPazLDNEvP+8VYJFekGMk/oAvqmuaqD3PsDbzswNhZCpUICmT dfF0UShttrHqmQNGOOvyVR8yQ17No9ZF4BeVnPmRh8hnmzIxssGRpTkfQ0AHSlpfnLK0 vtVs72B9wPBYolqxauico4bbyeQFj/mZok8iCZMHu6cR/py4PHL6/cFFFAcjmLAZ0DjX IMzrcz8m8YfEqgjr6RlvfvRRFOO7GhWzHNvytcqYknnq1FMM9L0Dif46PZS8CO9K4nt5 slpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XyLhGL09; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id t5-20020a170902b20500b001d08d307f89si4098949plr.496.2023.12.05.03.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 03:22:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XyLhGL09; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8FA94812E36A; Tue, 5 Dec 2023 03:22:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376995AbjLELVg (ORCPT + 99 others); Tue, 5 Dec 2023 06:21:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442058AbjLELVQ (ORCPT ); Tue, 5 Dec 2023 06:21:16 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA358129; Tue, 5 Dec 2023 03:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701775283; x=1733311283; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XAJxKoMf+2QJIK9eDHNvPpRiHTb0PPLqXWearFjnRKA=; b=XyLhGL09gZgHLgZZm9EK6ExUcP3UunRgFMZEq8oGi4Wgdy7H/jeirlHt 1EBLhlxGKdsk4ECFc6Ii53KugrWkQTo6Pa/pF+tP7OqZw0EJnSc3LLJU1 oTqxLvKwLBdn571GaTq71FmATEC+PF5JfRtxYyX+J5svJVOIfq+GJYn0O XdJabtApFa6CNZAIc9sm+tnL2QO86pE6beulgTHzAhF54OdYh/jzermf2 g+WR16MFz7u27aCFAyK4pepUY2gkdO84sdFuchWRANlcwtmjO0CTuqBjZ is8yoZkvt7NOixlR250hrdFgmr3NBXrkiJubpfVEJSTv99QcH9K4JN+zI Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="942396" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="942396" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 03:21:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="1018192916" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="1018192916" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga006.fm.intel.com with ESMTP; 05 Dec 2023 03:21:17 -0800 From: Xin Li To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, pbonzini@redhat.com, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com, nik.borisov@suse.com, shan.kang@intel.com Subject: [PATCH v13 06/35] x86/cpufeatures: Add the CPU feature bit for FRED Date: Tue, 5 Dec 2023 02:49:55 -0800 Message-ID: <20231205105030.8698-7-xin3.li@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205105030.8698-1-xin3.li@intel.com> References: <20231205105030.8698-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 05 Dec 2023 03:22:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440819692660404 X-GMAIL-MSGID: 1784440819692660404 From: "H. Peter Anvin (Intel)" Any FRED CPU will always have the following features as its baseline: 1) LKGS, load attributes of the GS segment but the base address into the IA32_KERNEL_GS_BASE MSR instead of the GS segment’s descriptor cache. 2) WRMSRNS, non-serializing WRMSR for faster MSR writes. Signed-off-by: H. Peter Anvin (Intel) Tested-by: Shan Kang Signed-off-by: Xin Li --- Change since v12: * s/cpu/CPU/g (Borislav Petkov). --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 2 ++ tools/arch/x86/include/asm/cpufeatures.h | 1 + 3 files changed, 4 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index a903fc130e49..fef95d190054 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -324,6 +324,7 @@ #define X86_FEATURE_FZRM (12*32+10) /* "" Fast zero-length REP MOVSB */ #define X86_FEATURE_FSRS (12*32+11) /* "" Fast short REP STOSB */ #define X86_FEATURE_FSRC (12*32+12) /* "" Fast short REP {CMPSB,SCASB} */ +#define X86_FEATURE_FRED (12*32+17) /* Flexible Return and Event Delivery */ #define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */ #define X86_FEATURE_WRMSRNS (12*32+19) /* "" Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */ diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index e462c1d3800a..b7174209d855 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -82,6 +82,8 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_XFD, X86_FEATURE_XGETBV1 }, { X86_FEATURE_AMX_TILE, X86_FEATURE_XFD }, { X86_FEATURE_SHSTK, X86_FEATURE_XSAVES }, + { X86_FEATURE_FRED, X86_FEATURE_LKGS }, + { X86_FEATURE_FRED, X86_FEATURE_WRMSRNS }, {} }; diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index 26a73ae18a86..f433e9f61354 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -321,6 +321,7 @@ #define X86_FEATURE_FZRM (12*32+10) /* "" Fast zero-length REP MOVSB */ #define X86_FEATURE_FSRS (12*32+11) /* "" Fast short REP STOSB */ #define X86_FEATURE_FSRC (12*32+12) /* "" Fast short REP {CMPSB,SCASB} */ +#define X86_FEATURE_FRED (12*32+17) /* Flexible Return and Event Delivery */ #define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */ #define X86_FEATURE_WRMSRNS (12*32+19) /* "" Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */