From patchwork Thu Feb 1 05:46:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xin Li (Intel)" X-Patchwork-Id: 19773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp232045dyc; Wed, 31 Jan 2024 21:47:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeJPob7qm4AF4hDNmDsfS0JK0LAQtDtyKjyqW3jjsNcjyfBDgHGsfv1QYP6bmUWKKAqRWX X-Received: by 2002:a05:6512:3b27:b0:511:2e7c:768f with SMTP id f39-20020a0565123b2700b005112e7c768fmr611062lfv.46.1706766474428; Wed, 31 Jan 2024 21:47:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706766474; cv=pass; d=google.com; s=arc-20160816; b=UT0Z5meHgF7czXF5CSNFEAqg2w0v8/DKzpfhk/p7RYAMfbqL6kDtA7+TbCNG0WhFlE ca8uBftqtoNP3ryrESiRShQ6JXTXXxPjkd81GWSJRPPQ+gCgT5dLMOaOH3kfjNszdDxk fz6wVAToI9H4JUroq51sze8+6XsFiu9leXwRR5M3/VGUpO4qNBb5FkYCXenfiW0acoPJ yOMSA4geClB5RDiy4zosznSXtAldnuucNU+9CwRNf9O40sRUY3l0h0zMIfxMNcvXuzPh Tx66c9fBzeZueWWdsEmLTsnOZi6hMnOXQsH4gZvHOe9Li+4pFK4TTpDA1JLjoXHD+GSj uyfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=NnI+ixxEJIjCDHzMNs2KvyM1MBjUL2v+GswxZaV0nbs=; fh=qkUDamX51OpQFUohLRgnHbTPHnmLmT9hllaRwLFoMXI=; b=0ZZPcjn0JULjwr8JRsXXCYfrUhdzT8bpwC8JkwooV2KRtn5bNkEadkjS7K4MRJtffD cODEjU+J4BFp+ug0/XIgjisMkQgKW5LKWFM86lQje7rTriXOSSqjbs/wts20dzWmcNK1 lnEPQAomfBeroNafT378gDLXoNHm3Oe6Av9n7ce7jLlke7Sd36qnty+eRn3swGd2Wn8S dgn8viRG2EZFH3FORIj89py/b6PbpE3u5WCIeKX4UUNEAE0k28jRvP4mvmLHJEiTVJzW G5bZXhH+TZ70FeRUkDJiEBpgxd1uxD1v3DzKUif+8eWlnT3oPNfmghFN4ltvI/5WND+K c76g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024011201 header.b=Z7W1Csz4; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-47661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47661-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com X-Forwarded-Encrypted: i=1; AJvYcCWUo5zv1F7hxQ5HkBiHMGu9XTIQk3T4DeFQ4Q11yThGKMkLYdmhI0zj0PON3ARD1AveJhOc6xTTLre14UICPn/VuswdnQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h8-20020a17090619c800b00a34a1ab1039si6517447ejd.966.2024.01.31.21.47.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 21:47:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024011201 header.b=Z7W1Csz4; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-47661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47661-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0BC101F26A9D for ; Thu, 1 Feb 2024 05:47:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01AB77D40C; Thu, 1 Feb 2024 05:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="Z7W1Csz4" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A92A4612EE; Thu, 1 Feb 2024 05:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766425; cv=none; b=Nq27Z1F7oHaTHqD/H9SrD++f7qH+h0qEufwun0WPTRPr7hR7LwJXZjCwvsz2cA4MZLc79JPncY/R1Lk0MhgFRxJrjSgMVemy6+GAt1erGAnDO+ygCBMNjxjezI+sFLEyN5b+DCvzENtKcLR46n4ZzL8dpCHR3TNshgvO9eZM85E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766425; c=relaxed/simple; bh=ybfkOrGY7XUkUYn6qLq1G4d+b5az7wtgUrTBTKa4DtA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CBikafVQg8iO1berlXRFlVrr0n76RWwA9qIvPL8wK/xFp6C6YYwAyfh2SwhLe1Q6ZcZmx0hc1c5MUd7WQpLfXGMlBs40ELpVLioCgYjPaiRuL2OZVHWn1g89+UwSL460nUdcq3oChJgJoI5sZiAegJIuwvVd2tHOET215e/AO30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=Z7W1Csz4; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from terminus.zytor.com (terminus.zytor.com [IPv6:2607:7c80:54:3:0:0:0:136]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 4115kU5G3816769 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 31 Jan 2024 21:46:34 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 4115kU5G3816769 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024011201; t=1706766394; bh=NnI+ixxEJIjCDHzMNs2KvyM1MBjUL2v+GswxZaV0nbs=; h=From:To:Cc:Subject:Date:From; b=Z7W1Csz4bxl4OqpAKF6mPoNNyssxL0kX0YYcDkA2iD42J+LwybUfhhMvsivR3PWa7 GKa5nXMz8QJDyewLMtDmCghSEVHJNrS3gfbYnVuET+T24eNSGIFvMFmT4S1GeNyzg/ hlVBYLI7RrkSP8Zaauna45VOMrM/Biqsfq5po1pYGYzS/m/s20mDyUPpAJ6PsCajCc q3LDgLBPG6q0G7m2FrAq6cmIbI2R5XQQUEq1e5UEpyu5EJehuGYHFK+XLrsO9XL0TU IrIbaNMs6ooHsUWnQktAkvaooJLK3ud74jkSJRcCaOCTAiaZ002k7gLNC4n2ZOSH4v W6OBD1pM4p94g== From: "Xin Li (Intel)" To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, will@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, acme@kernel.org, namhyung@kernel.org Subject: [PATCH v1 0/3] x86/cpufeatures: Automatically generate required and disabled feature masks Date: Wed, 31 Jan 2024 21:46:26 -0800 Message-ID: <20240201054629.3816748-1-xin@zytor.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789674362884771216 X-GMAIL-MSGID: 1789674362884771216 When a CPU feature is not configured, e.g., CONFIG_X86_FRED=n, in a build config, its feature disable flag, e.g. DISABLE_FRED, needs to be defined and added to a specific disabled CPU features mask in , as the following commit: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/fred&id=e554a8ca49d6d6d782f546ae4d7f036946e7dd87 This patch set adds an awk script to automatically generate a header with required and disabled CPU features masks based on build config. H. Peter Anvin (Intel) (2): x86/cpufeatures: Add {required,disabled} feature configs x86/cpufeatures: Generate a feature mask header based on build config Xin Li (Intel) (1): x86/cpufeatures: Remove {disabled,required}-features.h arch/x86/Kconfig | 4 +- arch/x86/Kconfig.cpu | 16 +- arch/x86/Kconfig.cpufeatures | 149 +++++++++++++++++ arch/x86/Makefile | 17 +- arch/x86/boot/cpucheck.c | 3 +- arch/x86/boot/cpuflags.c | 1 - arch/x86/boot/mkcpustr.c | 3 +- arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/asm-prototypes.h | 2 +- arch/x86/include/asm/atomic64_32.h | 2 +- arch/x86/include/asm/bitops.h | 4 +- arch/x86/include/asm/cmpxchg_32.h | 4 +- arch/x86/include/asm/cpufeature.h | 1 + arch/x86/include/asm/cpufeatures.h | 8 - arch/x86/include/asm/disabled-features.h | 154 ------------------ arch/x86/include/asm/required-features.h | 104 ------------ arch/x86/kernel/verify_cpu.S | 1 + arch/x86/lib/Makefile | 2 +- arch/x86/lib/cmpxchg8b_emu.S | 2 +- arch/x86/tools/featuremasks.awk | 108 ++++++++++++ lib/atomic64_test.c | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 8 - .../arch/x86/include/asm/disabled-features.h | 154 ------------------ .../arch/x86/include/asm/required-features.h | 104 ------------ tools/perf/check-headers.sh | 2 - 25 files changed, 303 insertions(+), 553 deletions(-) create mode 100644 arch/x86/Kconfig.cpufeatures delete mode 100644 arch/x86/include/asm/disabled-features.h delete mode 100644 arch/x86/include/asm/required-features.h create mode 100755 arch/x86/tools/featuremasks.awk delete mode 100644 tools/arch/x86/include/asm/disabled-features.h delete mode 100644 tools/arch/x86/include/asm/required-features.h base-commit: 078b7b997b47c7166c1240cf1d39db9f646a56be