From: Marcelo Tosatti <mtosatti@redhat.com> To: Anthony Liguori <aliguori@us.ibm.com> Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Eduardo Habkost <ehabkost@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com> Subject: [PATCH 04/28] i386: kvm: extract register switch to cpuid_entry_get_reg() function Date: Wed, 31 Oct 2012 07:39:42 -0200 [thread overview] Message-ID: <829ae2f9fa37bf026de556f50d58ef14a7dab9b3.1351676405.git.mtosatti@redhat.com> (raw) In-Reply-To: <cover.1351676405.git.mtosatti@redhat.com> From: Eduardo Habkost <ehabkost@redhat.com> No behavior change: just code movement. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> --- target-i386/kvm.c | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 18782e4..695deb9 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -123,6 +123,28 @@ static int get_para_features(KVMState *s) } +/* Returns the value for a specific register on the cpuid entry + */ +static uint32_t cpuid_entry_get_reg(struct kvm_cpuid_entry2 *entry, int reg) +{ + uint32_t ret = 0; + switch (reg) { + case R_EAX: + ret = entry->eax; + break; + case R_EBX: + ret = entry->ebx; + break; + case R_ECX: + ret = entry->ecx; + break; + case R_EDX: + ret = entry->edx; + break; + } + return ret; +} + uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, uint32_t index, int reg) { @@ -142,20 +164,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, cpuid->entries[i].index == index) { struct kvm_cpuid_entry2 *entry = &cpuid->entries[i]; found = true; - switch (reg) { - case R_EAX: - ret = entry->eax; - break; - case R_EBX: - ret = entry->ebx; - break; - case R_ECX: - ret = entry->ecx; - break; - case R_EDX: - ret = entry->edx; - break; - } + ret = cpuid_entry_get_reg(entry, reg); } } -- 1.7.6.4
WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com> To: Anthony Liguori <aliguori@us.ibm.com> Cc: Marcelo Tosatti <mtosatti@redhat.com>, qemu-devel@nongnu.org, kvm@vger.kernel.org, Eduardo Habkost <ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 04/28] i386: kvm: extract register switch to cpuid_entry_get_reg() function Date: Wed, 31 Oct 2012 07:39:42 -0200 [thread overview] Message-ID: <829ae2f9fa37bf026de556f50d58ef14a7dab9b3.1351676405.git.mtosatti@redhat.com> (raw) In-Reply-To: <cover.1351676405.git.mtosatti@redhat.com> From: Eduardo Habkost <ehabkost@redhat.com> No behavior change: just code movement. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> --- target-i386/kvm.c | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 18782e4..695deb9 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -123,6 +123,28 @@ static int get_para_features(KVMState *s) } +/* Returns the value for a specific register on the cpuid entry + */ +static uint32_t cpuid_entry_get_reg(struct kvm_cpuid_entry2 *entry, int reg) +{ + uint32_t ret = 0; + switch (reg) { + case R_EAX: + ret = entry->eax; + break; + case R_EBX: + ret = entry->ebx; + break; + case R_ECX: + ret = entry->ecx; + break; + case R_EDX: + ret = entry->edx; + break; + } + return ret; +} + uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, uint32_t index, int reg) { @@ -142,20 +164,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, cpuid->entries[i].index == index) { struct kvm_cpuid_entry2 *entry = &cpuid->entries[i]; found = true; - switch (reg) { - case R_EAX: - ret = entry->eax; - break; - case R_EBX: - ret = entry->ebx; - break; - case R_ECX: - ret = entry->ecx; - break; - case R_EDX: - ret = entry->edx; - break; - } + ret = cpuid_entry_get_reg(entry, reg); } } -- 1.7.6.4
next prev parent reply other threads:[~2012-10-31 9:40 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-31 9:39 [PATCH 00/28] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 01/28] i386: kvm: kvm_arch_get_supported_cpuid: move R_EDX hack outside of for loop Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 02/28] i386: kvm: kvm_arch_get_supported_cpuid: clean up has_kvm_features check Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 03/28] i386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` Marcelo Tosatti [this message] 2012-10-31 9:39 ` [Qemu-devel] [PATCH 04/28] i386: kvm: extract register switch to cpuid_entry_get_reg() function Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 05/28] i386: kvm: extract CPUID entry lookup to cpuid_find_entry() function Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 06/28] i386: kvm: extract try_get_cpuid() loop to get_supported_cpuid() function Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 07/28] i386: kvm: kvm_arch_get_supported_cpuid: replace if+switch with single 'if' Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 08/28] i386: kvm: set CPUID_EXT_HYPERVISOR on kvm_arch_get_supported_cpuid() Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 09/28] i386: kvm: set CPUID_EXT_TSC_DEADLINE_TIMER " Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 10/28] i386: kvm: x2apic is not supported without in-kernel irqchip Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 11/28] i386: kvm: mask cpuid_kvm_features earlier Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 12/28] i386: kvm: mask cpuid_ext4_features bits earlier Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 13/28] i386: kvm: filter CPUID feature words earlier, on cpu.c Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 14/28] i386: kvm: reformat filter_features_for_kvm() code Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 15/28] i386: kvm: filter CPUID leaf 7 based on GET_SUPPORTED_CPUID, too Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 16/28] i386: cpu: add missing CPUID[EAX=7,ECX=0] flag names Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] [PATCH 16/28] i386: cpu: add missing CPUID[EAX=7, ECX=0] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 17/28] target-i386: Add missing kvm cpuid feature name Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 18/28] cirrus_vga: allow configurable vram size Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 19/28] Use machine options to emulate -no-kvm-irqchip Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 20/28] Issue warning when deprecated -no-kvm-pit is used Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:39 ` [PATCH 21/28] Use global properties to emulate -no-kvm-pit-reinjection Marcelo Tosatti 2012-10-31 9:39 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 22/28] Issue warning when deprecated drive parameter boot=on|off is used Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 23/28] Issue warning when deprecated -tdf option " Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 24/28] Emulate qemu-kvms -no-kvm option Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 25/28] target-i386: make cpu_x86_fill_host() void Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 26/28] target-i386: cpu: make -cpu host/check/enforce code KVM-specific Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-10-31 9:40 ` [PATCH 27/28] target-i386: kvm_cpu_fill_host: use GET_SUPPORTED_CPUID Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-11-02 15:34 ` Andreas Färber 2012-11-02 15:52 ` Andreas Färber 2012-11-02 16:05 ` Eduardo Habkost 2012-11-02 16:05 ` [Qemu-devel] " Eduardo Habkost 2012-11-02 16:25 ` [PATCH] target-i386: cpu: fix --disable-kvm compilation Eduardo Habkost 2012-11-02 16:25 ` [Qemu-devel] " Eduardo Habkost 2012-11-02 16:54 ` Andreas Färber 2012-11-02 16:54 ` [Qemu-devel] " Andreas Färber 2012-10-31 9:40 ` [PATCH 28/28] update-linux-headers.sh: Handle new kernel uapi/ directories Marcelo Tosatti 2012-10-31 9:40 ` [Qemu-devel] " Marcelo Tosatti 2012-11-01 19:32 ` [PATCH 00/28] [PULL] qemu-kvm.git uq/master queue Anthony Liguori 2012-11-01 19:32 ` [Qemu-devel] " Anthony Liguori
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=829ae2f9fa37bf026de556f50d58ef14a7dab9b3.1351676405.git.mtosatti@redhat.com \ --to=mtosatti@redhat.com \ --cc=aliguori@us.ibm.com \ --cc=ehabkost@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.