for_each_cpuid_0x2_desc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

for_each_cpuid_0x2_desc β€” iterator for parsed CPUID(0x2) descriptors. This is the Kernel API Manual page for for_each_cpuid_0x2_desc(9), bestie β€” yes, the manual name is folded in right here. πŸ’–

πŸ’… SYNOPSIS πŸ’…

The call looks like this, no cap:

for_each_cpuid_0x2_desc (_regs , _ptr , _desc );

πŸŽ€ ARGUMENTS πŸŽ€

  • _regs β€” CPUID(0x2) register output, as returned by cpuid_leaf_0x2
  • _ptr β€” u8 pointer, for macro internal use only
  • _desc β€” pointer to the parsed CPUID(0x2) descriptor at each iteration

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: this iterator loops over the 1-byte descriptors in the CPUID(0x2) output registers you pass in as _regs. For every descriptor, it gives you the parsed info through _desc. Slay. ✨

Need to handle cache-specific descriptors? Switch on _desc->c_type. TLB descriptors? Switch on _desc->t_type. That's the whole routing situation. πŸ’…

Example usage for cache descriptors, literally right here:

            const struct leaf_0x2_table *desc;
            union leaf_0x2_regs regs;
            u8 *ptr;

            cpuid_leaf_0x2(regs);
            for_each_cpuid_0x2_desc(regs, ptr, desc) {
                    switch (desc->c_type) {
                            ...
                    }
            }

🌈 SEE ALSO 🌈

Kernel file ./arch/x86/include/asm/cpuid/api.h is the one to peek at πŸ‘€, and the related manual pages are cpuid_leaf_0x2(9), cpuid_subleaf(9), cpuid_leaf(9), cpuid_leaf_raw(9), cpuid_subleaf_n(9), cpuid_subleaf_n_raw(9), and cpuid_subleaf_count(9).

mwah πŸ’‹ β€” this page's source/version is ./arch/x86/include/asm/cpuid, dated October 2026, and it's literally the for_each_cpuid_0x2_desc(9) page. Bye bestie, go switch on those types. 🫢✨

πŸ“¦ where this page comes from