Ingo Molnar
a46f322661
x86/cpuid: Use u32 in instead of uint32_t in <asm/cpuid/api.h>
...
Use u32 instead of uint32_t in hypervisor_cpuid_base().
Yes, uint32_t is used in Xen code et al, but this is a core x86
architecture header and we should standardize on the type that
is being used overwhelmingly in related x86 architecture code.
The two types are the same so there should be no build warnings.
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Cc: Andrew Cooper <andrew.cooper3@citrix.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: "Ahmed S. Darwish" <darwi@linutronix.de >
Cc: x86-cpuid@lists.linux.dev
Link: https://lore.kernel.org/r/20250317221824.3738853-6-mingo@kernel.org
2025-03-19 11:19:28 +01:00
Ingo Molnar
cfb4fc5f08
x86/cpuid: Standardize on u32 in <asm/cpuid/api.h>
...
Convert all uses of 'unsigned int' to 'u32' in <asm/cpuid/api.h>.
This is how a lot of the call sites are doing it, and the two
types are equivalent in the C sense - but 'u32' better expresses
that these are expressions of an immutable hardware ABI.
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Reviewed-by: Xin Li (Intel) <xin@zytor.com >
Cc: Andrew Cooper <andrew.cooper3@citrix.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: "Ahmed S. Darwish" <darwi@linutronix.de >
Cc: x86-cpuid@lists.linux.dev
Link: https://lore.kernel.org/r/20250317221824.3738853-5-mingo@kernel.org
2025-03-19 11:19:26 +01:00
Ingo Molnar
fb99ed1e00
x86/cpuid: Clean up <asm/cpuid/api.h>
...
- Include <asm/cpuid/types.h> first, as is customary. This also has
the side effect of build-testing the header dependency assumptions
in the types header.
- No newline necessary after the SPDX line
- Newline necessary after inline function definitions
- Rename native_cpuid_reg() to NATIVE_CPUID_REG(): it's a CPP macro,
whose name we capitalize in such cases.
- Prettify the CONFIG_PARAVIRT_XXL inclusion block a bit
- Standardize register references in comments to EAX/EBX/ECX/etc.,
from the hodgepodge of references.
- s/cpus/CPUs because why add noise to common acronyms?
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Cc: Andrew Cooper <andrew.cooper3@citrix.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: "Ahmed S. Darwish" <darwi@linutronix.de >
Cc: x86-cpuid@lists.linux.dev
Link: https://lore.kernel.org/r/20250317221824.3738853-4-mingo@kernel.org
2025-03-19 11:19:25 +01:00
Ingo Molnar
04a1007004
x86/cpuid: Clean up <asm/cpuid/types.h>
...
- We have 0x0d, 0x9 and 0x1d as literals for the CPUID_LEAF definitions,
pick a single, consistent style of 0xZZ literals.
- Likewise, harmonize the style of the 'struct cpuid_regs' list of
registers with that of 'enum cpuid_regs_idx'. Because while computers
don't care about unnecessary visual noise, humans do.
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Cc: Andrew Cooper <andrew.cooper3@citrix.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: "Ahmed S. Darwish" <darwi@linutronix.de >
Cc: x86-cpuid@lists.linux.dev
Link: https://lore.kernel.org/r/20250317221824.3738853-3-mingo@kernel.org
2025-03-19 11:19:23 +01:00
Ahmed S. Darwish
adc574269b
x86/cpuid: Refactor <asm/cpuid.h>
...
In preparation for future commits where CPUID headers will be expanded,
refactor the CPUID header <asm/cpuid.h> into:
asm/cpuid/
├── api.h
└── types.h
Move the CPUID data structures into <asm/cpuid/types.h> and the access
APIs into <asm/cpuid/api.h>. Let <asm/cpuid.h> be just an include of
<asm/cpuid/api.h> so that existing call sites do not break.
Suggested-by: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Cc: Andrew Cooper <andrew.cooper3@citrix.com >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: "Ahmed S. Darwish" <darwi@linutronix.de >
Cc: x86-cpuid@lists.linux.dev
Link: https://lore.kernel.org/r/20250317221824.3738853-2-mingo@kernel.org
2025-03-19 11:19:22 +01:00