From c9cf636d48fcb1d797077e1ffa456a3d324156bc Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Tue, 3 Oct 2017 13:05:09 -0700 Subject: machine: Add a valid_cpu_types property 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 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/hw/boards.h b/include/hw/boards.h index 156e0a5..191a5b3 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); -- cgit v1.1 From 31b93521924dddb22621f8dba27cdce802406eb3 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 4 Oct 2017 12:08:00 +0200 Subject: qom: update doc comment for type_register[_static]() 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(-) (limited to 'include') diff --git a/include/qom/object.h b/include/qom/object.h index e0d9824..a707b67 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); @@ -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); -- cgit v1.1 From c0dd10991903c552811d8cbe9231055b1b3a7ebd Mon Sep 17 00:00:00 2001 From: Seeteena Thoufeek Date: Mon, 4 Sep 2017 13:13:51 +0530 Subject: vl: exit if maxcpus is negative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eduardo Habkost ---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=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci, drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2, if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet :127.0.0.1:1234,server,nowait -net nic,model=virtio -net user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1, threads=1,maxcpus=-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é --- include/sysemu/sysemu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b213696..c083869 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; -- cgit v1.1