From patchwork Wed Jun 1 16:37:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 628773 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 3rKbtG2YLFz9t83 for ; Thu, 2 Jun 2016 02:49:26 +1000 (AEST) Received: from localhost ([::1]:43159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b89Ke-0006GH-7r for incoming@patchwork.ozlabs.org; Wed, 01 Jun 2016 12:49:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b899V-0005RW-O2 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b899U-0007ud-N2 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:37:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b899I-0007rU-8o; Wed, 01 Jun 2016 12:37:40 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB1578DFF1; Wed, 1 Jun 2016 16:37:39 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u51GbXqe025067; Wed, 1 Jun 2016 12:37:38 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 18:37:24 +0200 Message-Id: <1464799050-11002-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1464799050-11002-1-git-send-email-imammedo@redhat.com> References: <1464799050-11002-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 01 Jun 2016 16:37:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 2/8] target-i386: cpu: move xcc->kvm_required check to reaize time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mark.cave-ayland@ilande.co.uk, blauwirbel@gmail.com, qemu-arm@nongnu.org, pbonzini@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" it will allow to drop custom cpu_x86_init() and use cpu_generic_init() instead reducing cpu_x86_create() to a simple 3-liner. Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 6159a7f..c31afc7 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2200,7 +2200,6 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp) X86CPU *cpu_x86_create(const char *cpu_model, Error **errp) { X86CPU *cpu = NULL; - X86CPUClass *xcc; ObjectClass *oc; gchar **model_pieces; char *name, *features; @@ -2219,12 +2218,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, Error **errp) error_setg(&error, "Unable to find CPU definition: %s", name); goto out; } - xcc = X86_CPU_CLASS(oc); - - if (xcc->kvm_required && !kvm_enabled()) { - error_setg(&error, "CPU model '%s' requires KVM", name); - goto out; - } cpu = X86_CPU(object_new(object_class_get_name(oc))); @@ -2901,6 +2894,13 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) static bool ht_warned; FeatureWord w; + if (xcc->kvm_required && !kvm_enabled()) { + char *name = g_strdup(object_get_typename(OBJECT(dev))); + *strstr(name, X86_CPU_TYPE_SUFFIX) = 0; + error_setg(&local_err, "CPU model '%s' requires KVM", name); + goto out; + } + if (cpu->apic_id < 0) { error_setg(errp, "apic-id property was not initialized properly"); return;