public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ahmed S. Darwish" <darwi@linutronix.de>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: x86-cpuid@lists.linux.dev, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Sohil Mehta <sohil.mehta@intel.com>,
	John Ogness <john.ogness@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [ANNOUNCE] x86-cpuid-db: Release v2.0
Date: Tue, 8 Oct 2024 17:44:20 +0200	[thread overview]
Message-ID: <ZwVTVO2FcH95WFBp@lx-t490> (raw)
In-Reply-To: <55f755e9-2712-47d5-82d5-d6e685969461@citrix.com>

Hi Andrew,

On Tue, 08 Oct 2024, Andrew Cooper wrote:
>
> On 08/10/2024 2:31 pm, Ahmed S. Darwish wrote:
> > to:
> >
> >     /*
> >      * Leaf 0x0
> >      * Maximum standard leaf number + CPU vendor string
> >      */
> >
> >     struct leaf_0x0_0 {
> >         ...;
> >     };
> >
> >     /*
> >      * Leaf 0x7
> >      * Extended CPU features enumeration
> >      */
> >
> >     struct leaf_0x7_0 {
> >         ...;
> >     };
> >
> >     struct leaf_0x7_1 {
> >         ...;
> >     };
> >
> > Overall, this removes ambiguity for IDs like 0x16, and improves kernel
> > code greppability (x86 PQ pending).
>
> So what does leaf 0xd with 62 subleaves look like.  Do we really have
> one number in hex, and one in decimal?

Hmmm, good point...

For now, if we grep the generated C linux header for all the structures
that are not subleaf 0, we get:

    $ grep -E 'struct leaf_0x[0-9a-f]+_[^0]' cpuid-bitfields.h

    struct leaf_0x7_1 {
    struct leaf_0x7_2 {
    struct leaf_0xd_1 {
    struct leaf_0xd_2 {
    struct leaf_0xf_1 {
    struct leaf_0x10_1 {
    struct leaf_0x10_3 {
    struct leaf_0x12_1 {
    struct leaf_0x12_2 {
    struct leaf_0x14_1 {
    struct leaf_0x17_1 {
    struct leaf_0x1d_1 {
    struct leaf_0x23_1 {
    struct leaf_0x23_3 {
    struct leaf_0x80000020_1 {
    struct leaf_0x80000020_2 {
    struct leaf_0x80000020_3 {

We do indeed have an encodings for leaves with large dynamic number of
valid subleaves, through "array=":

    darwi@lx ~/x86-cpuid-db (main)> git grep array=

    db/xml/leaf_04.xml:  <subleaf id="0" array="32">
    db/xml/leaf_0b.xml:  <subleaf id="0" array="2">
    db/xml/leaf_0d.xml:  <subleaf id="2" array="62">
    db/xml/leaf_10.xml:  <subleaf id="1" array="2">
    db/xml/leaf_12.xml:  <subleaf id="2" array="30">
    db/xml/leaf_17.xml:  <subleaf id="1" array="3">
    db/xml/leaf_18.xml:  <subleaf id="0" array="32">
    db/xml/leaf_1b.xml:  <subleaf id="0" array="32">
    db/xml/leaf_1f.xml:  <subleaf id="0" array="6">
    db/xml/leaf_8000001d.xml:  <subleaf id="0" array="32">
    db/xml/leaf_80000026.xml:  <subleaf id="0" array="4">

But the generators don't deal with that (yet), and that's why they're
also not in the generated CSV/header files.

I'm going through the Linux x86 PQ now, so it's a nice opportunity to
see how something like "struct leaf_0x0_0x0" looks within the rest of
the kernel code...  I'll also ping Thomas to see if he has any feedback
on the topic.

Thanks!

--
Ahmed S. Darwish
Linutronix GmbH

      reply	other threads:[~2024-10-08 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 13:31 [ANNOUNCE] x86-cpuid-db: Release v2.0 Ahmed S. Darwish
2024-10-08 13:38 ` Andrew Cooper
2024-10-08 15:44   ` Ahmed S. Darwish [this message]

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=ZwVTVO2FcH95WFBp@lx-t490 \
    --to=darwi@linutronix.de \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86-cpuid@lists.linux.dev \
    --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