summaryrefslogtreecommitdiff
path: root/vl.c
AgeCommit message (Collapse)AuthorFilesLines
2013-05-12clean unnecessary code: don't check g_strdup arg for NULLDong Xu Wang1-1/+1
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-02Drop redundant resume_all_vcpus() from main()Jan Kiszka1-1/+0
VCPUs are either resumed directly via vm_start(), after the incoming migration is done, or when a continue command is issued. We don't need the explicit resume before entering main_loop(). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-05-01cpu: Call cpu_synchronize_post_init() from DeviceClass::realize()Igor Mammedov1-1/+0
If hotplugged, synchronize CPU state to KVM. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-04-30add a new runstate: RUN_STATE_GUEST_PANICKEDHu Tao1-2/+11
The guest will be in this state when it is panicked. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 0255f263ffdc2a3716f73e89098b96fd79a235b3.1366945969.git.hutao@cn.fujitsu.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29audio: enable PCI audio cards for all PCI-enabled targetsPaolo Bonzini1-0/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366303444-24620-9-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29audio: remove HAS_AUDIOPaolo Bonzini1-8/+0
Several targets can have wavcapture/-soundhw support via PCI cards. HAS_AUDIO is a useless limitation, remove it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366303444-24620-4-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-26Common: Add quick access to first boot deviceDominik Dingel1-0/+18
Instead of manually parsing the boot_list as character stream, we can access the nth boot device, specified by the position in the boot order. Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-04-23Move TPM passthrough specific command line options to backend structureStefan Berger1-15/+1
Move the TPM passthrough specific command line options to the passthrough backend implementation and attach them to the backend's interface structure. Add code to tpm.c for validating the TPM command line options. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Corey Bryan <coreyb@linux.vnet.ibm.com> Message-id: 1366641699-21420-1-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-22Add option to mlock qemu and guest memorySatoru Moriya1-0/+34
In certain scenario, latency induced by paging is significant and memory locking is needed. Also, in the scenario with untrusted guests, latency improvement due to mlock is desired. This patch introduces a following new option to mlock guest and qemu memory: -realtime mlock=on|off Signed-off-by: Satoru Moriya <satoru.moriya@hds.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366382526-26146-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-16console: move gui_update+gui_setup_refresh from vl.c into console.cGerd Hoffmann1-49/+0
Pure code motion, no functional changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: displaystate init revampGerd Hoffmann1-5/+1
We have only one DisplayState, so there is no need for the "next" linking, rip it. Also consolidate all displaystate initialization into init_displaystate(). This function is called by vl.c after creating the devices (and thus all QemuConsoles) and before initializing DisplayChangeListensers (aka gtk/sdl/vnc/spice ui). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-15Merge remote-tracking branch 'bonzini/hw-dirs' into stagingAnthony Liguori1-3/+3
* bonzini/hw-dirs: exec: remove useless declarations from memory-internal.h memory: move core typedefs to qemu/typedefs.h include: avoid useless includes of exec/ headers sysemu: avoid proliferation of include/ subdirectories tpm: reorganize headers and split hardware part configure: fix TPM logic acpi.h: make it self contained acpi: move declarations from pc.h to acpi.h hw: Add lost ARM core again Fix failure to create q35 machine Add linux-headers to QEMU_INCLUDES arm: fix location of some include files Conflicts: configure aliguori: trivial conflict in configure output Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15Allow qtest to be used together with a virtual CPUEdgar E. Iglesias1-0/+4
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Message-id: 1366054097-14132-1-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-15tpm: reorganize headers and split hardware partPaolo Bonzini1-1/+1
The TPM subsystem does not have a full front-end/back-end separation. The sole available backend, tpm_passthrough, depends on the data structures of the sole available frontend, tpm_tis. However, we can at least try to split the user interface (tpm.c) from the implementation (hw/tpm). The patches makes tpm.c not include tpm_int.h, which is shared between tpm_tis.c and tpm_passthrough.c; instead it moves more stuff to tpm_backend.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-12Revert "New QMP command query-cpu-max and HMP command cpu_max"Michal Novotny1-5/+0
This reverts commit 4d700430a20b3d53b7b15bc5f6666f7e570e3f2c as asked by Luiz. The patch has been obsoleted by extending MachineInfo structure by cpu-max field. Signed-off-by: Michal Novotny <minovotn@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-04-12New cpu-max field in query-machines QMP command outputMichal Novotny1-0/+1
Alter the query-machines QMP command to output information about maximum number of CPUs for each machine type with default value set to 1 in case the number of max_cpus is not set. Signed-off-by: Michal Novotny <minovotn@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-04-08hw: move headers to include/Paolo Bonzini1-6/+6
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-04acpi_table_add(): accept QemuOpts and parse it with OptsVisitorLaszlo Ersek1-1/+3
As one consequence, strtok() -- which modifies its argument -- is replaced with g_strsplit(). Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1363821803-3380-6-git-send-email-lersek@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-04strip some whitespaceLaszlo Ersek1-4/+4
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1363821803-3380-2-git-send-email-lersek@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-04qemu-char: Call fe_claim / fe_release when not using qdev chr propertiesHans de Goede1-0/+1
chardev-frontends need to explictly check, increase and decrement the avail_connections "property" of the chardev when they are not using a qdev-chardev-property for the chardev. This fixes things like: qemu-kvm -chardev stdio,id=foo -device isa-serial,chardev=foo \ -mon chardev=foo Working, where they should fail. Most of the changes here are due to old hardware emulation code which is using serial_hds directly rather then a qdev-chardev-property. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364412581-3672-3-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-02append the terminating '\0' to bootorder stringAmos Kong1-3/+3
Problem was introduced in commit c8a6ae8b. The last terminating '\0' was lost, use the right length 5 ("HALT\0"). Reported-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Message-id: 1363774594-21001-1-git-send-email-akong@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-28Merge remote-tracking branch 'stefanha/block' into stagingAnthony Liguori1-2/+2
# By Kevin Wolf (22) and Peter Lieven (1) # Via Stefan Hajnoczi * stefanha/block: (23 commits) block: Fix direct use of protocols as driver for bdrv_open() qcow2: Gather clusters in a looping loop qcow2: Move cluster gathering to a non-looping loop qcow2: Allow requests with multiple l2metas qcow2: Use byte granularity in qcow2_alloc_cluster_offset() qcow2: Prepare handle_alloc/copied() for byte granularity qcow2: handle_copied(): Implement non-zero host_offset qcow2: handle_copied(): Get rid of keep_clusters parameter qcow2: handle_copied(): Get rid of nb_clusters parameter qcow2: Factor out handle_copied() qcow2: Clean up handle_alloc() qcow2: Finalise interface of handle_alloc() qcow2: handle_alloc(): Get rid of keep_clusters parameter qcow2: handle_alloc(): Get rid of nb_clusters parameter qcow2: Factor out handle_alloc() qcow2: Decouple cluster allocation from cluster reuse code qcow2: Change handle_dependency to byte granularity qcow2: Improve check for overlapping allocations qcow2: Handle dependencies earlier qcow2: Remove bogus unlock of s->lock ...
2013-03-28vl: add runstate_set tracepointKazuya Saito1-1/+1
This patch enables us to know RunState transition. It will be userful for investigation when the trouble occured in special event such like live migration, shutdown, suspend, and so on. Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-28vl.c: call bdrv_init_with_whitelist() before cmdline parsingPeter Lieven1-2/+2
commit 4d454574 "qemu-option: move standard option definitions out of qemu-config.c" broke support for commandline option groups that where registered during bdrv_init(). In particular support for -iscsi options was broken since that commit. Fix by moving the bdrv_init_with_whitelist() before command line argument parsing. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-25New QMP command query-cpu-max and HMP command cpu_maxMichal Novotny1-0/+5
These commands return the maximum number of CPUs supported by the currently running emulator instance, as defined in its QEMUMachine struct. Signed-off-by: Michal Novotny <minovotn@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-03-19add a boot option to do strict bootAmos Kong1-1/+24
Seabios already added a new device type to halt booting. Qemu can add "HALT" at the end of bootindex string, then seabios will halt booting after trying to boot from all selected devices. This patch added a new boot option to configure if boot from un-selected devices. This option only effects when boot priority is changed by bootindex options, the old style(-boot order=..) will still try to boot from un-selected devices. v2: add HALT entry in get_boot_devices_list() v3: rebase to latest qemu upstream Signed-off-by: Amos Kong <akong@redhat.com> Message-id: 1363674207-31496-1-git-send-email-akong@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-18console: fix displaychangelisteners interfaceGerd Hoffmann1-3/+3
Split callbacks into separate Ops struct. Pass DisplayChangeListener pointer as first argument to all callbacks. Uninline a bunch of display functions and move them from console.h to console.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-12Add search path support for qemu data files.Gerd Hoffmann1-13/+23
This patch allows to specify multiple directories where qemu should look for data files. To implement that the behavior of the -L switch is slightly different now: Instead of replacing the data directory the path specified will be appended to the data directory list. So when specifiying -L multiple times all directories specified will be checked, in the order they are specified on the command line, instead of just the last one. Additionally the default paths are always appended to the directory data list. This allows to specify a incomplete directory (such as the seabios out/ directory) via -L. Anything not found there will be loaded from the default paths, so you don't have to create a symlink farm for all the rom blobs. For trouble-shooting a tracepoint has been added, logging which blob has been loaded from which location. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1362739344-8068-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-12Add support for cancelling of a TPM commandStefan Berger1-0/+5
This patch adds support for cancelling an executing TPM command. In Linux for example a user can cancel a command through the TPM's sysfs 'cancel' entry using echo "1" > /sysfs/class/misc/tpm0/device/cancel This patch propagates the cancellation of a command inside a VM to the host TPM's sysfs entry. It also uses the possibility to cancel the command before QEMU VM shutdown or reboot, which helps in preventing QEMU from hanging while waiting for the completion of the command. To relieve higher layers or users from having to determine the TPM's cancel sysfs entry, the driver searches for the entry in well known locations. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Message-id: 1361987275-26289-7-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-12Support for TPM command line optionsStefan Berger1-0/+37
This patch adds support for TPM command line options. The command line options supported here are ./qemu-... -tpmdev passthrough,path=<path to TPM device>,id=<id> -device tpm-tis,tpmdev=<id>,id=<other id> and ./qemu-... -tpmdev help where the latter works similar to -soundhw help and shows a list of available TPM backends (for example 'passthrough'). Using the type parameter, the backend is chosen, i.e., 'passthrough' for the passthrough driver. The interpretation of the other parameters along with determining whether enough parameters were provided is pushed into the backend driver, which needs to implement the interface function 'create' and return a TPMDriverOpts structure if the VM can be started or 'NULL' if not enough or bad parameters were provided. Monitor support for 'info tpm' has been added. It for example prints the following: (qemu) info tpm TPM devices: tpm0: model=tpm-tis \ tpm0: type=passthrough,path=/dev/tpm0,cancel-path=/sys/devices/pnp0/00:09/cancel Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Message-id: 1361987275-26289-2-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-10Merge remote-tracking branch 'bonzini/hw-dirs' into stagingAnthony Liguori1-0/+1
* bonzini/hw-dirs: sh: move files referencing CPU to hw/sh4/ ppc: move more files to hw/ppc ppc: move files referencing CPU to hw/ppc/ m68k: move files referencing CPU to hw/m68k/ i386: move files referencing CPU to hw/i386/ arm: move files referencing CPU to hw/arm/ hw: move boards and other isolated files to hw/ARCH ppc: express FDT dependency of pSeries and e500 boards via default-configs/ build: always link device_tree.o into emulators if libfdt available hw: include hw header files with full paths ppc: do not use ../ in include files vt82c686: vt82c686 is not a PCI host bridge virtio-9p: remove PCI dependencies from hw/9pfs/ virtio-9p: use CONFIG_VIRTFS, not CONFIG_LINUX hw: move device-hotplug.o to toplevel, compile it once hw: move qdev-monitor.o to toplevel directory hw: move fifo.[ch] to libqemuutil hw: move char backends to backends/ Conflicts: backends/baum.c backends/msmouse.c hw/a15mpcore.c hw/arm/Makefile.objs hw/arm/pic_cpu.c hw/dataplane/event-poll.c hw/dataplane/virtio-blk.c include/char/baum.h include/char/msmouse.h qemu-char.c vl.c Resolve conflicts caused by header movements. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-08qemu-char: move baum registration to baum.cAnthony Liguori1-1/+0
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 1b24baa1ec3a174d5cad31e079d829904b53077b.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-01hw: move qdev-monitor.o to toplevel directoryPaolo Bonzini1-0/+1
qdev-monitor.c is the only "core qdev" file that is not used in user-mode emulation, and it does not define anything that is used by hardware models. Remove it from the hw/ directory and remove hw/qdev-monitor.h from hw/qdev.h too; this requires some files to have some new explicitly includes. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-03-01hw: move char backends to backends/Paolo Bonzini1-1/+1
Braille and msmouse support is in hw/, but it is not hardware. Move it to the backends/ directory. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-02-28vl.c: allow for repeated -sd argumentsPeter Crosthwaite1-1/+1
Allows for repeating of -sd arguments in the same way as -pflash and -mtdblock. Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-02-26gtk ui: unbreak spiceGerd Hoffmann1-3/+1
Merge of the gtk ui brought a initialitation order issue for spice: The using_spice variable isn't set yet when checked, leading to the default UI being activated (additionally to spice remote access). Let's set display_remote when we find a -spice switch on the command line, like we do for vnc. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1361804550-15858-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-21gtk: make default UI (v5)Anthony Liguori1-14/+34
A user can still enable SDL with '-sdl' or '-display sdl' but start making the default display GTK by default. I'd also like to deprecate the SDL display and remove it in a few releases. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1361367806-4599-9-git-send-email-aliguori@us.ibm.com
2013-02-19usb-host: remove usb_host_device_closeGerd Hoffmann1-2/+3
Nobody implements that anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-02-16cpus.c: Drop unnecessary set_cpu_log()Peter Maydell1-1/+8
The set_cpu_log() function in cpus.c is a fairly simple wrapper which is only called from one location. Just inline the code into vl.c, since there is no need to indirect it via cpus.c and the handling of the error case is more appropriate to vl.c. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-02-16qemu-log: Unify {cpu_set,set_cpu}_log_filename as qemu_set_log_filenamePeter Maydell1-1/+1
The qemu_log() functionality is no longer specific to TCG CPU debug logs. Rename cpu_set_log_filename() to qemu_set_log_filename() and drop the pointless wrapper set_cpu_log_filename(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-02-11vl: Exit unsuccessfully on option argument syntax errorMarkus Armbruster1-4/+12
We exit successfully after reporting syntax error for argument of --sandbox and --add-fd. We continue undaunted after reporting it for argument of -boot, --option-rom and --object. Change all five to exit unsuccessfully, like the other options. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1360354939-10994-7-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-11vl: Drop redundant "parse error" reportsMarkus Armbruster1-4/+0
qemu_opts_parse() reports the error already, and in a much more useful way. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1360354939-10994-6-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: validate -numa "cpus" parameter properlyEduardo Habkost1-5/+27
- Accept empty strings without aborting - Use parse_uint*() to parse numbers - Abort if anything except '-' or end-of-string is found after the first number. - Check for endvalue < value Also change the MAX_CPUMASK_BITS warning message from "A max of %d CPUs are supported in a guest" to "qemu: NUMA: A max of %d VCPUs are supported". Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: Extract -numa "cpus" parsing to separate functionEduardo Habkost1-18/+23
This will make it easier to refactor that code later. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: Use parse_uint_full() for NUMA nodeidEduardo Habkost1-1/+4
This should catch many kinds of errors that the current code wasn't checking for: - Values that can't be parsed as a number - Negative values - Overflow - Empty string Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: numa_add(): Validate nodeid before using itEduardo Habkost1-1/+6
Without this check, QEMU will corrupt memory if a too-large nodeid is provided in the command-line. e.g.: -numa node,mem=...,cpus=...,nodeid=65 This changes nodenr to unsigned long long, to avoid integer conversion issues when converting the strtoull() result to int. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: Check for NUMA node limit inside numa_add()Eduardo Habkost1-4/+6
Instead of checking the limit before calling numa_add(), check the limit only when we already know we're going to add a new node. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: Abort on unknown -numa option typeEduardo Habkost1-0/+3
Abort in case an invalid -numa option is provided, instead of silently ignoring it. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04vl.c: Fix off-by-one bug when handling "-numa node" argumentEduardo Habkost1-1/+4
The numa_add() code was unconditionally adding 1 to the get_opt_name() return value, making it point after the end of the string if no ',' separator is present. Example of weird behavior caused by the bug: $ qemu-img create -f qcow2 this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2 5G Formatting 'this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 $ ./x86_64-softmmu/qemu-system-x86_64 -S -monitor stdio -numa node 'this-file-image-has,cpus=5,mem=1000,in-its-name.qcow2' QEMU 1.3.50 monitor - type 'help' for more information (qemu) info numa 1 nodes node 0 cpus: 0 node 0 size: 1000 MB (qemu) This changes the code to nove the pointer only if ',' is found. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>