From nobody Mon Oct 27 18:31:40 2025 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.zohomail.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 1516297072168864.7508276171804; Thu, 18 Jan 2018 09:37:52 -0800 (PST) Received: from localhost ([::1]:43773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecE8N-0005en-Bl for importer@patchew.org; Thu, 18 Jan 2018 12:37:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecE6U-0004NJ-Qe for qemu-devel@nongnu.org; Thu, 18 Jan 2018 12:35:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecE6T-0007vX-Rv for qemu-devel@nongnu.org; Thu, 18 Jan 2018 12:35:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ecE6R-0007sz-Fw; Thu, 18 Jan 2018 12:35:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9424B83F44; Thu, 18 Jan 2018 17:35:50 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3942414C; Thu, 18 Jan 2018 17:35:47 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 18:33:59 +0100 Message-Id: <1516296842-136976-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1516296842-136976-1-git-send-email-imammedo@redhat.com> References: <1516296842-136976-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 18 Jan 2018 17:35:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC v2 2/5] machine: prepare machine 'none' to gradually switch to cpu_create() API 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 , Eduardo Habkost , Laurent Vivier , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.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" temporarily add #ifdef CPU_RESOLVING_TYPE in null-machine.c, so that each target could gradually switch to cpu_create() and not converted yet could continue to use cpu_init(). Once all targets are converted temporary ifdefs, MachineState::cpu_model and cpu_init() API will be removed Signed-off-by: Igor Mammedov --- hw/core/null-machine.c | 13 ++++++++++++- vl.c | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c index 864832d..3cc6a49 100644 --- a/hw/core/null-machine.c +++ b/hw/core/null-machine.c @@ -23,10 +23,18 @@ static void machine_none_init(MachineState *mch) { CPUState *cpu =3D NULL; +#ifdef CPU_RESOLVING_TYPE + MachineClass *mc =3D MACHINE_GET_CLASS(mch); =20 - /* Initialize CPU (if a model has been specified) */ + /* Initialize CPU if cpu_type pointer is user provided + * (i.e. !=3D to pointer tot static default cpu type string) + */ + if (mch->cpu_type !=3D mc->default_cpu_type) { + cpu =3D cpu_create(mch->cpu_type); +#else if (mch->cpu_model) { cpu =3D cpu_init(mch->cpu_model); +#endif if (!cpu) { error_report("Unable to initialize CPU"); exit(1); @@ -54,6 +62,9 @@ static void machine_none_machine_init(MachineClass *mc) mc->init =3D machine_none_init; mc->max_cpus =3D 1; mc->default_ram_size =3D 0; +#ifdef CPU_RESOLVING_TYPE + mc->default_cpu_type =3D CPU_RESOLVING_TYPE; +#endif } =20 DEFINE_MACHINE("none", machine_none_machine_init) diff --git a/vl.c b/vl.c index 2586f25..8aa0131 100644 --- a/vl.c +++ b/vl.c @@ -4609,7 +4609,6 @@ int main(int argc, char **argv, char **envp) current_machine->maxram_size =3D maxram_size; current_machine->ram_slots =3D ram_slots; current_machine->boot_order =3D boot_order; - current_machine->cpu_model =3D cpu_model; =20 parse_numa_opts(current_machine); =20 @@ -4619,6 +4618,13 @@ int main(int argc, char **argv, char **envp) if (cpu_model) { current_machine->cpu_type =3D cpu_parse_cpu_model(machine_class->default_cpu_type, cpu_m= odel); + + /* machine 'none' depends on default cpu type pointer not being + * equal to resolved type name pointer to fugure out if type w= as + * user provided, make sure that if it becomes not true in fut= ure + * it won't beark silently */ + g_assert( + current_machine->cpu_type !=3D machine_class->default_cpu_= type); } } =20 --=20 2.7.4