From nobody Tue Oct 28 02:06:21 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 1516204938256605.5781003252519; Wed, 17 Jan 2018 08:02:18 -0800 (PST) Received: from localhost ([::1]:44294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebqA8-0001Ow-Cr for importer@patchew.org; Wed, 17 Jan 2018 11:02:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebpuo-0005hD-7Y for qemu-devel@nongnu.org; Wed, 17 Jan 2018 10:46:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebpuk-0000TF-6w for qemu-devel@nongnu.org; Wed, 17 Jan 2018 10:46:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebpuj-0000Sj-Ub for qemu-devel@nongnu.org; Wed, 17 Jan 2018 10:46:10 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 085CF7F7B9; Wed, 17 Jan 2018 15:46:04 +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 4EF374AB; Wed, 17 Jan 2018 15:45:55 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 17 Jan 2018 16:43:32 +0100 Message-Id: <1516203816-19374-21-git-send-email-imammedo@redhat.com> In-Reply-To: <1516203816-19374-1-git-send-email-imammedo@redhat.com> References: <1516203816-19374-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 17 Jan 2018 15:46:09 +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] [PATCH 20/24] machine: drop MachineState::cpu_model 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: Marcel Apfelbaum , Paolo Bonzini , Laurent Vivier , Eduardo Habkost 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" The last user of it was machine type 'none', which used field to create CPU id user requested it on CLI with -cpu option. We could compare pointers of MachineState::cpu_type and MachineClass::default_cpu_type to check for the same condition, and drop cpu_model concept completly from machine/boards code So that no one would try to reuse obsolete field and only place to deal with cpu model would be vl.c and foo_cpu_class_by_name() callbacks. Signed-off-by: Igor Mammedov --- CC: Eduardo Habkost CC: Marcel Apfelbaum CC: Paolo Bonzini --- include/hw/boards.h | 1 - hw/core/null-machine.c | 10 +++++++--- vl.c | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 156b16f..decd0ec 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -246,7 +246,6 @@ struct MachineState { char *kernel_filename; char *kernel_cmdline; char *initrd_filename; - const char *cpu_model; const char *cpu_type; AccelState *accelerator; CPUArchIdList *possible_cpus; diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c index 864832d..c2e466c 100644 --- a/hw/core/null-machine.c +++ b/hw/core/null-machine.c @@ -23,10 +23,13 @@ static void machine_none_init(MachineState *mch) { CPUState *cpu =3D NULL; + MachineClass *mc =3D MACHINE_GET_CLASS(mch); =20 - /* Initialize CPU (if a model has been specified) */ - if (mch->cpu_model) { - cpu =3D cpu_init(mch->cpu_model); + /* 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); if (!cpu) { error_report("Unable to initialize CPU"); exit(1); @@ -54,6 +57,7 @@ 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; + mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; } =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