From patchwork Fri Feb 7 13:04:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11370419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 774CE139A for ; Fri, 7 Feb 2020 13:08:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DB9820720 for ; Fri, 7 Feb 2020 13:08:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HWIitmta" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DB9820720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03Mr-0003Lk-Eu for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Feb 2020 08:08:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54011) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03KN-0007wl-Vg for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:05:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j03KM-0007mV-P9 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:05:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20111 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j03KM-0007mD-M0 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:05:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581080746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DeJwD+5oSTfpziNL0l7YGkVnz0HH2iOXbi7RNEBKA7w=; b=HWIitmta7HDvdljnMOI+o4mgoXZlJYoQHzwooZx8LiJzv6hb31cqxASPb+idvLzOyWH3C9 Dz2lh/+5sILP3vXLmrQ0islSbEkce7m0yghI8NdHrMNwUXer0a2GKhqlEP0xcJvjeX+Jj8 8HajlMR5j5lK5R819iCi7x8klSJpCyw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-63-TKZ-oKQdOwyzArmBnSghTQ-1; Fri, 07 Feb 2020 08:05:42 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16107104FC00; Fri, 7 Feb 2020 13:05:38 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-120.brq.redhat.com [10.40.204.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 777A35C883; Fri, 7 Feb 2020 13:05:23 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 1/3] hw: Do not initialize MachineClass::is_default to 0 Date: Fri, 7 Feb 2020 14:04:51 +0100 Message-Id: <20200207130453.16666-2-philmd@redhat.com> In-Reply-To: <20200207130453.16666-1-philmd@redhat.com> References: <20200207130453.16666-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: TKZ-oKQdOwyzArmBnSghTQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Wulff , Sagar Karandikar , David Hildenbrand , Anthony Green , Mark Cave-Ayland , Alistair Francis , "Edgar E. Iglesias" , Guan Xuetao , Marek Vasut , Jia Liu , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Magnus Damm , Halil Pasic , Christian Borntraeger , Palmer Dabbelt , Aleksandar Rikalo , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Eduardo Habkost , Richard Henderson , qemu-s390x@nongnu.org, Stafford Horne , David Gibson , qemu-riscv@nongnu.org, Thomas Huth , Bastian Koppelmann , Cornelia Huck , Laurent Vivier , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The MachineClass is already zeroed on creation. Note: The code setting is_default=0 in hw/i386/pc_piix.c is different (related to compat options). When adding a new versioned machine, we want it to be the new default, so we have to mark the previous one as not default. Signed-off-by: Philippe Mathieu-Daudé --- v3: new patch --- hw/lm32/lm32_boards.c | 1 - hw/lm32/milkymist.c | 1 - hw/m68k/q800.c | 1 - hw/microblaze/petalogix_ml605_mmu.c | 1 - hw/tricore/tricore_testboard.c | 1 - 5 files changed, 5 deletions(-) diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index d1894adab8..156b050abc 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -302,7 +302,6 @@ static void lm32_uclinux_class_init(ObjectClass *oc, void *data) mc->desc = "lm32 platform for uClinux and u-boot by Theobroma Systems"; mc->init = lm32_uclinux_init; - mc->is_default = 0; mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full"); } diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 6d46134232..9fa5fd7050 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -214,7 +214,6 @@ static void milkymist_machine_init(MachineClass *mc) { mc->desc = "Milkymist One"; mc->init = milkymist_init; - mc->is_default = 0; mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full"); } diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 1e32363688..788b5d663f 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -441,7 +441,6 @@ static void q800_machine_class_init(ObjectClass *oc, void *data) mc->init = q800_init; mc->default_cpu_type = M68K_CPU_TYPE_NAME("m68040"); mc->max_cpus = 1; - mc->is_default = 0; mc->block_default_type = IF_SCSI; } diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index 09486bc8bf..0a2640c40b 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -216,7 +216,6 @@ static void petalogix_ml605_machine_init(MachineClass *mc) { mc->desc = "PetaLogix linux refdesign for xilinx ml605 little endian"; mc->init = petalogix_ml605_init; - mc->is_default = 0; } DEFINE_MACHINE("petalogix-ml605", petalogix_ml605_machine_init) diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 20c9ccb3ce..8ec2b5bddd 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -105,7 +105,6 @@ static void ttb_machine_init(MachineClass *mc) { mc->desc = "a minimal TriCore board"; mc->init = tricoreboard_init; - mc->is_default = 0; mc->default_cpu_type = TRICORE_CPU_TYPE_NAME("tc1796"); } From patchwork Fri Feb 7 13:04:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11370423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CA03139A for ; Fri, 7 Feb 2020 13:08:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23FF920720 for ; Fri, 7 Feb 2020 13:08:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QkL0l0Zf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23FF920720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03NL-0004JO-Av for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Feb 2020 08:08:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03KY-0008G5-Tp for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:06:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j03KW-0007qr-OU for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:05:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49648 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j03KW-0007qY-I9 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:05:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581080756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N8Xoh5s8LJEjO3LCsLIAY/YyM+Zf8x3iKkAuoUtGlSY=; b=QkL0l0Zf3ocS5wtYIT1KbloisX3Rpw6kOu7/I6MlQ3G7lhhtK981YVakrzPGnEfPBS1o/B qwWEw9KVi0nkRK0nq35DEB8Zqlz+y20SVsmrzt8ilpMHg//SgdQZZcMe0BagwkK0/1d9Rj VcdgpfIJ8AQj2HZPznuU4c7kTMp88to= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-74WzZh0oOj2wj27KxUA4OA-1; Fri, 07 Feb 2020 08:05:54 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED1111081FB5; Fri, 7 Feb 2020 13:05:49 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-120.brq.redhat.com [10.40.204.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0BC75C6DC; Fri, 7 Feb 2020 13:05:38 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 2/3] hw: Make MachineClass::is_default a boolean type Date: Fri, 7 Feb 2020 14:04:52 +0100 Message-Id: <20200207130453.16666-3-philmd@redhat.com> In-Reply-To: <20200207130453.16666-1-philmd@redhat.com> References: <20200207130453.16666-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 74WzZh0oOj2wj27KxUA4OA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Wulff , Sagar Karandikar , David Hildenbrand , Anthony Green , Mark Cave-Ayland , Alistair Francis , "Edgar E. Iglesias" , Guan Xuetao , Marek Vasut , Jia Liu , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Magnus Damm , Halil Pasic , Christian Borntraeger , Palmer Dabbelt , Aleksandar Rikalo , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Eduardo Habkost , Richard Henderson , qemu-s390x@nongnu.org, Stafford Horne , David Gibson , qemu-riscv@nongnu.org, Thomas Huth , Bastian Koppelmann , Cornelia Huck , Laurent Vivier , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" There's no good reason for it to be type int, change it to bool. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin --- v3: new patch --- include/hw/boards.h | 2 +- hw/alpha/dp264.c | 2 +- hw/cris/axis_dev88.c | 2 +- hw/hppa/machine.c | 2 +- hw/i386/pc_piix.c | 10 +++++----- hw/lm32/lm32_boards.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/moxie/moxiesim.c | 2 +- hw/nios2/10m50_devboard.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/spapr.c | 2 +- hw/riscv/spike.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/sh4/shix.c | 2 +- hw/sparc/sun4m.c | 2 +- hw/sparc64/niagara.c | 2 +- hw/sparc64/sun4u.c | 4 ++-- hw/unicore32/puv3.c | 2 +- 21 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index fb1b43d5b9..30498cb367 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -200,7 +200,7 @@ struct MachineClass { no_sdcard:1, pci_allow_0_address:1, legacy_fw_cfg_order:1; - int is_default; + bool is_default; const char *default_machine_opts; const char *default_boot_order; const char *default_display; diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index a8f9a89cc4..083a198a64 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -181,7 +181,7 @@ static void clipper_machine_init(MachineClass *mc) mc->init = clipper_init; mc->block_default_type = IF_IDE; mc->max_cpus = 4; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67"); } diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index be7760476a..de7b49188b 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -349,7 +349,7 @@ static void axisdev88_machine_init(MachineClass *mc) { mc->desc = "AXIS devboard 88"; mc->init = axisdev88_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = CRIS_CPU_TYPE_NAME("crisv32"); } diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index d8755ec422..83ae87f565 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -295,7 +295,7 @@ static void machine_hppa_machine_init(MachineClass *mc) mc->block_default_type = IF_SCSI; mc->max_cpus = HPPA_MAX_CPUS; mc->default_cpus = 1; - mc->is_default = 1; + mc->is_default = true; mc->default_ram_size = 512 * MiB; mc->default_boot_order = "cd"; } diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index fa12203079..9088db8fb6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -423,7 +423,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_machine_options(m); m->alias = "pc"; - m->is_default = 1; + m->is_default = true; pcmc->default_cpu_version = 1; } @@ -434,7 +434,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m) { pc_i440fx_5_0_machine_options(m); m->alias = NULL; - m->is_default = 0; + m->is_default = false; compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len); } @@ -446,7 +446,7 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m) { pc_i440fx_4_2_machine_options(m); m->alias = NULL; - m->is_default = 0; + m->is_default = false; compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len); compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len); } @@ -459,7 +459,7 @@ static void pc_i440fx_4_0_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_4_1_machine_options(m); m->alias = NULL; - m->is_default = 0; + m->is_default = false; pcmc->default_cpu_version = CPU_VERSION_LEGACY; compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len); compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len); @@ -473,7 +473,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_4_0_machine_options(m); - m->is_default = 0; + m->is_default = false; pcmc->do_not_add_smb_acpi = true; m->smbus_no_migration_support = true; m->alias = NULL; diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index 156b050abc..352f69532e 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -286,7 +286,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *data) mc->desc = "LatticeMico32 EVR32 eval system"; mc->init = lm32_evr_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = LM32_CPU_TYPE_NAME("lm32-full"); } diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index a999c21982..5f8f6e4475 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -352,7 +352,7 @@ static void mcf5208evb_machine_init(MachineClass *mc) { mc->desc = "MCF5208EVB"; mc->init = mcf5208evb_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = M68K_CPU_TYPE_NAME("m5208"); } diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index 849bafc186..0bb6cdea8d 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -132,7 +132,7 @@ static void petalogix_s3adsp1800_machine_init(MachineClass *mc) { mc->desc = "PetaLogix linux refdesign for xilinx Spartan 3ADSP1800"; mc->init = petalogix_s3adsp1800_init; - mc->is_default = 1; + mc->is_default = true; } DEFINE_MACHINE("petalogix-s3adsp1800", petalogix_s3adsp1800_machine_init) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 34b76bb6a1..499eac8d33 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1442,7 +1442,7 @@ static void mips_malta_machine_init(MachineClass *mc) mc->init = mips_malta_init; mc->block_default_type = IF_IDE; mc->max_cpus = 16; - mc->is_default = 1; + mc->is_default = true; #ifdef TARGET_MIPS64 mc->default_cpu_type = MIPS_CPU_TYPE_NAME("20Kc"); #else diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 1d06e39fcb..51a98287b5 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -150,7 +150,7 @@ static void moxiesim_machine_init(MachineClass *mc) { mc->desc = "Moxie simulator platform"; mc->init = moxiesim_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = MOXIE_CPU_TYPE_NAME("MoxieLite"); } diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c index ad8b2fc670..33dc2bf511 100644 --- a/hw/nios2/10m50_devboard.c +++ b/hw/nios2/10m50_devboard.c @@ -120,7 +120,7 @@ static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc) { mc->desc = "Altera 10M50 GHRD Nios II design"; mc->init = nios2_10m50_ghrd_init; - mc->is_default = 1; + mc->is_default = true; } DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init); diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index ad5371250f..d08ce61811 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -176,7 +176,7 @@ static void openrisc_sim_machine_init(MachineClass *mc) mc->desc = "or1k simulation"; mc->init = openrisc_sim_init; mc->max_cpus = 2; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = OPENRISC_CPU_TYPE_NAME("or1200"); } diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 7318d7e9b4..1630663bc2 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -438,7 +438,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_IDE; mc->max_cpus = MAX_CPUS; #ifndef TARGET_PPC64 - mc->is_default = 1; + mc->is_default = true; #endif /* TOFIX "cad" when Mac floppy is implemented */ mc->default_boot_order = "cd"; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c9b2e0a5e0..e3e3208cd8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4493,7 +4493,7 @@ static const TypeInfo spapr_machine_info = { spapr_machine_##suffix##_class_options(mc); \ if (latest) { \ mc->alias = "pseries"; \ - mc->is_default = 1; \ + mc->is_default = true; \ } \ } \ static const TypeInfo spapr_machine_##suffix##_info = { \ diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 8823681783..6f03857660 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -448,7 +448,7 @@ static void spike_machine_init(MachineClass *mc) mc->desc = "RISC-V Spike Board"; mc->init = spike_board_init; mc->max_cpus = 1; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = SPIKE_V1_10_0_CPU; } diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e759eb5f83..c4b291e434 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -631,7 +631,7 @@ bool css_migration_enabled(void) mc->desc = "VirtIO-ccw based S390 machine v" verstr; \ if (latest) { \ mc->alias = "s390-ccw-virtio"; \ - mc->is_default = 1; \ + mc->is_default = true; \ } \ } \ static void ccw_machine_##suffix##_instance_init(Object *obj) \ diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 2fc2915428..68b14ee5e7 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -82,7 +82,7 @@ static void shix_machine_init(MachineClass *mc) { mc->desc = "shix card"; mc->init = shix_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = TYPE_SH7750R_CPU; } diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 25e96db5ca..d6c9772f95 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -1411,7 +1411,7 @@ static void ss5_class_init(ObjectClass *oc, void *data) mc->desc = "Sun4m platform, SPARCstation 5"; mc->init = ss5_init; mc->block_default_type = IF_SCSI; - mc->is_default = 1; + mc->is_default = true; mc->default_boot_order = "c"; mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); mc->default_display = "tcx"; diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index 5eb2d097b9..81a1748fad 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -170,7 +170,7 @@ static void niagara_class_init(ObjectClass *oc, void *data) mc->desc = "Sun4v platform, Niagara"; mc->init = niagara_init; - mc->max_cpus = 1; /* XXX for now */ + mc->max_cpus = true; /* XXX for now */ mc->default_boot_order = "c"; mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1"); } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index b7ac42f7a5..3c2c9d2eb0 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -816,7 +816,7 @@ static void sun4u_class_init(ObjectClass *oc, void *data) mc->init = sun4u_init; mc->block_default_type = IF_IDE; mc->max_cpus = 1; /* XXX for now */ - mc->is_default = 1; + mc->is_default = true; mc->default_boot_order = "c"; mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi"); mc->ignore_boot_device_suffixes = true; @@ -841,7 +841,7 @@ static void sun4v_class_init(ObjectClass *oc, void *data) mc->desc = "Sun4v platform"; mc->init = sun4v_init; mc->block_default_type = IF_IDE; - mc->max_cpus = 1; /* XXX for now */ + mc->max_cpus = true; /* XXX for now */ mc->default_boot_order = "c"; mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1"); mc->default_display = "std"; diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index 7e933de228..7f9c0238fe 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -140,7 +140,7 @@ static void puv3_machine_init(MachineClass *mc) { mc->desc = "PKUnity Version-3 based on UniCore32"; mc->init = puv3_init; - mc->is_default = 1; + mc->is_default = true; mc->default_cpu_type = UNICORE32_CPU_TYPE_NAME("UniCore-II"); } From patchwork Fri Feb 7 13:04:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11370409 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 740F9139A for ; Fri, 7 Feb 2020 13:07:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B7DA20720 for ; Fri, 7 Feb 2020 13:07:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="APWoxhON" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B7DA20720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03Lv-0001ob-Fm for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Feb 2020 08:07:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54195) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j03Kn-0000Ek-8O for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:06:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j03Km-0007yy-7I for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:06:13 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57174 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j03Km-0007yQ-38 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 08:06:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581080771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G95PTwCCtptgBScLxDFzyGKSIIGgkKDhimn6aS+h6BE=; b=APWoxhON+Ldd+AxFkT73/PEufnK/1IzT+CZgD4oE5+euAMIWDIO7AM5BERGixkHFVjKgxM Tw2lhUp7iynRsQu8GXwivxq2KiOzm8tbX+gNdIMaF9DDwwQJSzrb/tVqzm9c05cMH2ARbl S/EU149LzO34DgrOzOb4Jwi/sQWf4FA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-0GYQxoM5N3mjwWsInLhiGg-1; Fri, 07 Feb 2020 08:06:08 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62BF51081FA2; Fri, 7 Feb 2020 13:06:04 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-120.brq.redhat.com [10.40.204.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6938E5C28C; Fri, 7 Feb 2020 13:05:50 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] vl: Abort if multiple machines are registered as default Date: Fri, 7 Feb 2020 14:04:53 +0100 Message-Id: <20200207130453.16666-4-philmd@redhat.com> In-Reply-To: <20200207130453.16666-1-philmd@redhat.com> References: <20200207130453.16666-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 0GYQxoM5N3mjwWsInLhiGg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Wulff , Sagar Karandikar , David Hildenbrand , Anthony Green , Mark Cave-Ayland , Alistair Francis , "Edgar E. Iglesias" , Guan Xuetao , Marek Vasut , Jia Liu , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Magnus Damm , Halil Pasic , Christian Borntraeger , Palmer Dabbelt , Aleksandar Rikalo , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Eduardo Habkost , Richard Henderson , qemu-s390x@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Stafford Horne , David Gibson , qemu-riscv@nongnu.org, Thomas Huth , Bastian Koppelmann , Cornelia Huck , Laurent Vivier , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" It would be confusing to have multiple default machines. Abort if this ever occurs. Signed-off-by: Philippe Mathieu-Daudé --- v2: Use assert() instead of human friendly message (Marc-André) Cc: Marc-André Lureau Cc: Laurent Vivier --- vl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vl.c b/vl.c index 7dcb0879c4..b3e0f7af25 100644 --- a/vl.c +++ b/vl.c @@ -2354,6 +2354,8 @@ static MachineClass *machine_parse(const char *name, GSList *machines) GSList *el; if (is_help_option(name)) { + int default_count = 0; + printf("Supported machines are:\n"); machines = g_slist_sort(machines, machine_class_cmp); for (el = machines; el; el = el->next) { @@ -2364,7 +2366,9 @@ static MachineClass *machine_parse(const char *name, GSList *machines) printf("%-20s %s%s%s\n", mc->name, mc->desc, mc->is_default ? " (default)" : "", mc->deprecation_reason ? " (deprecated)" : ""); + default_count += !!mc->is_default; } + assert(default_count <= 1); exit(0); }