mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
KVM: selftests: Set input function/index in raw CPUID helper(s)
Set the function/index for CPUID in the helper instead of relying on the caller to do so. In addition to reducing the risk of consuming an uninitialized ECX, having the function/index embedded in the call makes it easier to understand what is being checked. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-32-seanjc@google.com
This commit is contained in:
@@ -31,10 +31,9 @@ static void test_guest_cpuids(struct kvm_cpuid2 *guest_cpuid)
|
||||
u32 eax, ebx, ecx, edx;
|
||||
|
||||
for (i = 0; i < guest_cpuid->nent; i++) {
|
||||
eax = guest_cpuid->entries[i].function;
|
||||
ecx = guest_cpuid->entries[i].index;
|
||||
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
__cpuid(guest_cpuid->entries[i].function,
|
||||
guest_cpuid->entries[i].index,
|
||||
&eax, &ebx, &ecx, &edx);
|
||||
|
||||
GUEST_ASSERT(eax == guest_cpuid->entries[i].eax &&
|
||||
ebx == guest_cpuid->entries[i].ebx &&
|
||||
@@ -46,9 +45,9 @@ static void test_guest_cpuids(struct kvm_cpuid2 *guest_cpuid)
|
||||
|
||||
static void test_cpuid_40000000(struct kvm_cpuid2 *guest_cpuid)
|
||||
{
|
||||
u32 eax = 0x40000000, ebx, ecx = 0, edx;
|
||||
u32 eax, ebx, ecx, edx;
|
||||
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
GUEST_ASSERT(eax == 0x40000001);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user