]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/cpu: Expose only stepping min/max interface
authorDave Hansen <dave.hansen@linux.intel.com>
Fri, 13 Dec 2024 18:51:29 +0000 (10:51 -0800)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 18 Dec 2024 00:14:49 +0000 (16:14 -0800)
commit85b08180df07b9a5984b15ae31d76b904d42a115
tree80b45c287aea7d440f42b6281050837b8f34adc8
parentb8e10c86e674eb19e0e53dcf4fa3e71cba1e0c1c
x86/cpu: Expose only stepping min/max interface

The x86_match_cpu() infrastructure can match CPU steppings. Since
there are only 16 possible steppings, the matching infrastructure goes
all out and stores the stepping match as a bitmap. That means it can
match any possible steppings in a single list entry. Fun.

But it exposes this bitmap to each of the X86_MATCH_*() helpers when
none of them really need a bitmap. It makes up for this by exporting a
helper (X86_STEPPINGS()) which converts a contiguous stepping range
into the bitmap which every single user leverages.

Instead of a bitmap, have the main helper for this sort of thing
(X86_MATCH_VFM_STEPS()) just take a stepping range. This ends up
actually being even more compact than before.

Leave the helper in place (renamed to __X86_STEPPINGS()) to make it
more clear what is going on instead of just having a random GENMASK()
in the middle of an already complicated macro.

One oddity that I hit was this macro:

       X86_MATCH_VFM_STEPS(vfm, X86_STEPPING_MIN, max_stepping, issues)

It *could* have been converted over to take a min/max stepping value
for each entry. But that would have been a bit too verbose and would
prevent the one oddball in the list (INTEL_COMETLAKE_L stepping 0)
from sticking out.

Instead, just have it take a *maximum* stepping and imply that the match
is from 0=>max_stepping. This is functional for all the cases now and
also retains the nice property of having INTEL_COMETLAKE_L stepping 0
stick out like a sore thumb.

skx_cpuids[] is goofy. It uses the stepping match but encodes all
possible steppings. Just use a normal, non-stepping match helper.

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20241213185129.65527B2A%40davehans-spike.ostc.intel.com
arch/x86/include/asm/cpu_device_id.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/cpu/common.c
drivers/edac/i10nm_base.c
drivers/edac/skx_base.c
include/linux/mod_devicetable.h