From: Amit Shah <amit.shah@redhat.com> To: qemu-devel@nongnu.org Cc: avi@redhat.com, kvm@vger.kernel.org, aliguori@us.ibm.com, Amit Shah <amit.shah@redhat.com> Subject: [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd. Date: Tue, 13 Jan 2009 07:09:05 +0000 [thread overview] Message-ID: <1231830545-1788-3-git-send-email-amit.shah@redhat.com> (raw) In-Reply-To: <1231830545-1788-2-git-send-email-amit.shah@redhat.com> 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 | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c index bef3150..c17e58b 100644 --- a/qemu/target-i386/kvm.c +++ b/qemu/target-i386/kvm.c @@ -39,7 +39,7 @@ 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; @@ -50,14 +50,32 @@ int kvm_arch_init_vcpu(CPUState *env) for (i = 0; i <= limit; i++) { struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++]; - 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; + 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, 0, &eax, &ebx, &ecx, &edx); limit = eax; -- 1.6.0.6
WARNING: multiple messages have this Message-ID (diff)
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: Tue, 13 Jan 2009 07:09:05 +0000 [thread overview] Message-ID: <1231830545-1788-3-git-send-email-amit.shah@redhat.com> (raw) In-Reply-To: <1231830545-1788-2-git-send-email-amit.shah@redhat.com> 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 | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c index bef3150..c17e58b 100644 --- a/qemu/target-i386/kvm.c +++ b/qemu/target-i386/kvm.c @@ -39,7 +39,7 @@ 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; @@ -50,14 +50,32 @@ int kvm_arch_init_vcpu(CPUState *env) for (i = 0; i <= limit; i++) { struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++]; - 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; + 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, 0, &eax, &ebx, &ecx, &edx); limit = eax; -- 1.6.0.6
next prev parent reply other threads:[~2009-01-13 7:09 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-01-13 7:09 v2: KVM: support for 'count' in CPUID functions 4, 0xb and 0xd Amit Shah 2009-01-13 7:09 ` [Qemu-devel] " Amit Shah 2009-01-13 7:09 ` [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah 2009-01-13 7:09 ` [Qemu-devel] " Amit Shah 2009-01-13 7:09 ` Amit Shah [this message] 2009-01-13 7:09 ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah 2009-01-13 8:25 ` [Qemu-devel] v2: KVM: support for 'count' in CPUID functions 4, 0xb and 0xd Alexander Graf 2009-01-13 9:10 ` Amit Shah 2009-01-13 9:10 ` Amit Shah 2009-01-13 11:06 ` Amit Shah 2009-01-13 11:06 ` Amit Shah 2009-01-13 9:56 ` [PATCH] Always return latest pmsts instead of the old one Zhang, Xiantao 2009-01-13 9:56 ` [Qemu-devel] " Zhang, Xiantao 2009-01-15 6:27 ` Zhang, Xiantao 2009-01-15 6:27 ` [Qemu-devel] " Zhang, Xiantao 2009-01-15 21:55 ` Anthony Liguori 2009-01-15 21:55 ` [Qemu-devel] " Anthony Liguori 2009-01-19 14:12 ` Zhang, Xiantao 2009-01-19 14:12 ` [Qemu-devel] " Zhang, Xiantao 2009-01-21 3:51 ` Zhang, Xiantao 2009-01-21 3:51 ` [Qemu-devel] " Zhang, Xiantao 2009-01-21 16:35 ` Anthony Liguori 2009-01-21 16:35 ` [Qemu-devel] " Anthony Liguori -- strict thread matches above, loose matches on Subject: below -- 2009-01-12 11:58 [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=1231830545-1788-3-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.