From patchwork Mon Dec 16 02:30:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 301434 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 71FB62C0085 for ; Mon, 16 Dec 2013 13:31:37 +1100 (EST) Received: from localhost ([::1]:53332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsNy2-0002p4-I4 for incoming@patchwork.ozlabs.org; Sun, 15 Dec 2013 21:31:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsNxb-0002bi-LX for qemu-devel@nongnu.org; Sun, 15 Dec 2013 21:31:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsNxV-0007Nr-Na for qemu-devel@nongnu.org; Sun, 15 Dec 2013 21:31:07 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:41553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsNxV-0007Nl-IA for qemu-devel@nongnu.org; Sun, 15 Dec 2013 21:31:01 -0500 Received: by mail-pb0-f42.google.com with SMTP id uo5so4901744pbc.1 for ; Sun, 15 Dec 2013 18:31:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=X0HxHmJ+FF2+sHWnRWjkEX33eDbnFb12bakkkvtuns8=; b=AH5JLYmGNhJM5mDcqUqSdn6otszv75JKIlYrPsMQP88dyZVj1439DeJWbnD7mIqT4n SdFeoHZd7uN0q7urq5g9ECylGlPeRTjWmFQ568tKFhKB1hEAuoevkfbv767ji2CcmJdJ 3PwjqLV+FDVf8mCcWixCBPSvJG45AZqdOOXqXWl99k0VJerKGLmWfpGx6WEew/4jrlzt dP4r0RVgsgk519WB4cFL6jy7ucDuQBwS2bD2HBUCMiWB2uZGT+ZCxXT1ilqj2rU7hUVt YRl2nF3nlIQMtjZ6JXqmhcCATASQm/dnw11niN/XOUprTsB4VC5EAQl+SYSb9L/chvPu HTqw== X-Gm-Message-State: ALoCoQnhFnlv/x7nKUju5UKapOJjQgRaGDRHvcoB8J/rtMHrrkoVxkCDrtwqq1EJ9x8WdfxkQt6n X-Received: by 10.66.189.229 with SMTP id gl5mr17421108pac.47.1387161060727; Sun, 15 Dec 2013 18:31:00 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id nw11sm30596314pab.13.2013.12.15.18.30.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 15 Dec 2013 18:30:59 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Sun, 15 Dec 2013 18:30:28 -0800 Message-Id: <8c671e500390c8be0cc363e887e32867d1d1b0d2.1387160489.git.peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.160.42 Cc: peter.crosthwaite@xilinx.com, antonynpavlov@gmail.com, afaerber@suse.de, mark.langsdorf@calxeda.com, mst@redhat.com Subject: [Qemu-devel] [PATCH target-arm v5 04/10] arm/highbank: Use object_new() rather than cpu_arm_init() 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 To allow the machine model to set device properties before CPU realization. Signed-off-by: Peter Crosthwaite Reviewed-by: Peter Maydell --- changed since v1: use error_report rather than fprintf(stderr hw/arm/highbank.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index fe98ef1..1d19d8f 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -26,6 +26,7 @@ #include "hw/boards.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" +#include "qemu/error-report.h" #define SMP_BOOT_ADDR 0x100 #define SMP_BOOT_REG 0x40 @@ -229,10 +230,15 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine) } for (n = 0; n < smp_cpus; n++) { + ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); ARMCPU *cpu; - cpu = cpu_arm_init(cpu_model); - if (cpu == NULL) { - fprintf(stderr, "Unable to find CPU definition\n"); + Error *err = NULL; + + cpu = ARM_CPU(object_new(object_class_get_name(oc))); + + object_property_set_bool(OBJECT(cpu), true, "realized", &err); + if (err) { + error_report("%s", error_get_pretty(err)); exit(1); }