From patchwork Sat Sep 23 09:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 143963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp292292vqu; Sat, 23 Sep 2023 10:20:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiZ3RnGlKQbqA/O50/21+xbBoQxsMLO1trCapRvdEqAHc/9xVpSR23LaRh2atJSR5J4KIY X-Received: by 2002:a17:902:b609:b0:1c4:4efc:90a6 with SMTP id b9-20020a170902b60900b001c44efc90a6mr2435685pls.38.1695489652817; Sat, 23 Sep 2023 10:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695489652; cv=none; d=google.com; s=arc-20160816; b=PgIZe41UOm6G4Nx2/GOFHFyR0d2l4rXEu04oCRIq/nCK4uRON+F6j6wMwEcFo/VjsL ahcYnEtoH60CmfUdjAGInHRW/RZXf82XE1Kot4tIr9EFF0X4w5m9Y6MEhJBycJSAqHP/ IfJpQwX/l2GlXJY8KyLgZvihuK6oRF1VvtIAaYMCjGPnlzdvHhWrcd6WVXU2sNRx6KT7 IKy0DMVatE1VWskxihAQa93GKQ9zHNBWiQjk5zgbhPuHkcySc774QQw+D5Yv/BdZCru0 wjPwC8Tglkb9/iHfwyqoJiV+2mG3FlDviowHdvRxKiEjlhTfUtRhtpLqbV6t9dY5v0Zs ILAg== 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=XeJwpr9tQC+gKBydBAWHltVsv05Ksn3BrsZLK1lp1P8=; fh=Tb1p8S3iOxe/kX/WSNC3xEJzSVgGJ5DaxSrKb+pzH+4=; b=zKNgzYnpu1sPt2c3YgsG7WipllMdH0lTsdFxaYXqBRiwlXwBI4CjD1mCoCzPMvscsD FkY7ob5LFqMmHIjyBRR73Al6fpId0jP5w5L7VLrVwVjKjjlmRzlDS+GJZwjdH2cWQSPN 6Sa30GAS7fmKiogw1Q8cikPUbghHT308rGbxiS1xTvdxbkg/mXsSObNlsc++qNauYPSA K3nnAQ1A3pxHFWm/LvGq3j7I1Bl0EtKLn9IOpwu6xS30VtzfAD6/dNsB36npuQJ2liNb igwdhHPaEJklEcCIfdA7oRPfKgWCh+G//F527rEfYBW6/yAXZLKY5PlEm76tkfmVzyKu uwCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JcOUI+47; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id s20-20020a170903201400b001a677821130si5716396pla.13.2023.09.23.10.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 10:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JcOUI+47; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 B20B6831754C; Sat, 23 Sep 2023 03:12:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbjIWKMR (ORCPT + 29 others); Sat, 23 Sep 2023 06:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbjIWKLs (ORCPT ); Sat, 23 Sep 2023 06:11:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3909E; Sat, 23 Sep 2023 03:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695463902; x=1726999902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CcGvpPsp9yPYBKGgtw+pwzSruaWdmcjQipAacX3tyYo=; b=JcOUI+47YJOJ4+PXISLurQZlPVSZgr8wF44vfml4l37PL0G1Gzdq7a+t HHF1IEeskazSm+LgeNfOylzsuskG6PurftEWQ6PG/ElUZQqqWz7vYI4yO mg2m6N0wH2X/v6aLhs4aIsE+LHK6popQjOe6xiCZBliOukQpj2p/QgfoF hcQucfGO6iLLDv3JvSSj4EZwIfVYvvv1lCHdCr/dTf2ho3Nch2gEaKaWY dJVGArS5mON3KO8knPsfCwL0XYB2cyVvYl9hc9Wy1K643yMn73BTu4xe0 3gvrkTuE0IEYyzgjQQjd+qKPAiMJPkI5D+XS0f/S5Vqyti3Bwqgiys4U7 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="447492179" X-IronPort-AV: E=Sophos;i="6.03,171,1694761200"; d="scan'208";a="447492179" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2023 03:11:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="813388131" X-IronPort-AV: E=Sophos;i="6.03,171,1694761200"; d="scan'208";a="813388131" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga008.fm.intel.com with ESMTP; 23 Sep 2023 03:11:40 -0700 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 Subject: [PATCH v11 09/37] x86/fred: Disable FRED support if CONFIG_X86_FRED is disabled Date: Sat, 23 Sep 2023 02:41:44 -0700 Message-Id: <20230923094212.26520-10-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230923094212.26520-1-xin3.li@intel.com> References: <20230923094212.26520-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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]); Sat, 23 Sep 2023 03:12:50 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777849758581846760 X-GMAIL-MSGID: 1777849758581846760 From: "H. Peter Anvin (Intel)" Add CONFIG_X86_FRED to to make cpu_feature_enabled() work correctly with FRED. Originally-by: Megha Dey Signed-off-by: H. Peter Anvin (Intel) Tested-by: Shan Kang Signed-off-by: Xin Li --- Changes since v10: * FRED feature is defined in cpuid word 12, not 13 (Nikolay Borisov). --- arch/x86/include/asm/disabled-features.h | 8 +++++++- tools/arch/x86/include/asm/disabled-features.h | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index 702d93fdd10e..f40b29d3abad 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -117,6 +117,12 @@ #define DISABLE_IBT (1 << (X86_FEATURE_IBT & 31)) #endif +#ifdef CONFIG_X86_FRED +# define DISABLE_FRED 0 +#else +# define DISABLE_FRED (1 << (X86_FEATURE_FRED & 31)) +#endif + /* * Make sure to add features to the correct mask */ @@ -133,7 +139,7 @@ #define DISABLED_MASK10 0 #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ DISABLE_CALL_DEPTH_TRACKING|DISABLE_USER_SHSTK) -#define DISABLED_MASK12 (DISABLE_LAM) +#define DISABLED_MASK12 (DISABLE_FRED|DISABLE_LAM) #define DISABLED_MASK13 0 #define DISABLED_MASK14 0 #define DISABLED_MASK15 0 diff --git a/tools/arch/x86/include/asm/disabled-features.h b/tools/arch/x86/include/asm/disabled-features.h index fafe9be7a6f4..0b47ab1930a3 100644 --- a/tools/arch/x86/include/asm/disabled-features.h +++ b/tools/arch/x86/include/asm/disabled-features.h @@ -105,6 +105,12 @@ # define DISABLE_TDX_GUEST (1 << (X86_FEATURE_TDX_GUEST & 31)) #endif +#ifdef CONFIG_X86_FRED +# define DISABLE_FRED 0 +#else +# define DISABLE_FRED (1 << (X86_FEATURE_FRED & 31)) +#endif + /* * Make sure to add features to the correct mask */ @@ -121,7 +127,7 @@ #define DISABLED_MASK10 0 #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ DISABLE_CALL_DEPTH_TRACKING) -#define DISABLED_MASK12 (DISABLE_LAM) +#define DISABLED_MASK12 (DISABLE_FRED|DISABLE_LAM) #define DISABLED_MASK13 0 #define DISABLED_MASK14 0 #define DISABLED_MASK15 0