From nobody Wed Dec 17 12:03:44 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D156D2054EE for ; Mon, 17 Mar 2025 22:30:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250650; cv=none; b=Dwe/69ZDqbE0kzV6ULIMqCPUe2nmKkvSQ4dyYMCQe0z5YOyzb51NoGhSRuSMUiS2iWBIc3qmSNKyCUH49yz8QPvuQvYLsa+yvH10Xpmunypn1WC+d66SX3tB1E5JzftPZZZy3LsyrqfL0OhspC0iF8gqG4GnE+g+ENV9wz6WYvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250650; c=relaxed/simple; bh=WcEGww208zy+bPxqapBsXHqvk/kENIpTy7JJ2c8+Q7Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iOosLo+CfJui81ZG0+7Gu20xbM0XvlnntAyc1jwyI7iwFojSFb5L/zxukMxWnmqKn2Dl2iMpQ2sJlicJ41aZysCt62hU9G/nLJtfonE2rLwchvIfv8dc0rZ7b3GGzHaLve8Hjg7H+TzadH2o/Osjq+aoSpxsGkbi3QnWHruJd8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f2B/+aVV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f2B/+aVV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7F5EC4CEEF; Mon, 17 Mar 2025 22:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742250650; bh=WcEGww208zy+bPxqapBsXHqvk/kENIpTy7JJ2c8+Q7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2B/+aVVk7nDYQrgIwFJXohIFsYXYvnD962cyBxkWG6iHr7JZVqltxEPgOdr94s+l uZxRbujw08JGP5PfVMKLl605oy+hMxbgqY84Met2+26mp6GcdOFuMeNp/FMo92EbYd 7mCJly/aacNctcCEpwCYpC0jvx0ziC5t0oxqKiEgMoPDgXfY4w0Bp3dD0AOCr5Xuue vhv+9ZItl37MPByIwiLy9jbCLP0PFQT/tVnwVBSYpZ78Wi0Ax9vML7MgqAvU+xn8Hh I0nwMLDpocDhPGb4lGnW04/BnAIEnl3Att/EFffO7hcXMbJTy499Nyx3LnEyOrD2Ui BMZhyIYBOY9cw== From: mingo@kernel.org To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , "Ahmed S . Darwish" , Andrew Cooper , "H . Peter Anvin" , John Ogness , Linus Torvalds , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 1/5] x86/cpuid: Refactor Date: Mon, 17 Mar 2025 23:30:35 +0100 Message-ID: <20250317223039.3741082-2-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250317223039.3741082-1-mingo@kernel.org> References: <20250317223039.3741082-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: "Ahmed S. Darwish" In preparation for future commits where CPUID headers will be expanded, refactor the CPUID header into: asm/cpuid/ =E2=94=9C=E2=94=80=E2=94=80 api.h =E2=94=94=E2=94=80=E2=94=80 types.h Move the CPUID data structures into and the access APIs into . Let be just an include of so that existing call sites do not break. Suggested-by: Ingo Molnar Signed-off-by: Ahmed S. Darwish Signed-off-by: Ingo Molnar Cc: Andrew Cooper Cc: "H. Peter Anvin" Cc: John Ogness Cc: x86-cpuid@lists.linux.dev Link: https://lore.kernel.org/r/20250317164745.4754-3-darwi@linutronix.de --- arch/x86/include/asm/cpuid.h | 217 +--------------------------------= ------------------------ arch/x86/include/asm/cpuid/api.h | 208 +++++++++++++++++++++++++++++++++= +++++++++++++++++++++ arch/x86/include/asm/cpuid/types.h | 29 ++++++++ 3 files changed, 238 insertions(+), 216 deletions(-) diff --git a/arch/x86/include/asm/cpuid.h b/arch/x86/include/asm/cpuid.h index a92e4b08820a..d5749b25fa10 100644 --- a/arch/x86/include/asm/cpuid.h +++ b/arch/x86/include/asm/cpuid.h @@ -1,223 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* - * CPUID-related helpers/definitions - */ =20 #ifndef _ASM_X86_CPUID_H #define _ASM_X86_CPUID_H =20 -#include -#include - -#include - -struct cpuid_regs { - u32 eax, ebx, ecx, edx; -}; - -enum cpuid_regs_idx { - CPUID_EAX =3D 0, - CPUID_EBX, - CPUID_ECX, - CPUID_EDX, -}; - -#define CPUID_LEAF_MWAIT 0x5 -#define CPUID_LEAF_DCA 0x9 -#define CPUID_LEAF_XSTATE 0x0d -#define CPUID_LEAF_TSC 0x15 -#define CPUID_LEAF_FREQ 0x16 -#define CPUID_LEAF_TILE 0x1d - -#ifdef CONFIG_X86_32 -bool have_cpuid_p(void); -#else -static inline bool have_cpuid_p(void) -{ - return true; -} -#endif -static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ - /* ecx is often an input as well as an output. */ - asm volatile("cpuid" - : "=3Da" (*eax), - "=3Db" (*ebx), - "=3Dc" (*ecx), - "=3Dd" (*edx) - : "0" (*eax), "2" (*ecx) - : "memory"); -} - -#define native_cpuid_reg(reg) \ -static inline unsigned int native_cpuid_##reg(unsigned int op) \ -{ \ - unsigned int eax =3D op, ebx, ecx =3D 0, edx; \ - \ - native_cpuid(&eax, &ebx, &ecx, &edx); \ - \ - return reg; \ -} - -/* - * Native CPUID functions returning a single datum. - */ -native_cpuid_reg(eax) -native_cpuid_reg(ebx) -native_cpuid_reg(ecx) -native_cpuid_reg(edx) - -#ifdef CONFIG_PARAVIRT_XXL -#include -#else -#define __cpuid native_cpuid -#endif - -/* - * Generic CPUID function - * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx - * resulting in stale register contents being returned. - */ -static inline void cpuid(unsigned int op, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ - *eax =3D op; - *ecx =3D 0; - __cpuid(eax, ebx, ecx, edx); -} - -/* Some CPUID calls want 'count' to be placed in ecx */ -static inline void cpuid_count(unsigned int op, int count, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ - *eax =3D op; - *ecx =3D count; - __cpuid(eax, ebx, ecx, edx); -} - -/* - * CPUID functions returning a single datum - */ -static inline unsigned int cpuid_eax(unsigned int op) -{ - unsigned int eax, ebx, ecx, edx; - - cpuid(op, &eax, &ebx, &ecx, &edx); - - return eax; -} - -static inline unsigned int cpuid_ebx(unsigned int op) -{ - unsigned int eax, ebx, ecx, edx; - - cpuid(op, &eax, &ebx, &ecx, &edx); - - return ebx; -} - -static inline unsigned int cpuid_ecx(unsigned int op) -{ - unsigned int eax, ebx, ecx, edx; - - cpuid(op, &eax, &ebx, &ecx, &edx); - - return ecx; -} - -static inline unsigned int cpuid_edx(unsigned int op) -{ - unsigned int eax, ebx, ecx, edx; - - cpuid(op, &eax, &ebx, &ecx, &edx); - - return edx; -} - -static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u= 32 *regs) -{ - regs[CPUID_EAX] =3D leaf; - regs[CPUID_ECX] =3D subleaf; - __cpuid(regs + CPUID_EAX, regs + CPUID_EBX, regs + CPUID_ECX, regs + CPUI= D_EDX); -} - -#define cpuid_subleaf(leaf, subleaf, regs) { \ - static_assert(sizeof(*(regs)) =3D=3D 16); \ - __cpuid_read(leaf, subleaf, (u32 *)(regs)); \ -} - -#define cpuid_leaf(leaf, regs) { \ - static_assert(sizeof(*(regs)) =3D=3D 16); \ - __cpuid_read(leaf, 0, (u32 *)(regs)); \ -} - -static inline void __cpuid_read_reg(unsigned int leaf, unsigned int sublea= f, - enum cpuid_regs_idx regidx, u32 *reg) -{ - u32 regs[4]; - - __cpuid_read(leaf, subleaf, regs); - *reg =3D regs[regidx]; -} - -#define cpuid_subleaf_reg(leaf, subleaf, regidx, reg) { \ - static_assert(sizeof(*(reg)) =3D=3D 4); \ - __cpuid_read_reg(leaf, subleaf, regidx, (u32 *)(reg)); \ -} - -#define cpuid_leaf_reg(leaf, regidx, reg) { \ - static_assert(sizeof(*(reg)) =3D=3D 4); \ - __cpuid_read_reg(leaf, 0, regidx, (u32 *)(reg)); \ -} - -static __always_inline bool cpuid_function_is_indexed(u32 function) -{ - switch (function) { - case 4: - case 7: - case 0xb: - case 0xd: - case 0xf: - case 0x10: - case 0x12: - case 0x14: - case 0x17: - case 0x18: - case 0x1d: - case 0x1e: - case 0x1f: - case 0x24: - case 0x8000001d: - return true; - } - - return false; -} - -#define for_each_possible_hypervisor_cpuid_base(function) \ - for (function =3D 0x40000000; function < 0x40010000; function +=3D 0x100) - -static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t lea= ves) -{ - uint32_t base, eax, signature[3]; - - for_each_possible_hypervisor_cpuid_base(base) { - cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); - - /* - * This must not compile to "call memcmp" because it's called - * from PVH early boot code before instrumentation is set up - * and memcmp() itself may be instrumented. - */ - if (!__builtin_memcmp(sig, signature, 12) && - (leaves =3D=3D 0 || ((eax - base) >=3D leaves))) - return base; - } - - return 0; -} +#include =20 #endif /* _ASM_X86_CPUID_H */ diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/= api.h new file mode 100644 index 000000000000..4d1da9cc8b6f --- /dev/null +++ b/arch/x86/include/asm/cpuid/api.h @@ -0,0 +1,208 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ASM_X86_CPUID_API_H +#define _ASM_X86_CPUID_API_H + +#include +#include + +#include +#include + +/* + * Raw CPUID accessors + */ + +#ifdef CONFIG_X86_32 +bool have_cpuid_p(void); +#else +static inline bool have_cpuid_p(void) +{ + return true; +} +#endif +static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + /* ecx is often an input as well as an output. */ + asm volatile("cpuid" + : "=3Da" (*eax), + "=3Db" (*ebx), + "=3Dc" (*ecx), + "=3Dd" (*edx) + : "0" (*eax), "2" (*ecx) + : "memory"); +} + +#define native_cpuid_reg(reg) \ +static inline unsigned int native_cpuid_##reg(unsigned int op) \ +{ \ + unsigned int eax =3D op, ebx, ecx =3D 0, edx; \ + \ + native_cpuid(&eax, &ebx, &ecx, &edx); \ + \ + return reg; \ +} + +/* + * Native CPUID functions returning a single datum. + */ +native_cpuid_reg(eax) +native_cpuid_reg(ebx) +native_cpuid_reg(ecx) +native_cpuid_reg(edx) + +#ifdef CONFIG_PARAVIRT_XXL +#include +#else +#define __cpuid native_cpuid +#endif + +/* + * Generic CPUID function + * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx + * resulting in stale register contents being returned. + */ +static inline void cpuid(unsigned int op, + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + *eax =3D op; + *ecx =3D 0; + __cpuid(eax, ebx, ecx, edx); +} + +/* Some CPUID calls want 'count' to be placed in ecx */ +static inline void cpuid_count(unsigned int op, int count, + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + *eax =3D op; + *ecx =3D count; + __cpuid(eax, ebx, ecx, edx); +} + +/* + * CPUID functions returning a single datum + */ + +static inline unsigned int cpuid_eax(unsigned int op) +{ + unsigned int eax, ebx, ecx, edx; + + cpuid(op, &eax, &ebx, &ecx, &edx); + + return eax; +} + +static inline unsigned int cpuid_ebx(unsigned int op) +{ + unsigned int eax, ebx, ecx, edx; + + cpuid(op, &eax, &ebx, &ecx, &edx); + + return ebx; +} + +static inline unsigned int cpuid_ecx(unsigned int op) +{ + unsigned int eax, ebx, ecx, edx; + + cpuid(op, &eax, &ebx, &ecx, &edx); + + return ecx; +} + +static inline unsigned int cpuid_edx(unsigned int op) +{ + unsigned int eax, ebx, ecx, edx; + + cpuid(op, &eax, &ebx, &ecx, &edx); + + return edx; +} + +static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u= 32 *regs) +{ + regs[CPUID_EAX] =3D leaf; + regs[CPUID_ECX] =3D subleaf; + __cpuid(regs + CPUID_EAX, regs + CPUID_EBX, regs + CPUID_ECX, regs + CPUI= D_EDX); +} + +#define cpuid_subleaf(leaf, subleaf, regs) { \ + static_assert(sizeof(*(regs)) =3D=3D 16); \ + __cpuid_read(leaf, subleaf, (u32 *)(regs)); \ +} + +#define cpuid_leaf(leaf, regs) { \ + static_assert(sizeof(*(regs)) =3D=3D 16); \ + __cpuid_read(leaf, 0, (u32 *)(regs)); \ +} + +static inline void __cpuid_read_reg(unsigned int leaf, unsigned int sublea= f, + enum cpuid_regs_idx regidx, u32 *reg) +{ + u32 regs[4]; + + __cpuid_read(leaf, subleaf, regs); + *reg =3D regs[regidx]; +} + +#define cpuid_subleaf_reg(leaf, subleaf, regidx, reg) { \ + static_assert(sizeof(*(reg)) =3D=3D 4); \ + __cpuid_read_reg(leaf, subleaf, regidx, (u32 *)(reg)); \ +} + +#define cpuid_leaf_reg(leaf, regidx, reg) { \ + static_assert(sizeof(*(reg)) =3D=3D 4); \ + __cpuid_read_reg(leaf, 0, regidx, (u32 *)(reg)); \ +} + +static __always_inline bool cpuid_function_is_indexed(u32 function) +{ + switch (function) { + case 4: + case 7: + case 0xb: + case 0xd: + case 0xf: + case 0x10: + case 0x12: + case 0x14: + case 0x17: + case 0x18: + case 0x1d: + case 0x1e: + case 0x1f: + case 0x24: + case 0x8000001d: + return true; + } + + return false; +} + +#define for_each_possible_hypervisor_cpuid_base(function) \ + for (function =3D 0x40000000; function < 0x40010000; function +=3D 0x100) + +static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t lea= ves) +{ + uint32_t base, eax, signature[3]; + + for_each_possible_hypervisor_cpuid_base(base) { + cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); + + /* + * This must not compile to "call memcmp" because it's called + * from PVH early boot code before instrumentation is set up + * and memcmp() itself may be instrumented. + */ + if (!__builtin_memcmp(sig, signature, 12) && + (leaves =3D=3D 0 || ((eax - base) >=3D leaves))) + return base; + } + + return 0; +} + +#endif /* _ASM_X86_CPUID_API_H */ diff --git a/arch/x86/include/asm/cpuid/types.h b/arch/x86/include/asm/cpui= d/types.h new file mode 100644 index 000000000000..724002aaff4d --- /dev/null +++ b/arch/x86/include/asm/cpuid/types.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_CPUID_TYPES_H +#define _ASM_X86_CPUID_TYPES_H + +#include + +/* + * Types for raw CPUID access + */ + +struct cpuid_regs { + u32 eax, ebx, ecx, edx; +}; + +enum cpuid_regs_idx { + CPUID_EAX =3D 0, + CPUID_EBX, + CPUID_ECX, + CPUID_EDX, +}; + +#define CPUID_LEAF_MWAIT 0x5 +#define CPUID_LEAF_DCA 0x9 +#define CPUID_LEAF_XSTATE 0x0d +#define CPUID_LEAF_TSC 0x15 +#define CPUID_LEAF_FREQ 0x16 +#define CPUID_LEAF_TILE 0x1d + +#endif /* _ASM_X86_CPUID_TYPES_H */ --=20 2.45.2 From nobody Wed Dec 17 12:03:44 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5583A20551E for ; Mon, 17 Mar 2025 22:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250654; cv=none; b=tgCDCiV4yNk9GJsjhx6ZVebEC9bpN3X2Hs41BS4OgYGe5jv1WCAJpkKh/CLXDArEHPs+Pogn/Dov/i28jz5SY5zWB71Mj0uT/CZcb2QAczIHj53uIIUmry11XDcw69hd+JtrLQEgSjQzLGWd5BjHIneO7fhkhF7LaGTm0N1kI40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250654; c=relaxed/simple; bh=pqgXvmQEwCRm+NoMxc9rxEtfuUyeT4SNW94jBXjByHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qAaYZVAFKSoElojYr1Jde06sWtHyxtjCmb3BZCstLolJ01tVi+B2foJEpj4uZN0B8/a6w8Wbx/D5gs0KQERgLTBBOGBnGNkFbYm7ysQ08KDIogOUfaMB/XtPvu5nhx5hBPHiJ0xNK/+VwieC0tJtJMEJZiUk6pXl6/iR990/mmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mcx0m63w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mcx0m63w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D38C4CEE9; Mon, 17 Mar 2025 22:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742250653; bh=pqgXvmQEwCRm+NoMxc9rxEtfuUyeT4SNW94jBXjByHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mcx0m63wFlyuNjuocYvnghKG1Ek/fwHThspcZW1mVfS96LsMc2T0EZmH0yYYiBAcC 81wpkeQoR+P8HQGIeb/nL4deB3kG5p3qosO6WbeTwcdF3Zt4Fg1MqB8rUQ1o3xElPV 5z9nKCB79g+KdnTjeVj4X/Qe8SStDasVBN+Sb7db5UXKI6QKv8D6qn/Z7qIpSPzTvS LvjJ7D+0A4rH8TGzgMuP4RxkQwqYBgSg0kEXxjsDiL7X93aE02pRPVxA1j+p/baEWK 3nSxIDO9S5NIdYN0RiuD+EnvyZEhK4Ri2ccFRk4ad0eJKOsYa9DBfApS8KZ0n2+qHQ Ld4JFJkVEZClQ== From: mingo@kernel.org To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , "Ahmed S . Darwish" , Andrew Cooper , "H . Peter Anvin" , John Ogness , Linus Torvalds , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 2/5] x86/cpuid: Clean up Date: Mon, 17 Mar 2025 23:30:36 +0100 Message-ID: <20250317223039.3741082-3-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250317223039.3741082-1-mingo@kernel.org> References: <20250317223039.3741082-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ingo Molnar - 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 Cc: Ahmed S. Darwish Cc: Andrew Cooper Cc: "H. Peter Anvin" Cc: John Ogness Cc: x86-cpuid@lists.linux.dev Link: https://lore.kernel.org/r/20250317164745.4754-3-darwi@linutronix.de --- arch/x86/include/asm/cpuid/types.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/cpuid/types.h b/arch/x86/include/asm/cpui= d/types.h index 724002aaff4d..8582e27e836d 100644 --- a/arch/x86/include/asm/cpuid/types.h +++ b/arch/x86/include/asm/cpuid/types.h @@ -5,11 +5,14 @@ #include =20 /* - * Types for raw CPUID access + * Types for raw CPUID access: */ =20 struct cpuid_regs { - u32 eax, ebx, ecx, edx; + u32 eax; + u32 ebx; + u32 ecx; + u32 edx; }; =20 enum cpuid_regs_idx { @@ -19,8 +22,8 @@ enum cpuid_regs_idx { CPUID_EDX, }; =20 -#define CPUID_LEAF_MWAIT 0x5 -#define CPUID_LEAF_DCA 0x9 +#define CPUID_LEAF_MWAIT 0x05 +#define CPUID_LEAF_DCA 0x09 #define CPUID_LEAF_XSTATE 0x0d #define CPUID_LEAF_TSC 0x15 #define CPUID_LEAF_FREQ 0x16 --=20 2.45.2 From nobody Wed Dec 17 12:03:44 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91303204C39 for ; Mon, 17 Mar 2025 22:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250657; cv=none; b=TFGMRw40cflIrrT2rtQNETk+V/q7JsMI9GwDEOyPOGLbxpKkVFDldQHxMOxKXcO2tQdLZKGyuZ5UrqccWGqJRhe7DjokawNal3KGZxd4dRCk648v7x9W9WWrMPx47Gu0yWfnxwzZ2mAsbSCb4DU+KYc40cnOmjUZtiHJv5pyLvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250657; c=relaxed/simple; bh=OPIWwrqa3Yqq6CoPPNn6d5qUoYzQ3042gpCOIQHRUMg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VSx7KcxRvDuJ9VCOb61OCYTsji/mlIaSgnUwqfuiIZ4MLzdb4o+7rxqoqYxccoimge4yRa3Sa3P6+o7gFWDwVOj6MCRPD+yV9JiPsO7SDs2NOOznDYM6XAvkfSh8cOB3k4FM4ij80JH73HIGvNDOyw0gPo7AT2AjB7rKCAVC8WE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZvfvvnHf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZvfvvnHf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32CAEC4CEEF; Mon, 17 Mar 2025 22:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742250657; bh=OPIWwrqa3Yqq6CoPPNn6d5qUoYzQ3042gpCOIQHRUMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZvfvvnHfbTQ8TTqUJIFUo4w16o4i5TtWOaktIi274OOi2P7974zYIutGUMrJhqIyT diLBdsluBgbwiWN8oLkvo3wSklMCjfRskJVWD0/uMN7WIRGi91OsskUizcU0p/QkFU wxlf5AaTebkGkq82l5AIuOjnLaf5nhd841sND1tKC3S0qk3/r4nQyOhOFRErv15RyL SPqELSlqWsAKFisxSurV69IrH4fXACP9B+8JHBgvns07HKsLAlDKKpuP7y44gvuQvA I/wRlk79QJ8v9rVkHO0b9uJV10/Ez6VbRnp7ytpjJ9ErJhfSB9HEyYgNNPORySKzgW ruNvQGbaHwUpg== From: mingo@kernel.org To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , "Ahmed S . Darwish" , Andrew Cooper , "H . Peter Anvin" , John Ogness , Linus Torvalds , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 3/5] x86/cpuid: Clean up Date: Mon, 17 Mar 2025 23:30:37 +0100 Message-ID: <20250317223039.3741082-4-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250317223039.3741082-1-mingo@kernel.org> References: <20250317223039.3741082-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ingo Molnar - Include 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? - Use u32 instead of uint32_t in hypervisor_cpuid_base(). Yes, I realize uint32_t is used in Xen code, but this is a core x86 architecture header and we should standardize on the type that is being used overwhelmingly in x86 architecture code. The two types are the same so there should be no build warnings. Signed-off-by: Ingo Molnar Cc: Ahmed S. Darwish Cc: Andrew Cooper Cc: "H. Peter Anvin" Cc: John Ogness Cc: x86-cpuid@lists.linux.dev Link: https://lore.kernel.org/r/20250317164745.4754-3-darwi@linutronix.de --- arch/x86/include/asm/cpuid/api.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/= api.h index 4d1da9cc8b6f..f26926ba5289 100644 --- a/arch/x86/include/asm/cpuid/api.h +++ b/arch/x86/include/asm/cpuid/api.h @@ -1,16 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0 */ - #ifndef _ASM_X86_CPUID_API_H #define _ASM_X86_CPUID_API_H =20 +#include + #include #include =20 -#include #include =20 /* - * Raw CPUID accessors + * Raw CPUID accessors: */ =20 #ifdef CONFIG_X86_32 @@ -21,6 +21,7 @@ static inline bool have_cpuid_p(void) return true; } #endif + static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { @@ -34,7 +35,7 @@ static inline void native_cpuid(unsigned int *eax, unsign= ed int *ebx, : "memory"); } =20 -#define native_cpuid_reg(reg) \ +#define NATIVE_CPUID_REG(reg) \ static inline unsigned int native_cpuid_##reg(unsigned int op) \ { \ unsigned int eax =3D op, ebx, ecx =3D 0, edx; \ @@ -45,22 +46,23 @@ static inline unsigned int native_cpuid_##reg(unsigned = int op) \ } =20 /* - * Native CPUID functions returning a single datum. + * Native CPUID functions returning a single datum: */ -native_cpuid_reg(eax) -native_cpuid_reg(ebx) -native_cpuid_reg(ecx) -native_cpuid_reg(edx) +NATIVE_CPUID_REG(eax) +NATIVE_CPUID_REG(ebx) +NATIVE_CPUID_REG(ecx) +NATIVE_CPUID_REG(edx) =20 #ifdef CONFIG_PARAVIRT_XXL -#include +# include #else -#define __cpuid native_cpuid +# define __cpuid native_cpuid #endif =20 /* * Generic CPUID function - * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx + * + * Clear ECX since some CPUs (Cyrix MII) do not set or clear ECX * resulting in stale register contents being returned. */ static inline void cpuid(unsigned int op, @@ -72,7 +74,7 @@ static inline void cpuid(unsigned int op, __cpuid(eax, ebx, ecx, edx); } =20 -/* Some CPUID calls want 'count' to be placed in ecx */ +/* Some CPUID calls want 'count' to be placed in ECX */ static inline void cpuid_count(unsigned int op, int count, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) @@ -83,7 +85,7 @@ static inline void cpuid_count(unsigned int op, int count, } =20 /* - * CPUID functions returning a single datum + * CPUID functions returning a single datum: */ =20 static inline unsigned int cpuid_eax(unsigned int op) --=20 2.45.2 From nobody Wed Dec 17 12:03:44 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFEAF2063E7 for ; Mon, 17 Mar 2025 22:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250660; cv=none; b=ufif9OHdDUayTm6zA9j+lTkCP87p6Rd606J8YcKlmKwxhPtAk62iR/89tnuqdFmfFs/gx9SBtTUOcAFGVSA06hvAzULumI8BD1bTJ5lUxN9APS79ddccMlWrlzmdcsek9T0XRVmV3zZx1rrV+8j+MuIwZsSLM3JSYhJOOLuZTRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250660; c=relaxed/simple; bh=bqvVUagYkYFiGO2Hv9VCfYL4nMH2z5rutC4NBzLIUY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k2P+kicoFQ5aYIVqNJLgr4Q6rH7C1i2ESSPD4rd7MaTYUXv084FyZre+ajyqWFjArRSCDnwC4eTGdTheQqA94KFXv2Q7SHtfTrbmRVxEkIBllrSloRasBeYx3iehdehWKqI6Y+njlxdB5+hV6oLHB8oChMVQ6KycldPaGIifLP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XaybL5dF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XaybL5dF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79798C4CEE9; Mon, 17 Mar 2025 22:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742250660; bh=bqvVUagYkYFiGO2Hv9VCfYL4nMH2z5rutC4NBzLIUY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XaybL5dFMoMPWwz0KBpZR+QpHUawzR0NR+lplQcDVaW0Qmgf2LcyGu6mmmDmlzsQT gUWMcSq962b6OMGIX3RTYUkJTxAeCaKepS2+4ocwHrVsXqUjWnA66UjHurcy3X2zY1 JaC8gnn5lQBk4Gvo1AOaN5OlQVhDahaMMB4zp5/c+W5OZZW+mR4LZH3goBHSkqZKis TI8+ls9B28ukfVaVYGMqM0CTFl5BFXR2LsnbddouEJdseg33qJHn8TlW9urf0MUTOW LA1GtA5uyetfEnPei5F2a1KLsJUSr84bdECSyBCF9f9nUy/nIcU/k0COeU7yiq0HX7 RnU1C3miDNOsA== From: mingo@kernel.org To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , "Ahmed S . Darwish" , Andrew Cooper , "H . Peter Anvin" , John Ogness , Linus Torvalds , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 4/5] x86/cpuid: Standardize on u32 in Date: Mon, 17 Mar 2025 23:30:38 +0100 Message-ID: <20250317223039.3741082-5-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250317223039.3741082-1-mingo@kernel.org> References: <20250317223039.3741082-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ingo Molnar Convert all uses of 'unsigned int' to 'u32' in . 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 Cc: Ahmed S. Darwish Cc: Andrew Cooper Cc: "H. Peter Anvin" Cc: John Ogness Cc: x86-cpuid@lists.linux.dev Link: https://lore.kernel.org/r/20250317164745.4754-3-darwi@linutronix.de --- arch/x86/include/asm/cpuid/api.h | 40 ++++++++++++++++++++----------------= ---- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/= api.h index f26926ba5289..356db1894588 100644 --- a/arch/x86/include/asm/cpuid/api.h +++ b/arch/x86/include/asm/cpuid/api.h @@ -22,8 +22,8 @@ static inline bool have_cpuid_p(void) } #endif =20 -static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) +static inline void native_cpuid(u32 *eax, u32 *ebx, + u32 *ecx, u32 *edx) { /* ecx is often an input as well as an output. */ asm volatile("cpuid" @@ -36,9 +36,9 @@ static inline void native_cpuid(unsigned int *eax, unsign= ed int *ebx, } =20 #define NATIVE_CPUID_REG(reg) \ -static inline unsigned int native_cpuid_##reg(unsigned int op) \ +static inline u32 native_cpuid_##reg(u32 op) \ { \ - unsigned int eax =3D op, ebx, ecx =3D 0, edx; \ + u32 eax =3D op, ebx, ecx =3D 0, edx; \ \ native_cpuid(&eax, &ebx, &ecx, &edx); \ \ @@ -65,9 +65,9 @@ NATIVE_CPUID_REG(edx) * Clear ECX since some CPUs (Cyrix MII) do not set or clear ECX * resulting in stale register contents being returned. */ -static inline void cpuid(unsigned int op, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) +static inline void cpuid(u32 op, + u32 *eax, u32 *ebx, + u32 *ecx, u32 *edx) { *eax =3D op; *ecx =3D 0; @@ -75,9 +75,9 @@ static inline void cpuid(unsigned int op, } =20 /* Some CPUID calls want 'count' to be placed in ECX */ -static inline void cpuid_count(unsigned int op, int count, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) +static inline void cpuid_count(u32 op, int count, + u32 *eax, u32 *ebx, + u32 *ecx, u32 *edx) { *eax =3D op; *ecx =3D count; @@ -88,43 +88,43 @@ static inline void cpuid_count(unsigned int op, int cou= nt, * CPUID functions returning a single datum: */ =20 -static inline unsigned int cpuid_eax(unsigned int op) +static inline u32 cpuid_eax(u32 op) { - unsigned int eax, ebx, ecx, edx; + u32 eax, ebx, ecx, edx; =20 cpuid(op, &eax, &ebx, &ecx, &edx); =20 return eax; } =20 -static inline unsigned int cpuid_ebx(unsigned int op) +static inline u32 cpuid_ebx(u32 op) { - unsigned int eax, ebx, ecx, edx; + u32 eax, ebx, ecx, edx; =20 cpuid(op, &eax, &ebx, &ecx, &edx); =20 return ebx; } =20 -static inline unsigned int cpuid_ecx(unsigned int op) +static inline u32 cpuid_ecx(u32 op) { - unsigned int eax, ebx, ecx, edx; + u32 eax, ebx, ecx, edx; =20 cpuid(op, &eax, &ebx, &ecx, &edx); =20 return ecx; } =20 -static inline unsigned int cpuid_edx(unsigned int op) +static inline u32 cpuid_edx(u32 op) { - unsigned int eax, ebx, ecx, edx; + u32 eax, ebx, ecx, edx; =20 cpuid(op, &eax, &ebx, &ecx, &edx); =20 return edx; } =20 -static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u= 32 *regs) +static inline void __cpuid_read(u32 leaf, u32 subleaf, u32 *regs) { regs[CPUID_EAX] =3D leaf; regs[CPUID_ECX] =3D subleaf; @@ -141,7 +141,7 @@ static inline void __cpuid_read(unsigned int leaf, unsi= gned int subleaf, u32 *re __cpuid_read(leaf, 0, (u32 *)(regs)); \ } =20 -static inline void __cpuid_read_reg(unsigned int leaf, unsigned int sublea= f, +static inline void __cpuid_read_reg(u32 leaf, u32 subleaf, enum cpuid_regs_idx regidx, u32 *reg) { u32 regs[4]; --=20 2.45.2 From nobody Wed Dec 17 12:03:44 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EB202066C6 for ; Mon, 17 Mar 2025 22:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250663; cv=none; b=XRIXBnx2Hsi8XCDm6DRH/mvlGR3DV+wh84hzMErEV6hdby8BFqWTesmLiXlR/rskz6XSATJb2mtGdY7PgJQWuhGy+Wx8JsLgPr6kOfaILOVEMJ1snwP2dQ2is3DHCJzTnBHplXCMtvssPLp4sy12uaAWlHGve5a1nkFHVBk5m4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742250663; c=relaxed/simple; bh=CvczkV3kEQ54Jpf2Pd6IPrz8Itw3XX2xRtDAKbNLDZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KaiNt7GWkYDXQVuW4S0OU2O/Ki4aeU4+J1Rpbg36vWmBsOjstEdIDYghBCOkhS/FCZeQWEEb2ICvxkFLdLV+QRLtcO56L4vyPEX5fOuu2ciX8rdUHQM/Pka8r96c2+xlW6UYR84PXe8zpr5v9s5VZ9jBRDJBjmQgnED7P2bteJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vj4Kqiwj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vj4Kqiwj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5E72C4CEF0; Mon, 17 Mar 2025 22:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742250663; bh=CvczkV3kEQ54Jpf2Pd6IPrz8Itw3XX2xRtDAKbNLDZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vj4KqiwjI/3ifwWXjmdXvHVNYZHsFOHxWOXMRh9YQDHiecbtj8Fy9ZedcgDgEAm56 QMiK62Uu71rTUUHiNtWux3Ph4yaQHxaMVaAv3/H9lcF6qJPu/jEWyzTAoOziLd8zkB 7r5MlI7WcaNAwz2f+eQxDIEpjWoNmrrG8jqqk24G+HDXcbgBTu+wlWvBAbrKp/Fbis B+sRrOeTJvRpgyDKrBnZZQWviWRCMZ3AYtCkEZVl6zy1Hd3AbjaHuOgJC5wXQQrT60 HBOhyi8zZa0/0FAjeWmlg5yKTZF7mwDJYENNtxWO7mcmfHBnaAliB0LhDRJPlFCTy6 1L2o1yhfIDPTw== From: mingo@kernel.org To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , "Ahmed S . Darwish" , Andrew Cooper , "H . Peter Anvin" , John Ogness , Linus Torvalds , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 5/5] x86/cpuid: Use u32 in instead of uint32_t in Date: Mon, 17 Mar 2025 23:30:39 +0100 Message-ID: <20250317223039.3741082-6-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250317223039.3741082-1-mingo@kernel.org> References: <20250317223039.3741082-1-mingo@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ingo Molnar Use u32 instead of uint32_t in hypervisor_cpuid_base(). Yes, I realize 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 Cc: Juergen Gross Cc: Stefano Stabellini Cc: Ahmed S. Darwish Cc: Andrew Cooper Cc: "H. Peter Anvin" Cc: John Ogness Cc: x86-cpuid@lists.linux.dev Link: https://lore.kernel.org/r/20250317164745.4754-3-darwi@linutronix.de --- arch/x86/include/asm/cpuid/api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/= api.h index 356db1894588..9c180c9cc58e 100644 --- a/arch/x86/include/asm/cpuid/api.h +++ b/arch/x86/include/asm/cpuid/api.h @@ -187,9 +187,9 @@ static __always_inline bool cpuid_function_is_indexed(u= 32 function) #define for_each_possible_hypervisor_cpuid_base(function) \ for (function =3D 0x40000000; function < 0x40010000; function +=3D 0x100) =20 -static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t lea= ves) +static inline u32 hypervisor_cpuid_base(const char *sig, u32 leaves) { - uint32_t base, eax, signature[3]; + u32 base, eax, signature[3]; =20 for_each_possible_hypervisor_cpuid_base(base) { cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); --=20 2.45.2