From nobody Fri May 3 04:34:09 2024 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 1507603326410984.3337098871436; Mon, 9 Oct 2017 19:42:06 -0700 (PDT) Received: from localhost ([::1]:60784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kUb-0004Xl-QT for importer@patchew.org; Mon, 09 Oct 2017 22:42:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSo-0003Dn-Gm for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSn-000361-1d for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSm-000349-QE for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:08 -0400 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 C8CFA13AB1; Tue, 10 Oct 2017 02:40:07 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ECEF67CED; Tue, 10 Oct 2017 02:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8CFA13AB1 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:54 -0300 Message-Id: <20171010024001.4526-2-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@redhat.com> MIME-Version: 1.0 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.29]); Tue, 10 Oct 2017 02:40:08 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name() 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: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 and clean every implementation. Suggested-by: Eduardo Habkost Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20170917232842.14544-1-f4bug@amsat.org> Reviewed-by: Igor Mammedov Reviewed-by: Laurent Vivier Reviewed-by: Artyom Tarasenko Signed-off-by: Eduardo Habkost --- qom/cpu.c | 7 ++++++- target/alpha/cpu.c | 6 +----- target/arm/cpu.c | 4 ---- target/cris/cpu.c | 4 ---- target/lm32/cpu.c | 4 ---- target/m68k/cpu.c | 4 ---- target/mips/cpu.c | 4 ---- target/moxie/cpu.c | 8 +------- target/openrisc/cpu.c | 4 ---- target/sh4/cpu.c | 3 --- target/sparc/cpu.c | 4 ---- target/tricore/cpu.c | 4 ---- target/unicore32/cpu.c | 4 ---- target/xtensa/cpu.c | 4 ---- 14 files changed, 8 insertions(+), 56 deletions(-) diff --git a/qom/cpu.c b/qom/cpu.c index 94fa8fe005..54c9452b1c 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -316,7 +316,12 @@ static bool cpu_common_has_work(CPUState *cs) =20 ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) { - CPUClass *cc =3D CPU_CLASS(object_class_by_name(typename)); + CPUClass *cc; + + if (!cpu_model) { + return NULL; + } + cc =3D CPU_CLASS(object_class_by_name(typename)); =20 return cc->class_by_name(cpu_model); } diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index e6c6aabdf0..b8a21f4e01 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -127,14 +127,10 @@ static const AlphaCPUAlias alpha_cpu_aliases[] =3D { =20 static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc =3D NULL; + ObjectClass *oc; char *typename; int i; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - oc =3D object_class_by_name(cpu_model); if (oc !=3D NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) !=3D= NULL && !object_class_is_abstract(oc)) { diff --git a/target/arm/cpu.c b/target/arm/cpu.c index f4f601f079..88578f360e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -939,10 +939,6 @@ static ObjectClass *arm_cpu_class_by_name(const char *= cpu_model) char *typename; char **cpuname; =20 - if (!cpu_model) { - return NULL; - } - cpuname =3D g_strsplit(cpu_model, ",", 1); typename =3D g_strdup_printf(ARM_CPU_TYPE_NAME("%s"), cpuname[0]); oc =3D object_class_by_name(typename); diff --git a/target/cris/cpu.c b/target/cris/cpu.c index ceebfed79b..88d93f2d11 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -69,10 +69,6 @@ static ObjectClass *cris_cpu_class_by_name(const char *c= pu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - #if defined(CONFIG_USER_ONLY) if (strcasecmp(cpu_model, "any") =3D=3D 0) { return object_class_by_name("crisv32-" TYPE_CRIS_CPU); diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index 2b8c36b6d0..bf081f56d2 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -246,10 +246,6 @@ static ObjectClass *lm32_cpu_class_by_name(const char = *cpu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_LM32_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 55bf24bae6..8c70e0805c 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -87,10 +87,6 @@ static ObjectClass *m68k_cpu_class_by_name(const char *c= pu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_M68K_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 1a9a3ed94d..c15b894362 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -166,10 +166,6 @@ static ObjectClass *mips_cpu_class_by_name(const char = *cpu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D mips_cpu_type_name(cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 748d02f29e..30bd44fcad 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -89,13 +89,7 @@ static void moxie_cpu_initfn(Object *obj) =20 static ObjectClass *moxie_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc; - - if (cpu_model =3D=3D NULL) { - return NULL; - } - - oc =3D object_class_by_name(cpu_model); + ObjectClass *oc =3D object_class_by_name(cpu_model); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_MOXIE_CPU) || object_class_is_abstract(oc))) { return NULL; diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index a979f0bf8b..af9cdcc102 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -108,10 +108,6 @@ static ObjectClass *openrisc_cpu_class_by_name(const c= har *cpu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 6ce7cba5a9..252440e019 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -133,9 +133,6 @@ static ObjectClass *superh_cpu_class_by_name(const char= *cpu_model) ObjectClass *oc; GSList *list, *item; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } if (strcasecmp(cpu_model, "any") =3D=3D 0) { return object_class_by_name(TYPE_SH7750R_CPU); } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 0806d699e6..beab90f3e6 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -730,10 +730,6 @@ static ObjectClass *sparc_cpu_class_by_name(const char= *cpu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D sparc_cpu_type_name(cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 5ab5b56454..871eb35453 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -120,10 +120,6 @@ static ObjectClass *tricore_cpu_class_by_name(const ch= ar *cpu_model) ObjectClass *oc; char *typename; =20 - if (!cpu_model) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_TRICORE_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index c9b78ce68e..138acc9dd8 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -44,10 +44,6 @@ static ObjectClass *uc32_cpu_class_by_name(const char *c= pu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 85897df0a8..dcdc765a86 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -83,10 +83,6 @@ static ObjectClass *xtensa_cpu_class_by_name(const char = *cpu_model) ObjectClass *oc; char *typename; =20 - if (cpu_model =3D=3D NULL) { - return NULL; - } - typename =3D g_strdup_printf("%s-" TYPE_XTENSA_CPU, cpu_model); oc =3D object_class_by_name(typename); g_free(typename); --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 1507603480976682.2740492854359; Mon, 9 Oct 2017 19:44:40 -0700 (PDT) Received: from localhost ([::1]:60792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kX7-0006qx-6Y for importer@patchew.org; Mon, 09 Oct 2017 22:44:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSq-0003F1-9m for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSp-00037c-18 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSo-00036l-P8 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:10 -0400 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 C4C0D81DEE; Tue, 10 Oct 2017 02:40:09 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55E51189D9; Tue, 10 Oct 2017 02:40:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C4C0D81DEE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:55 -0300 Message-Id: <20171010024001.4526-3-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@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.25]); Tue, 10 Oct 2017 02:40: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] [PULL v2 2/8] machine: Add a valid_cpu_types property 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: qemu-devel@nongnu.org, Alistair Francis 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" From: Alistair Francis This patch add a MachineClass element that can be set in the machine C code to specify a list of supported CPU types. If the supported CPU types are specified the user enter CPU (by -cpu at runtime) is checked against the supported types and QEMU exits if they aren't supported. Signed-off-by: Alistair Francis Message-Id: [ehabkost: removed assert(), rewrote comment] Signed-off-by: Eduardo Habkost --- include/hw/boards.h | 1 + hw/core/machine.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index 156e0a5701..191a5b3cd8 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -191,6 +191,7 @@ struct MachineClass { bool has_hotpluggable_cpus; bool ignore_memory_transaction_failures; int numa_mem_align_shift; + const char **valid_cpu_types; void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes, int nb_nodes, ram_addr_t size); =20 diff --git a/hw/core/machine.c b/hw/core/machine.c index 80647edc2a..36c2fb069c 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -758,6 +758,38 @@ void machine_run_board_init(MachineState *machine) if (nb_numa_nodes) { machine_numa_finish_init(machine); } + + /* If the machine supports the valid_cpu_types check and the user + * specified a CPU with -cpu check here that the user CPU is supported. + */ + if (machine_class->valid_cpu_types && machine->cpu_type) { + ObjectClass *class =3D object_class_by_name(machine->cpu_type); + int i; + + for (i =3D 0; machine_class->valid_cpu_types[i]; i++) { + if (object_class_dynamic_cast(class, + machine_class->valid_cpu_types[i= ])) { + /* The user specificed CPU is in the valid field, we are + * good to go. + */ + break; + } + } + + if (!machine_class->valid_cpu_types[i]) { + /* The user specified CPU is not valid */ + error_report("Invalid CPU type: %s", machine->cpu_type); + error_printf("The valid types are: %s", + machine_class->valid_cpu_types[0]); + for (i =3D 1; machine_class->valid_cpu_types[i]; i++) { + error_printf(", %s", machine_class->valid_cpu_types[i]); + } + error_printf("\n"); + + exit(1); + } + } + machine_class->init(machine); } =20 --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507603393707864.14291847307; Mon, 9 Oct 2017 19:43:13 -0700 (PDT) Received: from localhost ([::1]:60786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kVR-0005Oa-DB for importer@patchew.org; Mon, 09 Oct 2017 22:42:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSr-0003Hy-Sb for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSr-0003Bi-4D for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSq-0003A5-Sp for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA245C04AC6B; Tue, 10 Oct 2017 02:40:11 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 497C060E3F; Tue, 10 Oct 2017 02:40:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EA245C04AC6B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:56 -0300 Message-Id: <20171010024001.4526-4-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 10 Oct 2017 02:40:12 +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] [PULL v2 3/8] vl: Eliminate defconfig variable 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: qemu-devel@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" Both -nodefconfig and -no-user-config options do the same thing today, we only need one variable to keep track of them. Suggested-by: Markus Armbruster Acked-by: Alistair Francis Reviewed-by: Markus Armbruster Signed-off-by: Eduardo Habkost Message-Id: <20171004030025.7866-2-ehabkost@redhat.com> Reviewed-by: Daniel P. Berrange Signed-off-by: Eduardo Habkost --- vl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 3fed457921..ebea42e0ea 100644 --- a/vl.c +++ b/vl.c @@ -3111,7 +3111,6 @@ int main(int argc, char **argv, char **envp) const char *qtest_log =3D NULL; const char *pid_file =3D NULL; const char *incoming =3D NULL; - bool defconfig =3D true; bool userconfig =3D true; bool nographic =3D false; DisplayType display_type =3D DT_DEFAULT; @@ -3213,8 +3212,6 @@ int main(int argc, char **argv, char **envp) popt =3D lookup_opt(argc, argv, &optarg, &optind); switch (popt->index) { case QEMU_OPTION_nodefconfig: - defconfig =3D false; - break; case QEMU_OPTION_nouserconfig: userconfig =3D false; break; @@ -3222,7 +3219,7 @@ int main(int argc, char **argv, char **envp) } } =20 - if (defconfig && userconfig) { + if (userconfig) { if (qemu_read_default_config_file() < 0) { exit(1); } --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 1507603526496609.710113113002; Mon, 9 Oct 2017 19:45:26 -0700 (PDT) Received: from localhost ([::1]:60795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kXr-0007W2-L4 for importer@patchew.org; Mon, 09 Oct 2017 22:45:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSu-0003MF-3b for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSt-0003IK-2M for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSs-0003FX-PJ for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE1EE10F74; Tue, 10 Oct 2017 02:40:13 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63E3460269; Tue, 10 Oct 2017 02:40:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE1EE10F74 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:57 -0300 Message-Id: <20171010024001.4526-5-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 10 Oct 2017 02:40:13 +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] [PULL v2 4/8] qemu-options: Deprecate -nodefconfig 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: qemu-devel@nongnu.org, Markus Armbruster 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" Since 2012 (commit ba6212d8 "Eliminate cpus-x86_64.conf file") we have no default config files that would be disabled using -nodefconfig. Update documentation and document -nodefconfig as deprecated. Cc: Markus Armbruster Acked-by: Alistair Francis Signed-off-by: Eduardo Habkost Message-Id: <20171004030025.7866-3-ehabkost@redhat.com> Reviewed-by: Markus Armbruster Reviewed-by: Daniel P. Berrange Signed-off-by: Eduardo Habkost --- qemu-doc.texi | 4 ++++ qemu-options.hx | 17 ++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index ecd186a159..d8bb2c664f 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2496,6 +2496,10 @@ would automatically enable USB support on the machin= e type. If using the new syntax, USB support must be explicitly enabled via the ``-machine usb=3Don'' argument. =20 +@subsection -nodefconfig (since 2.11.0) + +The ``-nodefconfig`` argument is a synonym for ``-no-user-config``. + @section qemu-img command line arguments =20 @subsection convert -s (since 2.0.0) diff --git a/qemu-options.hx b/qemu-options.hx index 39225ae6c3..981742d191 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4067,26 +4067,17 @@ Write device configuration to @var{file}. The @var{= file} can be either filename command line and device configuration into file or dash @code{-}) characte= r to print the output to stdout. This can be later used as input file for @code{-readconf= ig} option. ETEXI -DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig, - "-nodefconfig\n" - " do not load default config files at startup\n", - QEMU_ARCH_ALL) -STEXI -@item -nodefconfig -@findex -nodefconfig -Normally QEMU loads configuration files from @var{sysconfdir} and @var{dat= adir} at startup. -The @code{-nodefconfig} option will prevent QEMU from loading any of those= config files. -ETEXI +HXCOMM Deprecated, same as -no-user-config +DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig, "", QEMU_ARCH_ALL) DEF("no-user-config", 0, QEMU_OPTION_nouserconfig, "-no-user-config\n" - " do not load user-provided config files at startup\n", + " do not load default user-provided config files at sta= rtup\n", QEMU_ARCH_ALL) STEXI @item -no-user-config @findex -no-user-config The @code{-no-user-config} option makes QEMU not load any of the user-prov= ided -config files on @var{sysconfdir}, but won't make it skip the QEMU-provided= config -files from @var{datadir}. +config files on @var{sysconfdir}. ETEXI DEF("trace", HAS_ARG, QEMU_OPTION_trace, "-trace [[enable=3D]][,events=3D][,file=3D]\n" --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 1507603477259835.9400814388933; Mon, 9 Oct 2017 19:44:37 -0700 (PDT) Received: from localhost ([::1]:60791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kX4-0006oQ-Ex for importer@patchew.org; Mon, 09 Oct 2017 22:44:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSx-0003Q2-Av for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSu-0003Lr-Sx for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53732) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSu-0003JT-Kp for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A994BC057F91; Tue, 10 Oct 2017 02:40:15 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F57567C67; Tue, 10 Oct 2017 02:40:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A994BC057F91 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:58 -0300 Message-Id: <20171010024001.4526-6-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 10 Oct 2017 02:40:15 +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] [PULL v2 5/8] config: qemu_config_parse() return number of config groups 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: qemu-devel@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" Change qemu_config_parse() to return the number of config groups in success and -EINVAL on error. This will allow callers of qemu_config_parse() to check if something was really loaded from the config file. All existing callers of qemu_config_parse() and qemu_read_config_file() only check if the return value was negative, so the change shouldn't affect them. Reviewed-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Eduardo Habkost Message-Id: <20171004025043.3788-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- block/blkdebug.c | 1 - util/qemu-config.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 46e53f2f09..dfdf9b91aa 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -244,7 +244,6 @@ static int read_config(BDRVBlkdebugState *s, const char= *filename, ret =3D qemu_config_parse(f, config_groups, filename); if (ret < 0) { error_setg(errp, "Could not parse blkdebug config file"); - ret =3D -EINVAL; goto fail; } } diff --git a/util/qemu-config.c b/util/qemu-config.c index 405dd1a1d7..99b0e46fa3 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -385,6 +385,7 @@ void qemu_config_write(FILE *fp) } } =20 +/* Returns number of config groups on success, -errno on error */ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) { char line[1024], group[64], id[64], arg[64], value[1024]; @@ -392,7 +393,8 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, c= onst char *fname) QemuOptsList *list =3D NULL; Error *local_err =3D NULL; QemuOpts *opts =3D NULL; - int res =3D -1, lno =3D 0; + int res =3D -EINVAL, lno =3D 0; + int count =3D 0; =20 loc_push_none(&loc); while (fgets(line, sizeof(line), fp) !=3D NULL) { @@ -413,6 +415,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, c= onst char *fname) goto out; } opts =3D qemu_opts_create(list, id, 1, NULL); + count++; continue; } if (sscanf(line, "[%63[^]]]", group) =3D=3D 1) { @@ -423,6 +426,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, c= onst char *fname) goto out; } opts =3D qemu_opts_create(list, NULL, 0, &error_abort); + count++; continue; } value[0] =3D '\0'; @@ -447,7 +451,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, c= onst char *fname) error_report("error reading file"); goto out; } - res =3D 0; + res =3D count; out: loc_pop(&loc); return res; @@ -464,12 +468,7 @@ int qemu_read_config_file(const char *filename) =20 ret =3D qemu_config_parse(f, vm_config_groups, filename); fclose(f); - - if (ret =3D=3D 0) { - return 0; - } else { - return -EINVAL; - } + return ret; } =20 static void config_parse_qdict_section(QDict *options, QemuOptsList *opts, --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507603692842429.2931994946672; Mon, 9 Oct 2017 19:48:12 -0700 (PDT) Received: from localhost ([::1]:60810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kaQ-0001M6-OT for importer@patchew.org; Mon, 09 Oct 2017 22:48:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSx-0003QT-PO for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSw-0003QC-QA for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48328) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSw-0003OR-K6 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:18 -0400 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 A1456C04AC6A; Tue, 10 Oct 2017 02:40:17 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B1B568870; Tue, 10 Oct 2017 02:40:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A1456C04AC6A Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:39:59 -0300 Message-Id: <20171010024001.4526-7-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@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.31]); Tue, 10 Oct 2017 02:40:17 +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] [PULL v2 6/8] qom: update doc comment for type_register[_static]() 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: Igor Mammedov , qemu-devel@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" From: Igor Mammedov type_register()/type_register_static() functions in current impl. can't fail returning 0, also none of the users check for error so update doc comment to reflect current behaviour. Suggested-by: Eduardo Habkost Signed-off-by: Igor Mammedov Message-Id: <1507111682-66171-2-git-send-email-imammedo@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- include/qom/object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index e0d9824415..a707b67781 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -773,7 +773,7 @@ const char *object_get_typename(const Object *obj); * @info and all of the strings it points to should exist for the life time * that the type is registered. * - * Returns: 0 on failure, the new #Type on success. + * Returns: the new #Type. */ Type type_register_static(const TypeInfo *info); =20 @@ -784,7 +784,7 @@ Type type_register_static(const TypeInfo *info); * Unlike type_register_static(), this call does not require @info or its * string members to continue to exist after the call returns. * - * Returns: 0 on failure, the new #Type on success. + * Returns: the new #Type. */ Type type_register(const TypeInfo *info); =20 --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 1507603630443665.4439228541479; Mon, 9 Oct 2017 19:47:10 -0700 (PDT) Received: from localhost ([::1]:60806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kZY-0000cO-GL for importer@patchew.org; Mon, 09 Oct 2017 22:47:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kSz-0003SS-QO for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kSy-0003VU-Pp for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53822) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kSy-0003Sd-HL for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F65AC0587EF; Tue, 10 Oct 2017 02:40:19 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21D69614D3; Tue, 10 Oct 2017 02:40:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F65AC0587EF Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:40:00 -0300 Message-Id: <20171010024001.4526-8-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 10 Oct 2017 02:40:19 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL v2 7/8] vl: exit if maxcpus is negative 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: qemu-devel@nongnu.org, Seeteena Thoufeek Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Seeteena Thoufeek Signed-off-by: Eduardo Habkost Reported-by: R.Nageswara Sastry Reviewed-by: Philippe Mathieu-Daud=C3=A9 ---Steps to Reproduce--- When passed a negative number to 'maxcpus' parameter, Qemu aborts with a core dump. Run the following command with maxcpus argument as negative number ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine pseries,accel=3Dkvm,kvm-type=3DHV -m size=3D200g -device virtio-blk-pci, drive=3Drootdisk -drive file=3D/home/images/pegas-1.0-ppc64le.qcow2, if=3Dnone,cache=3Dnone,id=3Drootdisk,format=3Dqcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=3Dvirtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=3D1, threads=3D1,maxcpus=3D-12 (process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 18446744073709550568 bytes Trace/breakpoint trap Reported-by: R.Nageswara Sastry Signed-off-by: Seeteena Thoufeek Message-Id: <1504511031-26834-1-git-send-email-s1seetee@linux.vnet.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/sysemu.h | 2 +- vl.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b21369672a..c083869fcf 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -113,7 +113,7 @@ extern int win2k_install_hack; extern int alt_grab; extern int ctrl_grab; extern int smp_cpus; -extern int max_cpus; +extern unsigned int max_cpus; extern int cursor_hide; extern int graphic_rotate; extern int no_quit; diff --git a/vl.c b/vl.c index ebea42e0ea..d7c349233f 100644 --- a/vl.c +++ b/vl.c @@ -161,7 +161,7 @@ Chardev *sclp_hds[MAX_SCLP_CONSOLES]; int win2k_install_hack =3D 0; int singlestep =3D 0; int smp_cpus =3D 1; -int max_cpus =3D 1; +unsigned int max_cpus =3D 1; int smp_cores =3D 1; int smp_threads =3D 1; int acpi_enabled =3D 1; @@ -4331,8 +4331,8 @@ int main(int argc, char **argv, char **envp) =20 machine_class->max_cpus =3D machine_class->max_cpus ?: 1; /* Default t= o UP */ if (max_cpus > machine_class->max_cpus) { - error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " - "supported by machine '%s' (%d)", max_cpus, + error_report("Invalid SMP CPUs %d. The max CPUs " + "supported by machine '%s' is %d", max_cpus, machine_class->name, machine_class->max_cpus); exit(1); } --=20 2.13.6 From nobody Fri May 3 04:34:09 2024 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 1507603341909531.1520766712049; Mon, 9 Oct 2017 19:42:21 -0700 (PDT) Received: from localhost ([::1]:60785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kUv-0004tf-3N for importer@patchew.org; Mon, 09 Oct 2017 22:42:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1kT2-0003V4-Ag for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1kT0-0003X2-T8 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1kT0-0003WW-Ly for qemu-devel@nongnu.org; Mon, 09 Oct 2017 22:40:22 -0400 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 9FFEA81DEB; Tue, 10 Oct 2017 02:40:21 +0000 (UTC) Received: from localhost (ovpn-116-25.gru2.redhat.com [10.97.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D4B667CED; Tue, 10 Oct 2017 02:40:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9FFEA81DEB Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Mon, 9 Oct 2017 23:40:01 -0300 Message-Id: <20171010024001.4526-9-ehabkost@redhat.com> In-Reply-To: <20171010024001.4526-1-ehabkost@redhat.com> References: <20171010024001.4526-1-ehabkost@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.25]); Tue, 10 Oct 2017 02:40:21 +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] [PULL v2 8/8] x86: Correct translation of some rdgsbase and wrgsbase encodings 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: qemu-devel@nongnu.org, Todd Eisenberger 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" From: Todd Eisenberger It looks like there was a transcription error when writing this code initially. The code previously only decoded src or dst of rax. This resolves https://bugs.launchpad.net/qemu/+bug/1719984. Signed-off-by: Todd Eisenberger Message-Id: Reviewed-by: Richard Henderson Signed-off-by: Eduardo Habkost --- target/i386/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index a8986f4c1a..7b920115f9 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -8155,9 +8155,9 @@ static target_ulong disas_insn(DisasContext *s, CPUSt= ate *cpu) break; =20 case 0xc0 ... 0xc7: /* rdfsbase (f3 0f ae /0) */ - case 0xc8 ... 0xc8: /* rdgsbase (f3 0f ae /1) */ + case 0xc8 ... 0xcf: /* rdgsbase (f3 0f ae /1) */ case 0xd0 ... 0xd7: /* wrfsbase (f3 0f ae /2) */ - case 0xd8 ... 0xd8: /* wrgsbase (f3 0f ae /3) */ + case 0xd8 ... 0xdf: /* wrgsbase (f3 0f ae /3) */ if (CODE64(s) && (prefixes & PREFIX_REPZ) && !(prefixes & PREFIX_LOCK) --=20 2.13.6