summaryrefslogtreecommitdiffstats
path: root/vl.c
Commit message (Collapse)AuthorAgeFilesLines
* variable timer intervalsStefano Stabellini2009-08-101-1/+1
| | | | | | | | | | | | | | This patch introduces dynamic timer intervals: we slow down the refresh rate when there in no much activity but we get back to a fast refresh rate when the activity resume. Please note that qemu_timer_expired is not an inline function any more because I needed to call it from vnc.c however I don't think this change should have any serious consequence. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* qdev-ify virtio-blk.Gerd Hoffmann2009-08-101-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First user of the new drive property. With this patch applied host and guest config can be specified separately, like this: -drive if=none,id=disk1,file=/path/to/disk.img -device virtio-blk-pci,drive=disk1 You can set any property for virtio-blk-pci now. You can set the pci address via addr=. You can switch the device into 0.10 compat mode using class=0x0180. As this is per device you can have one 0.10 and one 0.11 virtio block device in a single virtual machine. Old syntax continues to work. Internally it does the same as the two lines above though. One side effect this has is a different initialization order, which might result in a different pci address being assigned by default. Long term plan here is to have this working for all block devices, i.e. once all scsi is properly qdev-ified you will be able to do something like this: -drive if=none,id=sda,file=/path/to/disk.img -device lsi,id=lsi,addr=<pciaddr> -device scsi-disk,drive=sda,bus=lsi.0,lun=<n> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* add -drive if=noneGerd Hoffmann2009-08-101-0/+4
| | | | | | | | | | This adds a host drive, but doesn't implicitly add a guest drive for it. First step in splitting host and guest configuration, check the following patches to see how this can be used ... Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* constify drive_get_by_id argGerd Hoffmann2009-08-101-1/+1
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* QemuOpts: switch over -device.Gerd Hoffmann2009-08-101-14/+17
| | | | | | | | | | | Make -device switch use the QemuOpts framework. Everything should continue to work like it did before. New: "-set device.$id.$property=$value" works. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* QemuOpts: add -set optionGerd Hoffmann2009-08-101-0/+4
| | | | | | | | | | | | | | One use case will be file for drives (no filename quoting issues), i.e. -drive id=test,if=virtio -set drive.test.file=/vmdisk/test-virtio.img It will work for any other option (assuming handled by QemuOpts) though. Except for id= for obvious reasons ;). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* QemuOpts: create qemu-config.hGerd Hoffmann2009-08-101-72/+4Star
| | | | | | | | | Move drive option description there. Rename it, give it a qemu_ prefix. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* QemuOpts: make the drive id actually show up in "info block".Gerd Hoffmann2009-08-101-1/+1
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Use qemu_irq for system_powerdownBlue Swirl2009-08-091-2/+5
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* fix migration to obey -SPaolo Bonzini2009-07-301-2/+2
| | | | | | | | | | | | Since migration returns right away, starting the VM right after calling qemu_start_incoming_migration is wrong even if -S is not passed. We have to do this after migration has completed. Cc: Glauber Costa <glommer@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIANJuan Quintela2009-07-271-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename HOST_BSD to CONFIG_BSDJuan Quintela2009-07-271-2/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove special Win32 code in vl.c that's no longer needed.Filip Navara2009-07-271-4/+0Star
| | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32Filip Navara2009-07-271-0/+3
| | | | | | | On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them. Signed-off-by: Filip Navara <filip.navara@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix broken migrationGlauber Costa2009-07-271-1/+3
| | | | | | | | | | | | | | | | While fixing migration with -S, commit 89befdd1a6b18215153b8976682d57b7d03d5782 broke the rest of us. Poor glommer, with a poor family, spare him his life from this monstruosity. Since the unconditional vm_start, not autostart was the villain, I'm putting back autostart. Let me know if you prefer other solutions, it doesn't really matter, doesn't really matter to me. Any way the wind blows... Signed-off-by: Glauber Costa <glommer@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce -smp , maxcpus= flag to specify maximum number of CPUS.Jes Sorensen2009-07-271-1/+26
| | | | | | | | Follow on patch will use it to determine the size of the MADT and other BIOS tables. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* switch -drive to QemuOpts.Gerd Hoffmann2009-07-271-139/+169
| | | | | | | | | | | Demo QemuOpts in action ;) Implementing a alternative way to specify the filename should be just a few lines of code now once we decided how the cmd line syntax should look like. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* move parser functions from vl.c to qemu-option.cGerd Hoffmann2009-07-271-64/+0Star
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kill drives_optGerd Hoffmann2009-07-271-53/+27Star
| | | | | | | | | cleanup pretty simliar to the drives_table removal patch: - drop the table and make a linked list out of it. - pass around struct pointers instead of table indices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add support for drive ids.Gerd Hoffmann2009-07-271-18/+32
| | | | | | | | | | | | | -drive accepts the new id= now, allowing to explicitely name your drives. They will show up with that name in "info block" if specified, otherwise the existing namimg scheme is used to autogenerate one. There is also a new function to lookup drives by name. Not used yet. The plan is to link disk drivers and drives using the drive id instead of passing around pointers to BlockDriveState. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kill drives_tableGerd Hoffmann2009-07-271-90/+87Star
| | | | | | | | | | | | | | First step cleaning up the drives handling. This one does nothing but removing drives_table[], still it became seriously big. drive_get_index() is gone and is replaced by drives_get() which hands out DriveInfo pointers instead of a table index. This needs adaption in *tons* of places all over. The drives are now maintained as linked list. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add -device command line option.Gerd Hoffmann2009-07-271-33/+64
| | | | | | | | | | | The -device switch is the users frontend to the qdev_device_add function added by the previous patch. Also adds a linked list where command line options can be saved. Use it for the new -device and for the -usbdevice and -bt switches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add machine type aliasesMark McLoughlin2009-07-271-0/+5
| | | | | | | | | | | | | | | Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix. Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future. This is intended to mimic a symlink to a machine description file. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix OpenBSD buildBlue Swirl2009-07-171-0/+2
| | | | | | | The header sys-queue.h must be #included early, otherwise at some point OS queue macros will be used. On OpenBSD, those don't define TAILQ_FOREACH_SAFE. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qdev/compat: compat property infrastructure.Gerd Hoffmann2009-07-171-0/+3
| | | | | | | | | | This add support for switching devices into a compatibility mode using device properties. Machine types can have a list of properties for specific devices attached to allow the easy creation of machine types compatible to older qemu versions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* honor -S on incoming migrationPaolo Bonzini2009-07-171-3/+1Star
| | | | | | | | | | | | | | | | | | | | -S is not honored by qemu on incoming migration. If a domain is migrated while paused, thus, it will start running on the remote machine; this is wrong. Given the trivial patch to fix this, it looks more like a thinko than anything else, probably dating back to the qemu-kvm merge. The interesting part is that the -S mechanism was in fact *used* when migrating (setting autostart = 0) and the incoming migration code was starting the VM at the end of the migration. Since I was removing the vm_start from there, I also corrected a related imprecision. The code was doing a vm_stop "just in case", but we can be sure that the VM is not running---the vm_start call in vl.c has not been reached yet. So the vm_stop is removed together with the vm_start. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add boot menu control via command line switchJan Kiszka2009-07-161-1/+15
| | | | | | | | Disable the lengthy BIOS prompt for selecting a boot device by default, but let the user reenable it via '-boot menu=on'. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add boot-once supportJan Kiszka2009-07-161-1/+22
| | | | | | | | | | This allows to specify an exceptional boot order only for the first startup of the guest. After reboot, qemu will switch back to the default order (or what was specified via 'order='). Makes installing from CD images and then booting the freshly set up harddisk more handy. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add qemu_unregister_resetJan Kiszka2009-07-161-2/+15
| | | | | | | | Will be used by '-boot once=...', and should also help in other use cases. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rework reset handler managementJan Kiszka2009-07-161-10/+6Star
| | | | | | | Convert the reset handler maintenance code to TAILQ services. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Move boot_set callback backendJan Kiszka2009-07-161-0/+17
| | | | | | | | Move registration function for the boot_set callback handler and provide qemu_boot_set so that it can also be used outside the monitor code. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rework -boot optionJan Kiszka2009-07-161-31/+50
| | | | | | | | | | | | | | This patch changes the boot command line option to the canonical format -boot [order=drives][,...] where 'drives' is using the same format as the old -boot. The format switch allows to add the 'menu' and 'once' options in later patches. The old format is still understood and will be processed at least for a transition time. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Disable kqemu by default at run timeAnthony Liguori2009-07-101-2/+2
| | | | | | | | -no-kqemu -> -enable-kqemu kqemu is still present at compile time by default Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Allow setting qemu process name v2Andi Kleen2009-07-091-1/+28
| | | | | | | | | | | | | Set the Linux process name to the name argument specified with name. I find this useful to see which guests are taking CPU time in top. This doesn't affect ps, which checks argv[0], but rewriting the environment uses much more code, so I only used this simple way. v2: Use separate process= argument, no prefixes. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* split out ioport related stuffs from vl.c into ioport.c.Isaku Yamahata2009-07-091-226/+0Star
| | | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qcow2: Make cache=writethrough defaultKevin Wolf2009-07-091-3/+1Star
| | | | | | | | | The performance of qcow2 has improved meanwhile, so we don't need to special-case it any more. Switch the default to write-through caching like all other block drivers. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Replace -no-virtio-balloon by -balloonMarkus Armbruster2009-06-291-3/+30
| | | | | | | | | | | | | | | | We want to do (at least) two things to the virtio-balloon device: suppress it, and control its PCI address. Option -no-virtio-balloon lets us do only the former. To get the latter, replace -no-virtio-balloon with -balloon none disable balloon device -balloon virtio[,addr=str] enable virtio balloon device (default) Syntax suggested by Anthony Liguori. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Introduce reset notifier order"Jan Kiszka2009-06-291-5/+2Star
| | | | | | | | | This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and updates later added users of qemu_register_reset), we solved the problem it originally addressed less invasively. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kvm: Rework VCPU synchronizationJan Kiszka2009-06-291-11/+0Star
| | | | | | | | | | | | | | | During startup and after reset we have to synchronize user space to the in-kernel KVM state. Namely, we need to transfer the VCPU registers when they change due to VCPU as well as APIC reset. This patch refactors the required hooks so that kvm_init_vcpu registers its own per-VCPU reset handler and adds a cpu_synchronize_state to the APIC reset. That way we no longer depend on the new reset order (and can drop this disliked interface again) and we can even drop a KVM hook in main(). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* slirp: Kill slirp_is_initedJan Kiszka2009-06-291-18/+5Star
| | | | | | | | | Avoid the need for slirp_is_inited by refactoring the protected slirp_select_* functions. This also avoids the clearing of all fd sets on select errors. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* slirp: Rework monitor commands for host forwardingJan Kiszka2009-06-291-1/+1
| | | | | | | | | | | Improve the monitor interface for adding and removing host forwarding rules by splitting it up in two commands and rename them to hostfwd_add and hostfwd_remove. Also split up the paths taken for legacy -redir support and the monitor add command as the latter will be extended later on. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* slirp: Move smb, redir, tftp and bootp parameters and -net channelJan Kiszka2009-06-291-3/+3
| | | | | | | | | | | | | | | | | So far a couple of slirp-related parameters were expressed via stand-alone command line options. This it inconsistent and unintuitive. Moreover, it prevents both dynamically reconfigured (host_net_add/ delete) and multi-instance slirp. This patch refactors the configuration by turning -smb, -redir, -tftp and -bootp as well as -net channel into options of "-net user". The old stand-alone command line options are still processed, but no longer advertised. This allows smooth migration of management applications to to the new syntax and also the extension of that syntax later in this series. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce get_next_param_valueJan Kiszka2009-06-291-4/+13
| | | | | | | | | In order to parse multiple instances of the same param=value pair, introduce get_next_param_value which can pass back to string parsing position after reading a parameter value. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make sure to zero out memory before calling madvise to increase robustnessAnthony Liguori2009-06-241-3/+3
| | | | | | | Avi pointed out that it's not entirely safe to rely on madvise zeroing out memory. So let's do it explicitly before calling madvise. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Win32: Fix compilation with SDL.Stefan Weil2009-06-221-2/+2
| | | | | | | | | | | | | | | | `sdl-config --cflags` defines main = SDL_main on some platforms. One of these platforms is Windows with mingw32. For those platforms, the solution already developed for __APPLE__ is now applied. A compiler warning (missing return value) is fixed, too. Maybe __APPLE__ no longer needs a separate check. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Support addr=... in option argument of -drive if=virtioMarkus Armbruster2009-06-221-1/+13
| | | | | | | | | | | | | Make drive_init() accept addr=, put the value into struct DriveInfo. Use it in all the places that create virtio-blk-pci devices: pc_init1(), bamboo_init(), mpc8544ds_init(). Don't support addr= in third argument of monitor command pci_add and second argument of drive_add, because that clashes with their first arguments. Admittedly unelegant. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Instead of writing a zero page, madvise it awayAnthony Liguori2009-06-221-0/+6
| | | | | | | Otherwise, after migration, we end up with a much larger RSS size then we ought to have. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make nic option rom loading less painful.Glauber Costa2009-06-221-35/+4Star
| | | | | | | | | | | | | | | | | | The code how it is today, is totally painful to read and keep. To begin with, the code is duplicated with the option rom loading code that linux_boot and vga are already using. This patch introduces a "bootable" state in NICInfo structure, that we can use to keep track of whether or not a given nic should be bootable, avoiding the introduction of yet another global state. With that in hands, we move the code in vl.c to hw/pc.c, and use the already existing infra structure to load those option roms. Error checking code suggested by Mark McLoughlin Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add non-arbitrary migration stop conditionGlauber Costa2009-06-161-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we're entering migration's stage 3 when a treshold of 10 pages remain to be transferred in the system. This has hurt some users. However, any proposed threshold is arbitrary by nature, and would only shift the annoyance. The proposal of this patch is to define a max_downtime variable, which represents the maximum downtime a migration user is willing to suffer. Then, based on the bandwidth of last iteration, we calculate how much data we can transfer in such a window of time. Whenever we reach that value (or lower), we know is safe to enter stage3. This has largely improved the situation for me. On localhost migrations, where one would expect things to go as quickly as me running away from the duty of writting software for windows, a kernel compile was enough to get the migration stuck. It takes 20 ~ 30 iterations now. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove dead codeAmit Shah2009-06-161-6/+0Star
| | | | | | | | vl.c contains some dead code that initialises a 'label' string with the name of the char device being initialised. This is unused. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>