From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah)
Date: Mon, 09 Feb 2009 15:50:37 +0000 [thread overview]
Message-ID: <E1LWYP7-000785-3Z@cvs.savannah.gnu.org> (raw)
Revision: 6567
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6567
Author: aliguori
Date: 2009-02-09 15:50:36 +0000 (Mon, 09 Feb 2009)
Log Message:
-----------
KVM: Get all cpuid values from function 2 (Amit Shah)
cpuid function 2 can have multiple values to describe cache behaviour.
Loop till we have fetched all the values.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Modified Paths:
--------------
trunk/target-i386/kvm.c
Modified: trunk/target-i386/kvm.c
===================================================================
--- trunk/target-i386/kvm.c 2009-02-09 15:50:31 UTC (rev 6566)
+++ trunk/target-i386/kvm.c 2009-02-09 15:50:36 UTC (rev 6567)
@@ -51,6 +51,32 @@
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
switch (i) {
+ case 2: {
+ /* Keep reading function 2 till all the input is received */
+ int times;
+
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+ times = eax & 0xff;
+
+ c->function = i;
+ c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
+ c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+
+ for (j = 1; j < times; ++j) {
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+ c->function = i;
+ c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+ }
+ break;
+ }
case 4:
case 0xb:
case 0xd:
next reply other threads:[~2009-02-09 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 15:50 Anthony Liguori [this message]
2009-02-09 16:06 ` [Qemu-devel] [6567] KVM: Get all cpuid values from function 2 (Amit Shah) Avi Kivity
2009-02-09 16:46 ` Anthony Liguori
2009-02-09 17:03 ` Amit Shah
2009-02-09 18:27 ` Avi Kivity
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=E1LWYP7-000785-3Z@cvs.savannah.gnu.org \
--to=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).