-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KVM: x86: Move lookup of indexed CPUID leafs to helper
Determining which CPUID leafs have significant ECX/index values is also needed by guest kernel code when doing SEV-SNP-validated CPUID lookups. Move this to common code to keep future updates in sync. Signed-off-by: Michael Roth <michael.roth@amd.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Venu Busireddy <venu.busireddy@oracle.com> Link: https://lore.kernel.org/r/20220307213356.2797205-31-brijesh.singh@amd.com
- Loading branch information
Michael Roth
authored and
Borislav Petkov
committed
Apr 7, 2022
1 parent
5ea98e0
commit b66370d
Showing
2 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* CPUID-related helpers/definitions | ||
* | ||
* Derived from arch/x86/kvm/cpuid.c | ||
*/ | ||
|
||
#ifndef _ASM_X86_CPUID_H | ||
#define _ASM_X86_CPUID_H | ||
|
||
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 0x8000001d: | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
#endif /* _ASM_X86_CPUID_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters