From nobody Mon Feb 9 11:51:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486997198773245.01299043258382; Mon, 13 Feb 2017 06:46:38 -0800 (PST) Received: from localhost ([::1]:57325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdHtf-0007Qk-ON for importer@patchew.org; Mon, 13 Feb 2017 09:46:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdHcM-0008KA-Mf for qemu-devel@nongnu.org; Mon, 13 Feb 2017 09:28:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdHcL-0005K4-4D for qemu-devel@nongnu.org; Mon, 13 Feb 2017 09:28:38 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:48495) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdHcG-0005C4-Oe; Mon, 13 Feb 2017 09:28:32 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1cdHc6-00015A-Do; Mon, 13 Feb 2017 14:28:22 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 13 Feb 2017 14:28:19 +0000 Message-Id: <1486996099-15820-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486996099-15820-1-git-send-email-peter.maydell@linaro.org> References: <1486996099-15820-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 4/4] hw/arm/virt: Use new cpu_generic_new() 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: Eduardo Habkost , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new cpu_generic_new() rather than calling parse_features by hand. Signed-off-by: Peter Maydell --- hw/arm/virt.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f3440f2..bcb9a6d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -172,7 +172,6 @@ static const char *valid_cpus[] =3D { static bool cpuname_valid(const char *cpu) { int i; - for (i =3D 0; i < ARRAY_SIZE(valid_cpus); i++) { if (strcmp(cpu, valid_cpus[i]) =3D=3D 0) { return true; @@ -1206,10 +1205,6 @@ static void machvirt_init(MachineState *machine) MemoryRegion *ram =3D g_new(MemoryRegion, 1); const char *cpu_model =3D machine->cpu_model; char **cpustr; - ObjectClass *oc; - const char *typename; - CPUClass *cc; - Error *err =3D NULL; bool firmware_loaded =3D bios_name || drive_get(IF_PFLASH, 0, 0); uint8_t clustersz; =20 @@ -1240,6 +1235,7 @@ static void machvirt_init(MachineState *machine) error_report("mach-virt: CPU %s not supported", cpustr[0]); exit(1); } + g_strfreev(cpustr); =20 /* If we have an EL3 boot ROM then the assumption is that it will * implement PSCI itself, so disable QEMU's internal implementation @@ -1309,24 +1305,8 @@ static void machvirt_init(MachineState *machine) =20 create_fdt(vms); =20 - oc =3D cpu_class_by_name(TYPE_ARM_CPU, cpustr[0]); - if (!oc) { - error_report("Unable to find CPU definition"); - exit(1); - } - typename =3D object_class_get_name(oc); - - /* convert -smp CPU options specified by the user into global props */ - cc =3D CPU_CLASS(oc); - cc->parse_features(typename, cpustr[1], &err); - g_strfreev(cpustr); - if (err) { - error_report_err(err); - exit(1); - } - for (n =3D 0; n < smp_cpus; n++) { - Object *cpuobj =3D object_new(typename); + Object *cpuobj =3D OBJECT(cpu_generic_new(TYPE_ARM_CPU, cpu_model)= ); if (!vmc->disallow_affinity_adjustment) { /* Adjust MPIDR like 64-bit KVM hosts, which incorporate the * GIC's target-list limitations. 32-bit KVM hosts currently --=20 2.7.4