From: Amit Shah <amit.shah@redhat.com>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>,
aliguori@us.ibm.com, avi@redhat.com, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd.
Date: Mon, 12 Jan 2009 11:58:37 +0000 [thread overview]
Message-ID: <1231761517-12939-1-git-send-email-amit.shah@redhat.com> (raw)
CPUID functions 4, 0xb and 0xd have sub-leaf values which depend on the
input value of ECX. Store these values as well.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
qemu/target-i386/kvm.c | 40 +++++++++++++++++++++++++++++-----------
1 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c
index f87bf36..c17e58b 100644
--- a/qemu/target-i386/kvm.c
+++ b/qemu/target-i386/kvm.c
@@ -39,32 +39,50 @@ int kvm_arch_init_vcpu(CPUState *env)
struct kvm_cpuid cpuid;
struct kvm_cpuid_entry entries[100];
} __attribute__((packed)) cpuid_data;
- uint32_t limit, i, cpuid_i;
+ uint32_t limit, i, j, cpuid_i;
uint32_t eax, ebx, ecx, edx;
cpuid_i = 0;
- cpu_x86_cpuid(env, 0, &eax, &ebx, &ecx, &edx);
+ cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0; i <= limit; i++) {
struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
- cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
- c->function = i;
- c->eax = eax;
- c->ebx = ebx;
- c->ecx = ecx;
- c->edx = edx;
+ if (i == 4 || i == 0xb || i == 0xd) {
+ for (j = 0; ; j++) {
+ cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx);
+ c->function = i;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+ c = &cpuid_data.entries[++cpuid_i];
+
+ if (i == 4 && eax == 0)
+ break;
+ if (i == 0xb && !(ecx & 0xff00))
+ break;
+ if (i == 0xd && eax == 0)
+ break;
+ }
+ } else {
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+ c->function = i;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+ }
}
-
- cpu_x86_cpuid(env, 0x80000000, &eax, &ebx, &ecx, &edx);
+ cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx);
limit = eax;
for (i = 0x80000000; i <= limit; i++) {
struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
- cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
c->function = i;
c->eax = eax;
c->ebx = ebx;
--
1.6.0.6
next reply other threads:[~2009-01-12 11:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 11:58 Amit Shah [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-01-13 7:09 [Qemu-devel] v2: KVM: support for 'count' in CPUID functions 4, 0xb and 0xd Amit Shah
2009-01-13 7:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-01-13 7:09 ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-02-04 16:34 [Qemu-devel] KVM: completely support cpuid functions 2, 4, b, d Amit Shah
2009-02-04 16:34 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-02-04 16:34 ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-02-09 14:09 [Qemu-devel] v23: KVM: Complete support for cpuid functions 2, 4, b, d Amit Shah
2009-02-09 14:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-02-09 14:09 ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
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=1231761517-12939-1-git-send-email-amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--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).