From: Xin Li <xin@zytor.com>
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: Re: [RESEND v1 2/3] x86/cpufeatures: Generate a feature mask header based on build config
Date: Sun, 16 Jun 2024 00:26:48 -0700 [thread overview]
Message-ID: <99208d95-d3de-44d0-8b08-f508759aabca@zytor.com> (raw)
In-Reply-To: <20240509205340.275568-3-xin@zytor.com>
On 5/9/2024 1:53 PM, Xin Li (Intel) wrote:
> From: "H. Peter Anvin (Intel)" <hpa@zytor.com>
>
> Introduce an AWK script to auto-generate a header with required and
> disabled feature masks based on <asm/cpufeatures.h> and current build
> config. Thus for any CPU feature with a build config, e.g., X86_FRED,
> simply add
...
> +
> + printf "\n#define %s_MASKS ", s;
> + pfx = "{";
> + for (i = 0; i < ncapints; i++) {
> + printf "%s \\\n\t%s_MASK_%d", pfx, s, i;
> + pfx = ",";
> + }
> + printf " \\\n}\n\n";
> +
> + printf "#define %s_FEATURE(x) \\\n", s;
> + printf "\t((( ";
> + for (i = 0; i < ncapints; i++) {
> + if (masks[i]) {
> + printf "\\\n\t\t((x) >> 5) == %2d ? %s_MASK%-3d : ", i, s, i;
> + }
> + }
> + printf "0 \\\n";
> + printf "\t) >> ((x) & 31)) & 1)\n\n";
This code generates macros {REQUIRED,DISABLED}_FEATURE(x) to tell if a
CPU feature, e.g., X86_FEATURE_FRED, is a required or disabled feature
for this particular compile-time configuration.
But they are NOT currently used, so I prefer to remove them for now.
Thanks!
Xin
next prev parent reply other threads:[~2024-06-16 7:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 20:53 [RESEND v1 0/3] x86/cpufeatures: Automatically generate required and disabled feature masks Xin Li (Intel)
2024-05-09 20:53 ` [RESEND v1 1/3] x86/cpufeatures: Add {required,disabled} feature configs Xin Li (Intel)
2024-06-12 13:33 ` Borislav Petkov
2024-06-13 2:56 ` Xin Li
2024-05-09 20:53 ` [RESEND v1 2/3] x86/cpufeatures: Generate a feature mask header based on build config Xin Li (Intel)
2024-06-16 7:26 ` Xin Li [this message]
2024-06-17 13:46 ` H. Peter Anvin
2024-06-22 17:34 ` Xin Li
2024-05-09 20:53 ` [RESEND v1 3/3] x86/cpufeatures: Remove {disabled,required}-features.h Xin Li (Intel)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=99208d95-d3de-44d0-8b08-f508759aabca@zytor.com \
--to=xin@zytor.com \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®