summaryrefslogtreecommitdiffstats
path: root/vl.c
Commit message (Collapse)AuthorAgeFilesLines
* Final net cleanup after conversion to QemuOptsMark McLoughlin2009-10-061-24/+4
| | | | | | | | | | | | | | | | Now that net_client_init() has no users, kill it off and rename net_client_init_from_opts(). There is no further need for the old code in net_client_parse() either. We use qemu_opts_parse() 'firstname' facitity for that. Instead, move the special handling of the 'vmchannel' type there. Simplify the vl.c code into merely call net_client_parse() for each -net command line option and then calling net_init_clients() later to iterate over the options and create the clients. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Port usb net to QemuOptsMark McLoughlin2009-10-061-4/+15
| | | | | | | We need net_client_init_from_opts() exported for this 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>
* Don't exit() in config_error()Markus Armbruster2009-10-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* offer right-ctrl as a grab optionDustin Kirkland2009-10-061-0/+4
| | | | | | | | | | | | | | 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>
* Reorganize option rom (+linux kernel) loading.Gerd Hoffmann2009-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Improve error reporting on file accessJustin M. Forbes2009-10-051-10/+10
| | | | | | | | | 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>
* drive cleanup fixes.Gerd Hoffmann2009-10-051-11/+5
| | | | | | | | | | | | | | | | Changes: * drive_uninit() wants a DriveInfo now. * drive_uninit() also calls bdrv_delete(), so callers don't need to do that. * drive_uninit() calls are moved over to the ->exit() callbacks, destroy_bdrvs() is zapped. * setting bdrv->private is not needed any more as the only user (destroy_bdrvs) is gone. * usb-storage needs no drive_uninit, scsi-disk will handle that. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev hotplug: infrastructure and monitor commands.Gerd Hoffmann2009-10-051-0/+2
| | | | | | | | | | | | | | | Adds device_add and device_del commands. device_add accepts accepts the same syntax like the -device command line switch. device_del expects a device id. So you should tag your devices with ids if you want to remove them later on, like this: device_add pci-ohci,id=ohci device_del ohci Unplugging via pci_del or usb_del works too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Enable host-clock-based RTCJan Kiszka2009-10-051-1/+16
| | | | | | | | | | | | | | | Switch RTC emulations to the new host_clock instead of vm_clock by default. This has the advantage that the emulated RTC will follow automatically the host time while it might be tuned via NTP. vm_clock can still be selected by passing '-rtc clock=vm' on the command line. Note that some RTC emulations (at least M48T59) already use the host time unconditionally while others (namely MC146818) do not. This patch introduces the required infrastructure for selecting the base clock but only converts MC146818 for now. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Refactor RTC command line switchesJan Kiszka2009-10-051-35/+76
| | | | | | | | | | Deprecate -localtime, -setdate and -rtc-td-hack in favor of a new unified command line switch: -rtc [base=utc|localtime|date][,driftfix=none|slew] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce QEMU_CLOCK_HOSTJan Kiszka2009-10-051-11/+35
| | | | | | | | | | | | | | | | | | Despite its name QEMU_CLOCK_REALTIME is (normally) not using CLOCK_REALTIME / the host system time as base. In order to allow also non-trivial RTC emulations (MC146818) to follow the host time instead of the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It is unconditionally based on CLOCK_REALTIME, thus will follow system time changes of the host. The only limitation of its current implementation is that pending host_clock timers may not fire early if the host time is pushed forward beyond their expiry. So far no urgent need to overcome this limitation was identified, so it's left as simple as it is (expiry on next alarm timer tick). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* win32: Drop dead dyntick timer codeJan Kiszka2009-10-051-5/+1
| | | | | | | nearest_delta_us is calculated but not used. Drop it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rename QEMU_TIMER_* to QEMU_CLOCK_*Jan Kiszka2009-10-051-21/+21
| | | | | | | | These constants select clocks, not timers. And init_timers initializes clocks. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* do proper cpu_self checkGlauber Costa2009-10-051-2/+7
| | | | | | | | | | | | | | | | Currently, our check for qemu_cpu_self only checks if there is a cpu currently in execution (represented by cpu_single_env being set). While this might be okay for tcg, it is certainly not okay for kvm, since multiple cpus might be executing. Instead, I propose we use pthread primitives to test if the caller thread is the same as env->thread. For tcg, it will have the same semantics as before, since all CPUStates will point to the same thread, and we'll only have one in execution at a time. Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix warning about undefined madvise() on OpenSolarisBlue Swirl2009-10-021-0/+3
| | | | | | | | OpenSolaris headers can't export madvise() with a sane set of #defines. For background, see MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for discussion about Solaris header problems. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-14/+14
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-14/+14
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* Win32: avoid a warningBlue Swirl2009-09-271-4/+4
| | | | | | GetLastError() returns a DWORD. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* vl: Add failure check for SetEventmalc2009-09-271-1/+5
| | | | Signed-off-by: malc <av1474@comtv.ru>
* vl: Do not use perror after failed Win32 API callsmalc2009-09-271-3/+5
| | | | Signed-off-by: malc <av1474@comtv.ru>
* fix -daemonize with kvmMarcelo Tosatti2009-09-261-10/+10
| | | | | | | Otherwise fork might not inherit state initialized by kvm_init(). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Fix coding style issueMark McLoughlin2009-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Replace: if (-1 == foo()) with: if (foo() == -1) While this coding style is not in direct contravention of our currently ratified CODING_STYLE treaty, it could be argued that the Article 3 of the European Convention on Human Rights (prohibiting torture and "inhuman or degrading treatment") reads on the matter. [This commit message was brought to you without humour, as is evidenced by the absence of any emoticons] Signed-off-by: Mark McLoughlin <markmc@redhat.com> Cc: Avi Kivity <avi@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* support media=cdrom for if=noneGerd Hoffmann2009-09-151-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Revert "Open chr device for all serial ports"Aurelien Jarno2009-09-141-9/+7
| | | | This reverts commit 55338f1dd4648d78ee130d83a92f1059ff1f3887.
* Open chr device for all serial portsAurelien Jarno2009-09-141-7/+9
| | | | | | | | | | | Now that labels must be unique, the chr devices can't be opened anymore within the serial port code (in case they are not already opened in vl.c), as they end up with the same label. Instead opened so non-assigned one directly in vl.c, with a different label. This make MIPS Malta board emulation working again. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Fix sys-queue.h conflict for goodBlue Swirl2009-09-121-28/+28
| | | | | | | | | | | | | | | Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Make get_ticks_per_sec() a static inlineAnthony Liguori2009-09-111-14/+6
| | | | | | | | | | | ticks_per_sec is a constant. There's no need to store it as a variable as it never changes since our time is based on units. Convert get_ticks_per_sec() to a static inline and move the constant into qemu-timer.h. Remove all references to QEMU_TIMER_BASE so that we consistently use this interface. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* timers: move them to VMStateJuan Quintela2009-09-111-22/+12
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* timers: Createt TimersState and put all timers state thereJuan Quintela2009-09-111-31/+39
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Unexport ticks_per_sec variable. Create get_ticks_per_sec() functionJuan Quintela2009-09-111-5/+10
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* timers: remove useless checkJuan Quintela2009-09-111-6/+0
| | | | | | | loadvm_state is called from: vl.c during startup, vmstart() is called after finishing loading. The other caller do_loadvm() does the call after a vm_stop(). At both places where we can be saving state we are stoped a few lines before Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ram: Remove SaveVM Version 2 supportJuan Quintela2009-09-111-93/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It don't work. It fails in this check if (qemu_get_be32(f) != last_ram_offset) With 512MB of ram, values were for me: v = 20c00000 last_ram_offset = 20840000 Last time that some code changed that was this one. commit 94a6b54fd6d2d3321066cb4db7abeeb417af9365 Implement dynamic guest ram allocation. (I.e. it has been broken since at least April) Going back to the previous commit, ram load correctly, but vga screen gets corrupted and ide don't load correctly. At this point I decide that removing support is the only viable thing. The last user of the ram_compress_* were RAM_SAVE_FLAG_FULL flag, but that flag was never ever been stored in an image. Mark the flag obsolete and remove the functions. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ram: remove support for loading v1Juan Quintela2009-09-111-42/+0
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* switch chardev to QemuOpts: infrastructure, null deviceGerd Hoffmann2009-09-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | start switching chardevs to QemuOpts. This patch adds the infrastructure and converts the null device. The patch brings two new functions: qemu_chr_open_opts() same as qemu_chr_open(), but uses QemuOpts instead of a option char string. qemu_chr_parse_compat() accepts a traditional chardev option string, returns the corresponding QemuOpts instance, to handle backward compatibility. The patch also adds a new -chardev switch which can be used to create named+unconnected chardevs, like this: -chardev null,id=test This uses the new qemu_chr_open_opts. Thus with this patch alone only the null device works. The other devices will follow ... Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "don't call cpu_sychronize_state from reset handlers"Anthony Liguori2009-09-111-6/+1
| | | | | | This reverts commit 733318ea9c6d846a6a047b87619e7d9d6e9707d1. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* don't call cpu_sychronize_state from reset handlersGlauber Costa2009-09-091-1/+6
| | | | | | | | | Doing this will make the vcpu ioctl be issued from the I/O thread, instead of cpu thread. The correct behaviour is to call it from within the cpu thread, as soon as we are ready to go. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to ↵Dustin Kirkland2009-09-091-10/+10
| | | | | | | | | | | | | | | | | | | | | | | non-accelerated mode qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to non-accelerated mode We're seeing segfaults on systems without access to /dev/kvm. It looks like the global kvm_allowed is being set just a little too late in vl.c. This patch moves the kvm initialization a bit higher in the vl.c main, just after options processing, and solves the segfaults. We're carrying this patch in Ubuntu 9.10 Alpha. Please apply upstream, or advise if and why this might not be the optimal solution. Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Move the kvm_init() call a bit higher to fix a segfault when /dev/kvm is not available. The kvm_allowed global needs to be set correctly a little earlier. Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* mv strdup to qemu_strdup in vl.cJean-Christophe DUBOIS2009-09-091-3/+3
| | | | | | | | | | There are few places in vl.c not using the qemu version of malloc/free/strdup. Fix it. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix vl.c compilation if CONFIG_KVM is not definedJean-Christophe DUBOIS2009-09-091-1/+2
| | | | | | | | | vl.c will not link if CONFIG_KVM is not defined. This patch fixes the problem. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix PATH_MAX conditional compilationJean-Christophe DUBOIS2009-09-091-9/+2
| | | | | | | | | | | PATH_MAX is used elsewhere in the qemu source tree without protection. In addtion the actual code would not compile if PATH_MAX is not defined Last the free() call is wrong as p is not malloc()ed. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/usb: make qemu aware of usb busses.Gerd Hoffmann2009-09-091-118/+36
| | | | | | | | | | | | | | Move usb code from vl.c to usb-bus.c and make it use the new data structures added by qdev conversion. qemu usb core should be able to handle multiple USB busses just fine now (untested though). Kill some usb_*_init() legacy functions, use usb_create_simple() instead. Kill some FIXMEs added by the first qdev/usb patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/usb: add usb bus support to qdev, convert drivers.Gerd Hoffmann2009-09-091-2/+2
| | | | | | | | | | | | | | * Add USBBus. * Add USBDeviceInfo, move device callbacks here. * Add usb-qdev helper functions. * Switch drivers to qdev. TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs added by this patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* allow passing null machine pointer to drive_init().Gerd Hoffmann2009-09-091-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Checks in select_soundhw were never intended to accept abbreviationsmalc2009-09-061-1/+1
| | | | Signed-off-by: malc <av1474@comtv.ru>
* monitor: Port handler_1 to use QDictLuiz Capitulino2009-09-041-5/+6
| | | | | | | | This commit ports command handlers that receive one argument to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Support for multiple -monitor devicesJan Kiszka2009-09-041-16/+46
| | | | | | | | | | | | Rebased version of Anthony's patch: Allow to specify more than one monitor terminal via the -monitor command line switch. This is particularly useful when libvirt or some other management tool already occupies the primary monitor but you need another one for debugging. The current clumsy workaround is to multiplex such additional terminals over a qemu character device (e.g. -serial mon:<device>). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* do not issue ioctl from within the io threadGlauber Costa2009-09-041-1/+1
| | | | | | | | | | According to Documentation/kvm/api.txt, (and well, to common sense), we should not be calling vcpu ioctls from within the iothread. Since vcpu initialization issues a vcpu ioctl, move it a little bit further in time to prevent it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Delay sighandler_setup()Juan Quintela2009-09-041-5/+5
| | | | | | | | | If we are using --serial telnet:0:5555,server or similar, ^C will not kill qemu. We need to first connect using telnet, and the the ^C takes effect. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud