From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Igor Mammedov" <imammedo@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Andreas Färber" <afaerber@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 5/5] target-i386: Use X86CPU on cpu_x86_cpuid()
Date: Fri, 24 Apr 2015 15:30:09 -0300 [thread overview]
Message-ID: <1429900209-31811-6-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1429900209-31811-1-git-send-email-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target-i386/cpu.c | 4 ++--
target-i386/cpu.h | 2 +-
target-i386/kvm.c | 20 ++++++++++----------
target-i386/misc_helper.c | 3 ++-
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3305e09..cee7054 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2233,11 +2233,11 @@ void x86_cpudef_setup(void)
}
}
-void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
+void cpu_x86_cpuid(X86CPU *cpu, uint32_t index, uint32_t count,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx)
{
- X86CPU *cpu = x86_env_get_cpu(env);
+ CPUX86State *env = &cpu->env;
CPUState *cs = CPU(cpu);
/* test if maximum index reached */
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3c2055f..19c71ac 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1093,7 +1093,7 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo,
void *puc);
/* cpuid.c */
-void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
+void cpu_x86_cpuid(X86CPU *cpu, uint32_t index, uint32_t count,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx);
void cpu_clear_apic_feature(CPUX86State *env);
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 50b2978..a4cb7e3 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -553,7 +553,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
has_msr_kvm_steal_time = c->eax & (1 << KVM_FEATURE_STEAL_TIME);
}
- cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
+ cpu_x86_cpuid(cpu, 0, 0, &limit, &unused, &unused, &unused);
for (i = 0; i <= limit; i++) {
if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -570,7 +570,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
c->function = i;
c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC |
KVM_CPUID_FLAG_STATE_READ_NEXT;
- cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
times = c->eax & 0xff;
for (j = 1; j < times; ++j) {
@@ -582,7 +582,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
c = &cpuid_data.entries[cpuid_i++];
c->function = i;
c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC;
- cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
}
break;
}
@@ -596,7 +596,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
c->function = i;
c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
c->index = j;
- cpu_x86_cpuid(env, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);
if (i == 4 && c->eax == 0) {
break;
@@ -618,7 +618,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
default:
c->function = i;
c->flags = 0;
- cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
break;
}
}
@@ -626,7 +626,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
if (limit >= 0x0a) {
uint32_t ver;
- cpu_x86_cpuid(env, 0x0a, 0, &ver, &unused, &unused, &unused);
+ cpu_x86_cpuid(cpu, 0x0a, 0, &ver, &unused, &unused, &unused);
if ((ver & 0xff) > 0) {
has_msr_architectural_pmu = true;
num_architectural_pmu_counters = (ver & 0xff00) >> 8;
@@ -641,7 +641,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
}
}
- cpu_x86_cpuid(env, 0x80000000, 0, &limit, &unused, &unused, &unused);
+ cpu_x86_cpuid(cpu, 0x80000000, 0, &limit, &unused, &unused, &unused);
for (i = 0x80000000; i <= limit; i++) {
if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -652,12 +652,12 @@ int kvm_arch_init_vcpu(CPUState *cs)
c->function = i;
c->flags = 0;
- cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
}
/* Call Centaur's CPUID instructions they are supported. */
if (env->cpuid_xlevel2 > 0) {
- cpu_x86_cpuid(env, 0xC0000000, 0, &limit, &unused, &unused, &unused);
+ cpu_x86_cpuid(cpu, 0xC0000000, 0, &limit, &unused, &unused, &unused);
for (i = 0xC0000000; i <= limit; i++) {
if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -668,7 +668,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
c->function = i;
c->flags = 0;
- cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+ cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
}
}
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
index 4aaf1e4..0f96c38 100644
--- a/target-i386/misc_helper.c
+++ b/target-i386/misc_helper.c
@@ -77,7 +77,8 @@ void helper_cpuid(CPUX86State *env)
cpu_svm_check_intercept_param(env, SVM_EXIT_CPUID, 0);
- cpu_x86_cpuid(env, (uint32_t)env->regs[R_EAX], (uint32_t)env->regs[R_ECX],
+ cpu_x86_cpuid(x86_env_get_cpu(env),
+ (uint32_t)env->regs[R_EAX], (uint32_t)env->regs[R_ECX],
&eax, &ebx, &ecx, &edx);
env->regs[R_EAX] = eax;
env->regs[R_EBX] = ebx;
--
2.1.0
prev parent reply other threads:[~2015-04-24 18:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 18:30 [Qemu-devel] [PATCH 0/5] target-i386: Some CPUX86State -> X86CPU conversions Eduardo Habkost
2015-04-24 18:30 ` [Qemu-devel] [PATCH 1/5] target-i386: Use X86CPU on cpu_x86_support_mca_broadcast() Eduardo Habkost
2015-04-24 18:30 ` [Qemu-devel] [PATCH 2/5] target-i386: Use X86CPU on cpu_x86_version() Eduardo Habkost
2015-04-24 18:30 ` [Qemu-devel] [PATCH 3/5] target-i386: Use X86CPU on cpu_get_pic_interrupt() Eduardo Habkost
2015-04-24 18:30 ` [Qemu-devel] [PATCH 4/5] target-i386: Use X86CPU on cpu_report_tpr_access() Eduardo Habkost
2015-04-24 18:30 ` Eduardo Habkost [this message]
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=1429900209-31811-6-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).