summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Port -net none and -net nic to QemuOptsMark McLoughlin2009-10-061-77/+160
| | | | | | | | | | | | | | | | | | We use a table of network types to look up the initialization function and parameter descriptions in net_client_init(). For now, we use QemuOpts for the 'none' and 'nic' types. Subsequent patches port the other types too and the special casing is removed. We're not parsing the full -net option string here as the type has been stripped from the string, so we do not use qemu_opts_parse() 'firstname' facility. This will also be rectified in subsequent patches. No functional changes are introduced by this patch. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add qemu_net_optsMark McLoughlin2009-10-062-0/+14
| | | | | | | | | The first step in porting -net to QemuOpts. We do not include parameter descriptions in the QemuOptsList because we use the first parameter to choose which descriptions validate against. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Never overwrite a QemuOptMark McLoughlin2009-10-061-28/+23
| | | | | | | | | | | | | Rather than overwriting a QemuOpt, just add a new one to the tail and always do a reverse search for parameters to preserve the same behaviour. We use this order so that foreach() iterates over the opts in their original order. This will allow us handle options where multiple values for the same parameter is allowed - e.g. -net user,hostfwd= Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add qemu_opts_validate() for post parsing validationMark McLoughlin2009-10-062-0/+34
| | | | | | | | | | | | | Several qemu command line options have a parameter whose value affects what other parameters are accepted for the option. In these cases, we can have an empty description table in the QemuOptsList and once the option has been parsed we can use a suitable description table to validate the other parameters based on the value of that parameter. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make qemu_opts_parse() handle empty stringsMark McLoughlin2009-10-061-3/+1
| | | | | | | | | Rather than making callers explicitly handle empty strings by using qemu_opts_create(), we can easily have qemu_opts_parse() handle empty parameter strings. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove double error message for -device option parsingMark McLoughlin2009-10-061-3/+1
| | | | | | | | qemu_opts_parse() gives a suitable error message in all failure cases so we can remove the error message from the caller. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove double error message in qemu_option_set()Mark McLoughlin2009-10-061-2/+0
| | | | | | | | qemu_opt_set() prints an error message in all failure cases, so qemu_set_option() doesn't need to print another error. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove bogus error message from qemu_opts_set()Mark McLoughlin2009-10-061-2/+0
| | | | | | | | | The only way qemu_opts_create() can fail is if a QemuOpts with that id already exists and fail_if_exists=1. In that case, we already print an error which makes more sense than the one in qemu_opts_set(). Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Drop config_error(), use qemu_error() insteadMarkus Armbruster2009-10-061-72/+55
| | | | | | | | | | | | | | | | | | | | | | | Diagnostic output goes to stderr, except when we're in a monitor command, when it goes to the monitor instead. config_error() implements this with a monitor argument: if it's non-null, report there, else to stderr. This obliges us to pass the monitor down various call chains, to make it available to config_error(). The recently created qemu_error() doesn't need a monitor argument to route output. Use it. There's one user-visible difference: config_error() prepended "qemu: " to a message bound for stderr. qemu_error() doesn't, which means the prefix goes away with this commit. If such a prefix is desired for stderr, then I figure it should be slapped on all error messages, not just the ones that used to go through config_error(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't exit() in config_error()Markus Armbruster2009-10-063-41/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagating errors up the call chain is tedious. In startup code, we can take a shortcut: terminate the program. This is wrong elsewhere, the monitor in particular. config_error() tries to cater for both customers: it terminates the program unless its mon parameter tells it it's working for the monitor. Its users need to return status anyway (unless passing a null mon argument, which none do), which their users need to check. So this automatic exit buys us exactly nothing useful. Only the dangerous delusion that we can get away without returning status. Some of its users fell for that. Their callers continue executing after failure when working for the monitor. This bites monitor command host_net_add in two places: * net_slirp_init() continues after slirp_hostfwd(), slirp_guestfwd(), or slirp_smb() failed, and may end up reporting success. This happens for "host_net_add user guestfwd=foo": it complains about the invalid guest forwarding rule, then happily creates the user network without guest forwarding. * net_client_init() can't detect slirp_guestfwd() failure, and gets fooled by net_slirp_init() lying about success. Suppresses its "Could not initialize device" message. Add the missing error reporting, make sure errors are checked, and drop the exit() from config_error(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make net_client_init() consume slirp_configs even on errorMarkus Armbruster2009-10-061-5/+7
| | | | | | | | | | | | net_slirp_init() walks slirp_configs, and stops when it encounters one that doesn't work. Instead of consuming slirp_configs members there, consume them in the sole caller. This makes sure all are consumed. Before, the tail starting with the non-working one was left in place, where it made the next net_slirp_init() fail again. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use qemu_strdup() for VLANClientState string fieldsMark McLoughlin2009-10-061-7/+7
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Move memset() from net_client_uninit() to net_client_init()Mark McLoughlin2009-10-061-1/+2
| | | | | | | | zeroing a structure before using it is more common than zeroing after using it. Also makes the setting of nd->used more obvious. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make NICInfo string fields non-constMark McLoughlin2009-10-064-10/+10
| | | | | | | | | | We now only assign strdup()ed strings to these fields, never static strings. aliguori: fix build for ppc_prep and mips_jazz Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't assign a static string to NICInfo::modelMark McLoughlin2009-10-061-1/+1
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use qemu_strdup() for NICInfo string fieldsMark McLoughlin2009-10-061-4/+4
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Register rtc options for -setJan Kiszka2009-10-061-0/+1
| | | | | | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Fix exit on 'pci_add' Monitor command"Anthony Liguori2009-10-063-16/+0
| | | | | | | | This reverts commit 0148fde54c2478ea8a47c8dbfe4c0fb8bda4d996. As requested by Luiz. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* offer right-ctrl as a grab optionDustin Kirkland2009-10-064-7/+26
| | | | | | | | | | | | | | Add support for -ctrl-grab to use the right-ctrl button to grab/release the mouse in SDL. The multi-button ctrl-alt and ctrl-alt-shift grab buttons present an accessibility problem to users who cannot press more than one button at a time. https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/237635 Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add host_device format description to qemu-img manpageAdrian Bridgett2009-10-061-0/+6
| | | | | | | | | | Converting files using "qemu-img convert" onto logical volumes (or any block device) you need to use the currently undocumented "host_device" format. This patch adds the required documentation to the manpage. Reported-by: Adrian Bridgett <adrian@bitcube.co.uk> Signed-off-by: Adrian Bridgett <adrian@bitcube.co.uk> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Reorganize option rom (+linux kernel) loading.Gerd Hoffmann2009-10-066-248/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds infrastructure to maintain memory regions which must be restored on reset. That includes roms (vga bios and option roms on pc), but is also used when loading linux kernels directly. Features: - loading files is supported. - passing blobs is supported. - target address range is supported (for optionrom area). - fixed target memory address is supported (linux kernel). New in v2: - writes to ROM are done only at initial boot. - also handle aout and uimage loaders. - drop unused fread_targphys() function. The final memory layout is created once all memory regions are registered. The option roms get addresses assigned and the registered regions are checked against overlaps. Finally all data is copyed to the guest memory. Advantages: (1) Filling memory on initial boot and on reset takes the same code path, making reset more robust. (2) The need to keep track of the option rom load address is gone. (3) Due to (2) option roms can be loaded outside pc_init(). This allows to move the pxe rom loading into the nic drivers for example. Additional bonus: There is a 'info roms' monitor command now. The patch also switches over pc.c and removes the option_rom_setup_reset() and load_option_rom() functions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* eepro100: support 16 bit read from SCBCmd (== 2)=?UTF-8?q?Reimar=20D=C3=B6ffinger?=2009-10-061-0/+1
| | | | | | | | This is necessary to support OpenBSD 4.2 install, without this change it triggers an assert. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* target-i386: move recently added vmstate fields at the end of the structureAurelien Jarno2009-10-051-4/+6
| | | | | | | This reduce the impact on hosts that have addressing modes with limited offsets. Suggested by Laurent Desnogues. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* block/raw: Add create_options for host_deviceKevin Wolf2009-10-051-6/+10
| | | | | | | | Today host_devices have a create function, so they also need a create_options field to prevent qemu-img from complaining. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Improve error reporting on file accessJustin M. Forbes2009-10-052-16/+16
| | | | | | | | | By making the error reporting include strerror(errno), it gives the user a bit more indication as to why qemu failed. This is particularly important for people running qemu as a non root user. Signed-off-by: Justin M. Forbes <jforbes@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Win32: Fix vnc support.Stefan Weil2009-10-051-2/+21
| | | | | | | | Without this patch, qemu on windows crashes as soon as a vnc client connects. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* x86: fix miss mergeJuan Quintela2009-10-051-1/+2
| | | | | | | | There was a missmerge, and then we got a tail recursive call to cpu_post_load without case base :) Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rename pci_create_noinit() to pci_create()Markus Armbruster2009-10-055-9/+9
| | | | | | | It's qdev_create() specialized for PCI, so name it accordingly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci_create() is now unused, remove itMarkus Armbruster2009-10-052-19/+0
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix pci_add nic not to exit on bad modelMarkus Armbruster2009-10-0515-32/+71
| | | | | | | | | | | | | | | | Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to create the NIC. When MODEL is unknown or "?", this prints to stderr and terminates the program. Change pci_nic_init() not to treat "?" specially, and to return NULL on failure. Switch uses during startup to new convenience wrapper pci_nic_init_nofail(), which behaves just like pci_nic_init() used to do. Bonus bug fix: we now check for qdev_init() failing there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make it obvious that pci_nic_init() can't failMarkus Armbruster2009-10-053-21/+14
| | | | | | | | | | | | | Before this patch, pci_nic_init() returns NULL when it can't find the model in pci_nic_models[]. Except this can't happen, because qemu_check_nic_model_list() just searched for model in pci_nic_models[], and terminated the program on failure. Repeating the search here is pointless. Instead, change qemu_check_nic_model_list() to return the model's array index. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix pci_add storage not to exit on bad first argumentMarkus Armbruster2009-10-053-3/+12
| | | | | | | | | | | | Monitor command "pci_add ADDR storage ..." does its work in qemu_pci_hot_add_nic(). It called pci_create(..., ADDR) to create the device. That's wrong, because pci_create() terminates the program when ADDR is invalid. Use pci_get_bus_devfn() and pci_create_noinit() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix pci_vga_init() not to ignore bus argumentMarkus Armbruster2009-10-051-1/+1
| | | | | | | | | | Commit a414c306 converted all VGA devices to qdev. It used pci_create_simple() for all devices, except for this one it used pci_create(). That's wrong, because it uses PCI bus#0 regardless of the bus argument. Fix by switching to pci_create_noinit(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* set correct CS seg limit and flags on sipiGleb Natapov2009-10-051-1/+1
| | | | | | | TCG works with incorrect values somehow. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Set revision in eeprom correctly for 82557 versions.=?UTF-8?q?Reimar=20D=C3=B6ffinger?=2009-10-051-0/+2
| | | | | | | | This is necessary to make FreeBSD recognize the device as 82557 - otherwise its driver will use unsupported features and fail to work. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* restore CFLAGS check for conflict and fix recursive CFLAGS issueThomas Monjalon2009-10-052-4/+4
| | | | | | | | | | | cc-option uses more make-syntax to replace the shell "if/else". Issue with recursive += is fixed by doing the first assignment simply-expanded, as explained in http://www.gnu.org/software/make/manual/html_node/Appending.html Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-pci: return error if virtio_console_init failsAmit Shah2009-10-051-0/+3
| | | | | | | | | Currently only one virtio_console device is supported. Trying to add multiple devices fails and such failure should be reported back to the qdev init functions. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: show name of device that fails initAmit Shah2009-10-051-0/+1
| | | | | | | | | When initialising a device fails, show the name of the failing device. The current behaviour is to silently exit on such errors. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Set invalid buffer pointers to NULLStefan Weil2009-10-051-2/+8
| | | | | | | | | | After qemu_free, the pointers for input and output buffers are no longer valid, so set them to NULL (most other calls of qemu_free in vnc.c use this pattern, too). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* eepro100: Don't allow guests to fail assertionsKevin Wolf2009-10-051-11/+35
| | | | | | | | | | | | The idea of using assert() for input validation is rather questionable. Let's remove it from eepro100, so that guests need to find more interesting ways if they want to crash qemu. This patch replaces asserts that are directly dependent on guest-accessible data by other means of error handling. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qcow2: Increase maximum cluster size to 2 MBKevin Wolf2009-10-054-9/+12
| | | | | | | | | | | | | | | This patch increases the maximum qcow2 cluster size to 2 MB. Starting with 128k clusters, L2 tables span 2 GB or more of virtual disk space, causing 32 bit truncation and wraparound of signed integers. Therefore some variables need to use a larger data type. While being at reviewing data types, change some integers that are used for array indices to unsigned. In some places they were checked against some upper limit but not for negative values. This could avoid potential segfaults with corrupted qcow2 images. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/virtio-pci: remove unnecessary checkMichael S. Tsirkin2009-10-051-2/+1
| | | | | | | | | it's safe to call msix_write_config if msix is disabled, so call it unconditionally on pci config write. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu: clean up target page usage in msixMichael S. Tsirkin2009-10-054-36/+27
| | | | | | | | | | Since cpu_register_phys_memory does not require size to be a multiple of target page size, simply make msix page size 0x1000. Do this in msix, reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no longer have to pass target page around. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix comment on cpu_register_physical_memory_offsetMichael S. Tsirkin2009-10-051-2/+3
| | | | | | | | We don't require full pages in cpu_register_physical_memory, except for RAM. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/pci: reset device registers on bus resetMichael S. Tsirkin2009-10-051-0/+13
| | | | | | | | Reset BARs and a couple of other registers on bus reset, as per PCI spec. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/pci: refactor code/symbolic constantsMichael S. Tsirkin2009-10-052-20/+23
| | | | | | | | | | | refactor code slightly, adding symbolic constants and functions, and using macros where possible. This will also make following reset patches easier. No functional changes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/virtio: fix reset with device removalMichael S. Tsirkin2009-10-051-6/+8
| | | | | | | | | virtio pci registers its own reset handler, but fails to unregister it, which will lead to crashes after device removal. Solve this problem by switching to qdev reset handler, which is automatically unregistered. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/qdev: type safety in reset handlerMichael S. Tsirkin2009-10-054-13/+19
| | | | | | | | Add type safety to qdev reset handlers, by declaring them as DeviceState * rather than void *. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* serial: convert isa to qdevGerd Hoffmann2009-10-057-28/+75
| | | | | | | | | | | Everything using standard isa I/O ports and IRQ windup is considerd being an actual isa device. That are all serial_init() users except mips_mipssim() which seems to have a non-standard IRQ windup. baud rate is fixed at 115200 now as no caller passed in something else. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: don't crash on unset drive properties.Gerd Hoffmann2009-10-051-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud