From patchwork Thu Mar 2 05:24:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 63220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4063411wrd; Wed, 1 Mar 2023 21:53:02 -0800 (PST) X-Google-Smtp-Source: AK7set9zay/X6VJadR1vTcVKM7sFWzQkwXFIKzcwP3cLjNhN4JU4Jsonwd/AE1CsgVQL7ekQmPR+ X-Received: by 2002:a17:906:7ad3:b0:8b1:749f:b2c0 with SMTP id k19-20020a1709067ad300b008b1749fb2c0mr9218920ejo.74.1677736381954; Wed, 01 Mar 2023 21:53:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677736381; cv=none; d=google.com; s=arc-20160816; b=WbQv/20Il0nsudM4b6qiRzbNdZtSzAqqN9243Y35B2dw716WAEItplm0k1OkuDB0H8 iadCn+Qa6dB/V9IQBiWGw0nw+sO1SIvBh6JQo6JsDZeeV1HaiziTKWT0Dwtfyl5Y45hI h+kOJlcyC3VsIR8ygQPhre6ANBSftY1ZdEljdwIYBrmzFLydYS09jsB2tyu7nkKMrOCB tU9dBksDY7V3CLGm9adN38eqT0Dvj1gmQHaTgDofWjmqSi6xl/sUa7IHOybrDAIi9Qr3 aiBpDJiN5IAvPB9G0nlcNvSEh8vrny3iXPM+gQAeYP/oErGQnU4KDDtUPJLRgwVvnd67 r/nQ== 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=OSlqpq1ELTxNU1ltDY4IZP23jYiWVSMftVLwVwljWLg=; b=E5mhiH/BSBP7NYDyb4QYICCjX+n4plktuqQ16Tz0wgGSzBp3lhxyHqqBUlYvx/ip9F SpEWNPuEJdOrRpHVQJvc7hWk7wHbq8LziOJmZeVBbVPCN+0t2xnUP+Ixfg/4zpcXvWSh T6pnjwSAS2oXl2m8IJUFeAcdz/RcXbtoB0GcIce3eTf9L7gcU8+mxv0qM9Q87HO4blmO vNmRm9iknlXLsniJMHHmjWPJf6OCIMOZFnx5G48gqThlKJq20VBg43uWwTqBusECT+bd L1GzQeILYByGO1HbgXsKXw8t2b7rmYHlT+37oyZmL+6G8ZyjYZM3MuLxKRuDCDwOuztT ZqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FKuelbhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kf20-20020a17090776d400b008d86852d974si15264914ejc.664.2023.03.01.21.52.38; Wed, 01 Mar 2023 21:53:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FKuelbhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjCBFvm (ORCPT + 99 others); Thu, 2 Mar 2023 00:51:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbjCBFvB (ORCPT ); Thu, 2 Mar 2023 00:51:01 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F1BD4ECC9; Wed, 1 Mar 2023 21:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677736258; x=1709272258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wcw4oWWYVKLi17TGIcBaJWkCmV6EYpXPXC/uF0gD9d8=; b=FKuelbhIy9IXvSuvk8Udgrg4wuDL+S1KD2WKbM/XZdleEUGwq+TP359d HRbifouIw/MvKi/QVi/GPzens0w64ZsD7RdbewF1AgoPVi/ToStmGbHhk 0BUm3Lw3d0MSfSw6HN3DX5ZTg3DwwNQ5bNOMEfEwlV0emk1rUUiC7IMNc rmcybNfkfakcYv9nl14y1wSlPGqyjNKYq9NYK7IaeTuhQZcTLY3S/q0Jl f6YnLTOgL8I+GPgmxUteuwRohkxIZw2sQcHoZQUk96B+XIoouDSKws0qC jjLYCapML1oHHB+SaoHuvnTxjIZ01YRM2wD4kklj47jNVV3gccTA1KyJm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="420887151" X-IronPort-AV: E=Sophos;i="5.98,226,1673942400"; d="scan'208";a="420887151" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2023 21:50:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="920530904" X-IronPort-AV: E=Sophos;i="5.98,226,1673942400"; d="scan'208";a="920530904" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga006.fm.intel.com with ESMTP; 01 Mar 2023 21:50:47 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com Subject: [PATCH v4 11/34] x86/fred: if CONFIG_X86_FRED is disabled, disable FRED support Date: Wed, 1 Mar 2023 21:24:48 -0800 Message-Id: <20230302052511.1918-12-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302052511.1918-1-xin3.li@intel.com> References: <20230302052511.1918-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759234104409742485?= X-GMAIL-MSGID: =?utf-8?q?1759234104409742485?= 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 --- 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 5dfa4fb76f4b..56838de9cb23 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -99,6 +99,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 */ @@ -115,7 +121,7 @@ #define DISABLED_MASK10 0 #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ DISABLE_CALL_DEPTH_TRACKING) -#define DISABLED_MASK12 0 +#define DISABLED_MASK12 (DISABLE_FRED) #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 c44b56f7ffba..2d3ec539dcc7 100644 --- a/tools/arch/x86/include/asm/disabled-features.h +++ b/tools/arch/x86/include/asm/disabled-features.h @@ -99,6 +99,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 */ @@ -115,7 +121,7 @@ #define DISABLED_MASK10 0 #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ DISABLE_CALL_DEPTH_TRACKING) -#define DISABLED_MASK12 0 +#define DISABLED_MASK12 (DISABLE_FRED) #define DISABLED_MASK13 0 #define DISABLED_MASK14 0 #define DISABLED_MASK15 0