From patchwork Fri Apr 24 18:30:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 464365 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6DD2B14011B for ; Sat, 25 Apr 2015 04:32:37 +1000 (AEST) Received: from localhost ([::1]:45939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YliOx-0005St-4g for incoming@patchwork.ozlabs.org; Fri, 24 Apr 2015 14:32:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YliMw-0001kV-Ts for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:30:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YliMv-0006kQ-Gg for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:30:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YliMv-0006kA-9M for qemu-devel@nongnu.org; Fri, 24 Apr 2015 14:30:29 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id E36FFC79C0; Fri, 24 Apr 2015 18:30:28 +0000 (UTC) Received: from localhost (ovpn-113-180.phx2.redhat.com [10.3.113.180]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3OIURdn013293; Fri, 24 Apr 2015 14:30:28 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 24 Apr 2015 15:30:09 -0300 Message-Id: <1429900209-31811-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1429900209-31811-1-git-send-email-ehabkost@redhat.com> References: <1429900209-31811-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Igor Mammedov , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini Subject: [Qemu-devel] [PATCH 5/5] target-i386: Use X86CPU on cpu_x86_cpuid() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Eduardo Habkost --- 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;