Re: [PATCH v1 0/7] x86: Disentangle <asm/processor.h> dependency on CPUID APIs

Sean Christopherson <[email protected]>
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Jul 09, 2025, Ahmed S. Darwish wrote:
> Hi,
> 
> This series avoids including the full CPUID API from <asm/processor.h>.
> That header only needs the CPUID data types and not the full API.
> 
> Replace the <asm/cpuid/api.h> inclusion in <asm/processor.h> with an
> include of <asm/cpuid/types.h>.
> 
> Modify all CPUID call sites which implicitly included the CPUID API
> though <asm/processor.h> to explicitly include <asm/cpuid/api.h> instead.
> 
> This work prepares for an upcoming v4 of the CPUID model:
> 
>     [PATCH v3 00/44] x86: Introduce a centralized CPUID data model
>     https://lore.kernel.org/lkml/[email protected]
> 
> where <asm/cpuid/api.h> needs to include <asm/processor.h>, thus creating
> a circular dependency if not resolved beforehand…  Patches 1->19 of the
> v3 above had parts of this series circular dependency disentanglement.
> 
> Per Boris' remarks above, merge the header includes reorderings into two
> patches only: one patch for x86 and one for drivers.
> 
> The 0-day bot x86-32 compilation error:
> 
>     Re: [PATCH v3 41/44] x86/cpu: <asm/processor.h>: Do not include CPUID…
>     https://lore.kernel.org/lkml/[email protected]
> 
> is also fixed in this series.
> 
> Beside the call sites converted at CPUID model v3 above, this series also
> switches below files:
> 
>     arch/x86/kernel/cpu/microcode/core.c
>     arch/x86/kernel/cpu/microcode/intel.c
>     arch/x86/kernel/cpu/mshyperv.c
>     arch/x86/kvm/lapic.c
>     arch/x86/kvm/svm/sev.c

I'm officially confused.  Neither lapic.c nor svm/sev.c are modified in this series.
Does "this series" actually mean something other than _this_ seris?

>     drivers/acpi/acpi_processor.c
>     drivers/acpi/processor_core.c
>     drivers/cpufreq/longrun.c
>     drivers/cpufreq/powernow-k7.c
>     drivers/cpufreq/powernow-k8.c
>     drivers/hwtracing/coresight/coresight-platform.c
>     drivers/xen/xen-acpi-processor.c
> 
> to explicitly include <asm/cpuid/api.h>.
> 
> Based on v6.16-rc5.
> 
> Note, the last patch is a CPUID API naming change in preparation for the
> model as well.  It can be skipped if merging it is not desired at this
> stage.
> 
> Thanks!
> 
> 8<-----
> 
> Ahmed S. Darwish (7):
>   x86/cpuid: Remove transitional <asm/cpuid.h> header
>   ASoC: Intel: avs: Include CPUID header at file scope
>   x86: Reorder headers alphabetically
>   drivers: Reorder headers alphabetically
>   treewide: Explicitly include <asm/cpuid/api.h>
>   x86/cpu: <asm/processor.h>: Do not include CPUID API header
>   x86/cpuid: Rename cpuid_leaf()/cpuid_subleaf() APIs
> 
>  arch/x86/boot/compressed/pgtable_64.c        |  1 +
>  arch/x86/boot/startup/sme.c                  |  9 +--
>  arch/x86/coco/tdx/tdx.c                      |  6 +-
>  arch/x86/events/amd/core.c                   |  2 +
>  arch/x86/events/amd/ibs.c                    |  1 +
>  arch/x86/events/amd/lbr.c                    |  2 +
>  arch/x86/events/amd/power.c                  |  3 +
>  arch/x86/events/amd/uncore.c                 | 15 ++---
>  arch/x86/events/intel/core.c                 |  1 +
>  arch/x86/events/intel/lbr.c                  |  1 +
>  arch/x86/events/zhaoxin/core.c               | 12 ++--
>  arch/x86/include/asm/acrn.h                  |  2 +
>  arch/x86/include/asm/cpuid.h                 |  8 ---
>  arch/x86/include/asm/cpuid/api.h             |  6 +-
>  arch/x86/include/asm/microcode.h             |  1 +
>  arch/x86/include/asm/processor.h             |  2 +-
>  arch/x86/include/asm/xen/hypervisor.h        |  1 +
>  arch/x86/kernel/cpu/amd.c                    | 26 ++++----
>  arch/x86/kernel/cpu/centaur.c                |  1 +
>  arch/x86/kernel/cpu/hygon.c                  |  1 +
>  arch/x86/kernel/cpu/mce/core.c               | 63 ++++++++++----------
>  arch/x86/kernel/cpu/mce/inject.c             |  1 +
>  arch/x86/kernel/cpu/microcode/core.c         | 23 +++----
>  arch/x86/kernel/cpu/microcode/intel.c        | 12 ++--
>  arch/x86/kernel/cpu/mshyperv.c               | 29 +++++----
>  arch/x86/kernel/cpu/resctrl/core.c           |  6 +-
>  arch/x86/kernel/cpu/resctrl/monitor.c        |  1 +
>  arch/x86/kernel/cpu/scattered.c              |  3 +-
>  arch/x86/kernel/cpu/sgx/main.c               |  3 +
>  arch/x86/kernel/cpu/topology_amd.c           |  3 +-
>  arch/x86/kernel/cpu/topology_common.c        |  3 +-
>  arch/x86/kernel/cpu/topology_ext.c           |  3 +-
>  arch/x86/kernel/cpu/transmeta.c              |  3 +
>  arch/x86/kernel/cpu/zhaoxin.c                |  1 +
>  arch/x86/kernel/cpuid.c                      |  6 +-
>  arch/x86/kernel/paravirt.c                   | 29 ++++-----
>  arch/x86/kvm/cpuid.h                         |  3 +
>  arch/x86/kvm/mmu/spte.c                      |  1 +
>  drivers/cpufreq/longrun.c                    |  7 ++-
>  drivers/cpufreq/powernow-k7.c                | 14 ++---
>  drivers/cpufreq/powernow-k8.c                | 17 +++---
>  drivers/cpufreq/speedstep-lib.c              |  6 +-
>  drivers/firmware/efi/libstub/x86-5lvl.c      |  1 +
>  drivers/hwmon/fam15h_power.c                 | 14 +++--
>  drivers/hwmon/k10temp.c                      |  2 +
>  drivers/hwmon/k8temp.c                       | 12 ++--
>  drivers/thermal/intel/intel_hfi.c            |  1 +
>  drivers/thermal/intel/x86_pkg_temp_thermal.c | 15 ++---
>  sound/soc/intel/avs/tgl.c                    | 25 +++++---
>  49 files changed, 235 insertions(+), 173 deletions(-)
>  delete mode 100644 arch/x86/include/asm/cpuid.h
> 
> base-commit: d7b8f8e20813f0179d8ef519541a3527e7661d3a
> -- 
> 2.49.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.