From patchwork Tue Jun 1 12:33:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 103526 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o51CXrag008520 for ; Tue, 1 Jun 2010 12:33:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756255Ab0FAMdu (ORCPT ); Tue, 1 Jun 2010 08:33:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1665 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752791Ab0FAMdt (ORCPT ); Tue, 1 Jun 2010 08:33:49 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o51CXn7m021858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Jun 2010 08:33:49 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o51CXmM4031012 for ; Tue, 1 Jun 2010 08:33:49 -0400 Received: from file.tlv.redhat.com (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 1AA42250ADB; Tue, 1 Jun 2010 15:33:48 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti , Glauber Costa Cc: kvm@vger.kernel.org Subject: [PATCH 4/5] Use skeleton of upstream's kvm_arch_init_vcpu() Date: Tue, 1 Jun 2010 15:33:46 +0300 Message-Id: <1275395627-2321-5-git-send-email-avi@redhat.com> In-Reply-To: <1275395627-2321-1-git-send-email-avi@redhat.com> References: <1275395627-2321-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 01 Jun 2010 12:33:53 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index f5c76bc..853d50e 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -1129,7 +1129,7 @@ static void kvm_trim_features(uint32_t *features, uint32_t supported) } } -int kvm_arch_init_vcpu(CPUState *env) +static int _kvm_arch_init_vcpu(CPUState *env) { struct kvm_cpuid_entry2 cpuid_ent[100]; #ifdef KVM_CPUID_SIGNATURE diff --git a/target-i386/kvm.c b/target-i386/kvm.c index ac9e17b..8db6d54 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -163,10 +163,13 @@ static int get_para_features(CPUState *env) } #endif -#ifdef KVM_UPSTREAM +static int _kvm_arch_init_vcpu(CPUState *env); int kvm_arch_init_vcpu(CPUState *env) { + int r; +#ifdef KVM_UPSTREAM + struct { struct kvm_cpuid2 cpuid; struct kvm_cpuid_entry2 entries[100]; @@ -178,6 +181,15 @@ int kvm_arch_init_vcpu(CPUState *env) uint32_t signature[3]; #endif +#endif + + r = _kvm_arch_init_vcpu(env); + if (r < 0) { + return r; + } + +#ifdef KVM_UPSTREAM + env->mp_state = KVM_MP_STATE_RUNNABLE; env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, R_EDX); @@ -273,9 +285,10 @@ int kvm_arch_init_vcpu(CPUState *env) cpuid_data.cpuid.nent = cpuid_i; return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data); +#endif + return 0; } -#endif void kvm_arch_reset_vcpu(CPUState *env) { env->exception_injected = -1;