From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUkiO-0000Xu-8q for qemu-devel@nongnu.org; Wed, 04 Feb 2009 11:35:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUkiM-0000Vj-5P for qemu-devel@nongnu.org; Wed, 04 Feb 2009 11:35:02 -0500 Received: from [199.232.76.173] (port=46955 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUkiM-0000Ve-0F for qemu-devel@nongnu.org; Wed, 04 Feb 2009 11:35:02 -0500 Received: from mx2.redhat.com ([66.187.237.31]:56145) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUkiL-0001sS-GG for qemu-devel@nongnu.org; Wed, 04 Feb 2009 11:35:01 -0500 From: Amit Shah Date: Wed, 4 Feb 2009 22:05:00 +0530 Message-Id: <1233765300-21850-4-git-send-email-amit.shah@redhat.com> In-Reply-To: <1233765300-21850-3-git-send-email-amit.shah@redhat.com> References: <1233765300-21850-1-git-send-email-amit.shah@redhat.com> <1233765300-21850-2-git-send-email-amit.shah@redhat.com> <1233765300-21850-3-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH] KVM: Get all cpuid values from function 2 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: Amit Shah , qemu-devel@nongnu.org cpuid function 2 can have multiple values to describe cache behaviour. Loop till we have fetched all the values. Signed-off-by: Amit Shah --- qemu/target-i386/kvm.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c index b9c106e..93ff31f 100644 --- a/qemu/target-i386/kvm.c +++ b/qemu/target-i386/kvm.c @@ -51,6 +51,32 @@ int kvm_arch_init_vcpu(CPUState *env) 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: -- 1.6.0.6