Skip to content

x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers

Thomas Gleixner alsa-devel linux-acpi linux-crypto linux-edac linux-hwmon linux-mmc linux-pci linux-pm lkml oe-lkp platform-driver-x86 1 version Applied

Status from this message: The following commit has been merged into the x86/cpu branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest22 patches 24 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/22x86/devicetable: Move x86 specific macro out of generic codearch/x86/include/asm/cpu_device_id.h arch/x86/kvm/svm.c arch/x86/kvm/vmx/vmx.c +3 more+17 -42 replies
2/22x86/cpu: Add conistent CPU match macrosarch/x86/include/asm/cpu_device_id.h arch/x86/include/asm/intel-family.h arch/x86/kernel/cpu/match.c+146 -133 replies
3/22x86/cpu/bugs: Convert to new matching macrosarch/x86/kernel/cpu/common.c+2 -20 replies
4/22x86/perf/events: Convert to new CPU match macrosarch/x86/events/amd/power.c arch/x86/events/intel/cstate.c arch/x86/events/intel/rapl.c +1 more+110 -1220 replies
5/22x86/kvm: Convert to new CPU match macrosarch/x86/kvm/svm.c arch/x86/kvm/vmx/vmx.c+2 -20 replies
6/22x86/kernel: Convert to new CPU match macrosarch/x86/kernel/apic/apic.c arch/x86/kernel/smpboot.c arch/x86/kernel/tsc_msr.c +1 more+24 -420 replies
7/22x86/platform: Convert to new CPU match macrosarch/x86/platform/atom/punit_atom_debug.c arch/x86/platform/efi/quirks.c arch/x86/platform/intel-mid/device_libs/platform_bt.c +2 more+11 -180 replies
8/22ACPI: Convert to new X86 CPU match macrosdrivers/acpi/acpi_lpss.c drivers/acpi/x86/utils.c+12 -143 replies
9/22cpufreq: Convert to new X86 CPU match macrosdrivers/cpufreq/acpi-cpufreq.c drivers/cpufreq/amd_freq_sensitivity.c drivers/cpufreq/e_powersaver.c +12 more+59 -7411 replies
10/22EDAC: Convert to new X86 CPU match macrosdrivers/edac/amd64_edac.c drivers/edac/i10nm_base.c drivers/edac/pnd2_edac.c +2 more+21 -211 reply
11/22platform/x86: Convert to new CPU match macrosdrivers/platform/x86/intel-uncore-frequency.c drivers/platform/x86/intel_int0002_vgpio.c drivers/platform/x86/intel_mid_powerbtn.c +6 more+37 -471 reply
12/22hwmon: Convert to new X86 CPU match macrosdrivers/hwmon/coretemp.c drivers/hwmon/via-cputemp.c+5 -50 replies
13/22thermal: Convert to new X86 CPU match macrosdrivers/thermal/intel/intel_powerclamp.c drivers/thermal/intel/intel_quark_dts_thermal.c drivers/thermal/intel/intel_soc_dts_thermal.c +1 more+4 -80 replies
14/22extcon: axp288: Convert to new X86 CPU match macrosdrivers/extcon/extcon-axp288.c+1 -10 replies
15/22intel_idle: Convert to new X86 CPU match macrosdrivers/idle/intel_idle.c+38 -410 replies
16/22mmc: sdhci-acpi: Convert to new X86 CPU match macrosdrivers/mmc/host/sdhci-acpi.c+2 -20 replies
17/22PCI: intel-mid: Convert to new X86 CPU match macrosdrivers/pci/pci-mid.c+2 -41 reply
18/22powercap/intel_rapl: Convert to new X86 CPU match macrosdrivers/powercap/intel_rapl_common.c+40 -410 replies
19/22ASoC: Intel: Convert to new X86 CPU match macrossound/soc/intel/common/soc-intel-quirks.h+6 -81 reply
20/22crypto: Convert to new CPU match macrosarch/x86/crypto/aesni-intel_glue.c arch/x86/crypto/crc32-pclmul_glue.c arch/x86/crypto/crc32c-intel_glue.c +4 more+7 -70 replies
21/22hwrng: via_rng - Convert to new X86 CPU match macrosdrivers/char/hw_random/via-rng.c+3 -40 replies
22/22x86/cpu: Cleanup the now unused CPU match macrosarch/x86/include/asm/cpu_device_id.h arch/x86/include/asm/intel-family.h+0 -160 replies

Reviews trailers per patch

4 of 22 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBjorn HelgaasAndy ShevchenkoGreg Kroah-HartmanRafael J. WysockiTony Luck
SeriesR-b
1/22
2/22
3/22
4/22
5/22
6/22
7/22
8/22
9/22A-b
10/22A-b
11/22R-b
12/22
13/22
14/22
15/22
16/22
17/22A-b
18/22
19/22
20/22
21/22
22/22

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v1 thread

Cover letter [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers

The x86 CPU matching based on struct x86_cpu_id:

- is using an inconsistent macro mess with pointlessly duplicated and slightly different local macros. Finding the places is an art as there is no consistent name space at all.

- is still mostly based on C89 struct initializers which rely on the ordering of the struct members. That's proliferated forever as every new driver just copies the mess from some exising one.

A recent offlist conversation about adding more match criteria to the CPU matching logic instead of creating yet another set of horrors, reminded me of a pile of scripts and patches which I hacked on a few years ago when I tried to add something to struct x86_cpu_id.

That stuff was finally not needed and ended up in my ever growing todo list and collected dust and cobwebs, but (un)surprisingly enough most of it still worked out of the box. The copy & paste machinery still works as it did years ago.

There are a few places which needed extra care due to new creative macros, new check combinations etc. and surprisingly ONE open coded proper C99 initializer.

It was reasonably simple to make it at least compile and pass a quick binary equivalence check.

The result is a X86_MATCH prefix based set of macros which are reflecting the needs of the usage sites and shorten the base macro which takes all possible parameters (vendor, family, model, feature, data) and uses proper C99 initializers.

So extensions of the match logic are trivial after that.

The patch set is against Linus tree and has trivial conflicts against linux-next.

The diffstat is:

 71 files changed, 525 insertions(+), 472 deletions(-)

but the extra lines are pretty much kernel-doc documentation which I added to each of the new macros. The usage sites diffstat is:

 70 files changed, 393 insertions(+), 471 deletions(-)

Thoughts?

Thanks,

tglx