From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Sean Christopherson <seanjc@google.com>,
Jim Mattson <jmattson@google.com>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
Shuah Khan <shuah@kernel.org>, Alexander Graf <graf@amazon.com>,
Andrew Jones <drjones@redhat.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 4/4] selftests: kvm: add get_emulated_cpuid test
Date: Thu, 1 Apr 2021 11:54:49 +0200 [thread overview]
Message-ID: <1b274a70-e98a-41b2-93ec-537a2315619e@redhat.com> (raw)
In-Reply-To: <87k0pms6no.fsf@vitty.brq.redhat.com>
>> +static void check_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 *entrie)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < cpuid->nent; i++) {
>> + if (cpuid->entries[i].function == entrie->function &&
>> + cpuid->entries[i].index == entrie->index) {
>> + if (is_cpuid_mangled(entrie))
>> + return;
>> +
>> + TEST_ASSERT(cpuid->entries[i].eax == entrie->eax &&
>> + cpuid->entries[i].ebx == entrie->ebx &&
>> + cpuid->entries[i].ecx == entrie->ecx &&
>> + cpuid->entries[i].edx == entrie->edx,
>> + "CPUID 0x%x.%x differ: 0x%x:0x%x:0x%x:0x%x vs 0x%x:0x%x:0x%x:0x%x",
>> + entrie->function, entrie->index,
>> + cpuid->entries[i].eax, cpuid->entries[i].ebx,
>> + cpuid->entries[i].ecx, cpuid->entries[i].edx,
>> + entrie->eax, entrie->ebx, entrie->ecx, entrie->edx);
>> + return;
>> + }
>> + }
>> +
>> + TEST_ASSERT(false, "CPUID 0x%x.%x not found", entrie->function, entrie->index);
>> +}
>> +
>> +static void compare_cpuids(struct kvm_cpuid2 *cpuid1,
>> + struct kvm_cpuid2 *cpuid2)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < cpuid1->nent; i++)
>> + check_cpuid(cpuid2, &cpuid1->entries[i]);
>> +
>> + for (i = 0; i < cpuid2->nent; i++)
>> + check_cpuid(cpuid1, &cpuid2->entries[i]);
>> +}
>
> CPUID comparison here seems to be borrowed from get_cpuid_test.c, I
> think we can either put it to a library or (my preference) just merge
> these two selftests together. 'get_cpuid_test' name is generic enough to
> be used for KVM_GET_EMULATED_CPUID too.
Yes it is identical. I agree with you, I will merge the test in
get_cpuid_test.c
Emanuele
prev parent reply other threads:[~2021-04-01 9:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 18:58 [PATCH 0/4] kvm: cpuid: fix cpuid nent field Emanuele Giuseppe Esposito
2021-03-30 18:58 ` [PATCH 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID Emanuele Giuseppe Esposito
2021-03-31 3:01 ` Sean Christopherson
2021-03-31 7:21 ` Emanuele Giuseppe Esposito
2021-03-31 7:56 ` Vitaly Kuznetsov
2021-03-31 10:07 ` Emanuele Giuseppe Esposito
2021-03-31 11:25 ` Vitaly Kuznetsov
2021-03-30 18:58 ` [PATCH 2/4] Documentation: kvm: update KVM_GET_EMULATED_CPUID ioctl description Emanuele Giuseppe Esposito
2021-03-30 18:58 ` [PATCH 3/4] selftests: add kvm_get_emulated_cpuid Emanuele Giuseppe Esposito
2021-03-30 18:58 ` [PATCH 4/4] selftests: kvm: add get_emulated_cpuid test Emanuele Giuseppe Esposito
2021-04-01 9:20 ` Vitaly Kuznetsov
2021-04-01 9:54 ` Emanuele Giuseppe Esposito [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b274a70-e98a-41b2-93ec-537a2315619e@redhat.com \
--to=eesposit@redhat.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=drjones@redhat.com \
--cc=graf@amazon.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox