[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250723173644.33568-1-darwi@linutronix.de>
Date: Wed, 23 Jul 2025 19:36:39 +0200
From: "Ahmed S. Darwish" <darwi@...utronix.de>
To: Borislav Petkov <bp@...en8.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Juergen Gross <jgross@...e.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
John Ogness <john.ogness@...utronix.de>,
x86@...nel.org,
kvm@...r.kernel.org,
x86-cpuid@...ts.linux.dev,
LKML <linux-kernel@...r.kernel.org>,
"Ahmed S. Darwish" <darwi@...utronix.de>
Subject: [PATCH v4 0/4] x86: Disentangle <asm/processor.h> dependency on CPUID headers
Hi,
This series stops <asm/processor.h> from including <asm/cpuid/api.h>
since there is no code at the former which needs the latter.
For this to work, modify all CPUID call sites that implicitly include the
CPUID <asm/cpuid/api.h> header to explicitly include it instead
This allows the CPUID API header to include <asm/processor.h> without
inducing a circular dependency — which is needed for the upcoming CPUID
model and parser.
Changelog v4
~~~~~~~~~~~~
Per feedback at:
https://lore.kernel.org/lkml/aH-dqcMWj3cFDos2@google.com
Remove the two patches doing the include lines alphabetical and section
reorderings.
I leave it to the maintainers to merge this series or version 3 of it:
highest priority is to keep the CPUID parser work ongoing (by
disentangling the headers…)
Changelog v3
~~~~~~~~~~~~
( [PATCH v3 0/6] x86: Disentangle <asm/processor.h> dependency on CPUID headers
https://lore.kernel.org/lkml/20250722065448.413503-1-darwi@linutronix.de )
* For the KVM CPUID call sites:
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/vmx/sgx.c
arch/x86/kvm/vmx/vmx.c
Let them explicitly include <asm/cpuid/api.h> instead of letting their
internal arch/x86/kvm/cpuid.h header does it. The latter header does
not need the former, so making it include a itnot just for the sake of
its call sites was not correct.
* While at it, modify /all/ call sites that use the CPUID API to
explicitly include <asm/cpuid/api.h>.
Previous iterations only modified the CPUID call sites which implicitly
included the CPUID headers through <asm/processor.h>. Since we're at
it anyway, there's no reason not to complete the task across the whole
kernel tree.
Thus, also convert below arch/x86/ sites:
arch/x86/kernel/apic/apic.c
arch/x86/kernel/cpu/sgx/driver.c
arch/x86/kernel/cpu/vmware.c
arch/x86/kernel/jailhouse.c
arch/x86/kernel/kvm.c
arch/x86/mm/pti.c
arch/x86/pci/xen.c
arch/x86/xen/enlighten_hvm.c
arch/x86/xen/pmu.c
arch/x86/xen/time.c
and below drivers/ sites:
drivers/gpu/drm/gma500/mmu.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/ras/amd/fmpm.c
drivers/virt/acrn/hsm.c
drivers/xen/events/events_base.c
drivers/xen/grant-table.c
drivers/xen/xenbus/xenbus_xs.c
to explicitly include the CPUID API header.
* Fix the v2 i386 compilation error:
https://lore.kernel.org/x86-cpuid/202507150403.hKKg9xjJ-lkp@intel.com
by making drivers/char/agp/efficeon-agp.c explicitly include the CPUID
API.
* Make sure that an "i386 allyesconfig" build is successful this time.
* Based on v6.16-rc7.
Changelog v2
~~~~~~~~~~~~
( [PATCH v2 0/6] x86: Disentangle <asm/processor.h> dependency on CPUID headers
https://lore.kernel.org/lkml/20250709203033.90125-1-darwi@linutronix.de )
Remove the <asm/cpuid/types.h> include from <asm/processor.h> since only
the upcoming CPUID model needed that — not current mainline code. That
include was kept in v1, by mistake, because this series was originally
part of the CPUID model patch queue.
Due to the CPUID types include remove above, let
arch/x86/kvm/reverse_cpuid.h include <asm/cpuid/types.h> since it
references the CPUID_EAX..EDX macros. At this series v1, the KVM header
implicitly included such CPUID types header through <asm/cpufeature.h>,
through <asm/processor.h>.
Drop the "x86/cpuid: Rename cpuid_leaf()/cpuid_subleaf() APIs" patch from
this series. After a second look, it should be part of the CPUID model
PQ instead.
Changelog v1
~~~~~~~~~~~~
( [PATCH v1 0/7] x86: Disentangle <asm/processor.h> dependency on CPUID APIs
https://lore.kernel.org/lkml/20250612234010.572636-1-darwi@linutronix.de )
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.
Let <asm/processor.h> include <asm/cpuid/types.h> instead of
<asm/cpuid/api.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/20250612234010.572636-1-darwi@linutronix.de
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/202506132039.imS2Pflx-lkp@intel.com
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
drivers/cpufreq/longrun.c
drivers/cpufreq/powernow-k7.c
drivers/cpufreq/powernow-k8.c
to explicitly include <asm/cpuid/api.h>.
Based on v6.16-rc5.
Thanks!
8<----
Ahmed S. Darwish (4):
x86/cpuid: Remove transitional <asm/cpuid.h> header
ASoC: Intel: avs: Include CPUID header at file scope
treewide: Explicitly include the x86 CPUID headers
x86/cpu: <asm/processor.h>: Do not include the CPUID API header
arch/x86/boot/compressed/pgtable_64.c | 1 +
arch/x86/boot/startup/sme.c | 1 +
arch/x86/coco/tdx/tdx.c | 1 +
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 | 1 +
arch/x86/events/intel/core.c | 1 +
arch/x86/events/intel/lbr.c | 1 +
arch/x86/events/zhaoxin/core.c | 1 +
arch/x86/include/asm/acrn.h | 2 ++
arch/x86/include/asm/cpuid.h | 8 ------
arch/x86/include/asm/microcode.h | 1 +
arch/x86/include/asm/processor.h | 1 -
arch/x86/include/asm/xen/hypervisor.h | 1 +
arch/x86/kernel/apic/apic.c | 1 +
arch/x86/kernel/cpu/amd.c | 1 +
arch/x86/kernel/cpu/centaur.c | 1 +
arch/x86/kernel/cpu/hygon.c | 1 +
arch/x86/kernel/cpu/mce/core.c | 1 +
arch/x86/kernel/cpu/mce/inject.c | 1 +
arch/x86/kernel/cpu/microcode/amd.c | 1 +
arch/x86/kernel/cpu/microcode/core.c | 1 +
arch/x86/kernel/cpu/microcode/intel.c | 1 +
arch/x86/kernel/cpu/mshyperv.c | 1 +
arch/x86/kernel/cpu/resctrl/core.c | 1 +
arch/x86/kernel/cpu/resctrl/monitor.c | 1 +
arch/x86/kernel/cpu/scattered.c | 1 +
arch/x86/kernel/cpu/sgx/driver.c | 3 +++
arch/x86/kernel/cpu/sgx/main.c | 3 +++
arch/x86/kernel/cpu/topology_amd.c | 1 +
arch/x86/kernel/cpu/topology_common.c | 1 +
arch/x86/kernel/cpu/topology_ext.c | 1 +
arch/x86/kernel/cpu/transmeta.c | 3 +++
arch/x86/kernel/cpu/vmware.c | 1 +
arch/x86/kernel/cpu/zhaoxin.c | 1 +
arch/x86/kernel/cpuid.c | 1 +
arch/x86/kernel/jailhouse.c | 1 +
arch/x86/kernel/kvm.c | 1 +
arch/x86/kernel/paravirt.c | 1 +
arch/x86/kvm/mmu/mmu.c | 1 +
arch/x86/kvm/mmu/spte.c | 1 +
arch/x86/kvm/reverse_cpuid.h | 2 ++
arch/x86/kvm/svm/svm.c | 1 +
arch/x86/kvm/vmx/pmu_intel.c | 1 +
arch/x86/kvm/vmx/sgx.c | 1 +
arch/x86/kvm/vmx/vmx.c | 1 +
arch/x86/mm/pti.c | 1 +
arch/x86/pci/xen.c | 2 +-
arch/x86/xen/enlighten_hvm.c | 1 +
arch/x86/xen/pmu.c | 1 +
arch/x86/xen/time.c | 1 +
drivers/char/agp/efficeon-agp.c | 1 +
drivers/cpufreq/longrun.c | 1 +
drivers/cpufreq/powernow-k7.c | 2 +-
drivers/cpufreq/powernow-k8.c | 1 +
drivers/cpufreq/speedstep-lib.c | 1 +
drivers/firmware/efi/libstub/x86-5lvl.c | 1 +
drivers/gpu/drm/gma500/mmu.c | 2 ++
drivers/hwmon/fam15h_power.c | 1 +
drivers/hwmon/k10temp.c | 2 ++
drivers/hwmon/k8temp.c | 1 +
.../net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 +
drivers/ras/amd/fmpm.c | 1 +
drivers/thermal/intel/intel_hfi.c | 1 +
drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 +
drivers/virt/acrn/hsm.c | 1 +
drivers/xen/events/events_base.c | 1 +
drivers/xen/grant-table.c | 1 +
drivers/xen/xenbus/xenbus_xs.c | 3 +++
sound/soc/intel/avs/tgl.c | 25 ++++++++++++-------
72 files changed, 101 insertions(+), 20 deletions(-)
delete mode 100644 arch/x86/include/asm/cpuid.h
base-commit: 89be9a83ccf1f88522317ce02f854f30d6115c41
--
2.50.1
Powered by blists - more mailing lists