summaryrefslogtreecommitdiff
path: root/vl.c
AgeCommit message (Collapse)AuthorFilesLines
2012-02-01main-loop: For tools, initialize timers as part of qemu_init_main_loop()Michael Roth1-0/+5
In some cases initializing the alarm timers can lead to non-negligable overhead from programs that link against qemu-tool.o. At least, setting a max-resolution WinMM alarm timer via mm_start_timer() (the current default for Windows) can increase the "tick rate" on Windows OSs and affect frequency scaling, and in the case of tools that run in guest OSs such has qemu-ga, the impact can be fairly dramatic (+20%/20% user/sys time on a core 2 processor was observed from an idle Windows XP guest). This patch doesn't address the issue directly (not sure what a good solution would be for Windows, or what other situations it might be noticeable), but it at least limits the scope of the issue to programs that "opt-in" to using the main-loop.c functions by only enabling alarm timers when qemu_init_main_loop() is called, which is already required to make use of those facilities, so existing users shouldn't be affected. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01Improve default machine options usabilityJan Kiszka1-15/+2
So far we overwrite the machine options completely with defaults if no accel=value is provided. More user friendly is to fill in only unspecified options. The new qemu_opts_set_defaults enables this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01mc146818rtc: Use lost_tick_policy propertyJan Kiszka1-5/+23
Allow to configure the MC146818 RTC via the new lost tick policy property and replace rtc_td_hack with this mechanism. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-25vga: fix -nodefaults -device VGABlue Swirl1-0/+1
Flag -nodefaults should also imply no VGA. This was broken in a369da5f31ddbdeb32a7f76622e480d3995fbb00. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-23Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-1/+0
* qemu-kvm/uq/master: kvm: Activate in-kernel irqchip support kvm: x86: Add user space part for in-kernel IOAPIC kvm: x86: Add user space part for in-kernel i8259 kvm: x86: Add user space part for in-kernel APIC kvm: x86: Establish IRQ0 override control kvm: Introduce core services for in-kernel irqchip support memory: Introduce memory_region_init_reservation ioapic: Factor out base class for KVM reuse ioapic: Drop post-load irr initialization i8259: Factor out base class for KVM reuse i8259: Completely privatize PicState apic: Open-code timer save/restore apic: Factor out base class for KVM reuse apic: Introduce apic_report_irq_delivered apic: Inject external NMI events via LINT1 apic: Stop timer on reset kvm: Move kvmclock into hw/kvm folder msi: Generalize msix_supported to msi_supported hyper-v: initialize Hyper-V CPUID leaves. hyper-v: introduce Hyper-V support infrastructure. Conflicts: Makefile.target Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-22vga: improve VGA logicBlue Swirl1-17/+45
Improve VGA selection logic, push check for device availabilty to vl.c. Create the devices at board level unconditionally. Remove now unused pci_try_create*() functions. Make PCI VGA devices optional. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-19kvm: x86: Establish IRQ0 override controlJan Kiszka1-1/+0
KVM is forced to disable the IRQ0 override when we run with in-kernel irqchip but without IRQ routing support of the kernel. Set the fwcfg value correspondingly. This aligns us with qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-04hw/9pfs: Add support to use named socket for proxy FSM. Mohan Kumar1-1/+5
Add option to use named socket for communicating between proxy helper and qemu proxy FS. Access to socket can be given by using command line options -u and -g. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-04hw/9pfs: Add new proxy filesystem driverM. Mohan Kumar1-1/+5
Add new proxy filesystem driver to add root privilege to qemu process. It needs a helper process to be started by root user. Following command line can be used to utilize proxy filesystem driver -virtfs proxy,id=<id>,mount_tag=<tag>,socket_fd=<socket-fd> Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-04hw/9pfs: Move opt validation to FsDriver callbackAneesh Kumar K.V1-6/+2
This remove all conditional code from common code path and make opt validation a FSDriver callback. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-12-22Set numa topology for max_cpusVasilis Liaskovitis1-1/+1
qemu-kvm passes numa/SRAT topology information for smp_cpus to SeaBIOS. However SeaBIOS always expects to setup max_cpus number of SRAT cpu entries (MaxCountCPUs variable in build_srat function of Seabios). When qemu-kvm runs with smp_cpus != max_cpus (e.g. -smp 2,maxcpus=4), Seabios will mistakenly use memory SRAT info for setting up CPU SRAT entries for the offline CPUs. Wrong SRAT memory entries are also created. This breaks NUMA in a guest. Fix by setting up SRAT info for max_cpus in qemu-kvm. Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-20g_thread_init users: don't call it if glib >= 2.31Alon Levy1-0/+5
since commit f9b29ca03 included in release 2.31 (docs below say 2.32 but that is not correct) and onwards g_thread_init is deprecated and calling it is not required: http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init g_thread_init has been deprecated since version 2.32 and should not be used in newly-written code. This function is no longer necessary. The GLib threading system is automatically initialized at the start of your program. Fixes bulid failure when warnings are treated as errors on fedora 17. I only tested the change to vl.c, and copy pasted to the two other locations (couldn't decide if a wrapper for calling g_thread_init is uglier). Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19qdev: fix hotplug when no -device is specifiedAnthony Liguori1-0/+2
The peripheral[-anon] containers are initialized lazily but since they sit on sysbus, they can not be created after realize. This was causing an abort() to occur during hotplug if no -device option was used. This was spotted by qemu-test::device-add.sh Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19vl.c: In qemu -h output, only print options for the arch we are running asMichael Ellerman1-12/+9
Only print options in the help output that are accepted by our arch. This is less confusing for users and also for other programs that consume the help output. The options affected are: -g and -prom-env only displayed on PPC or SPARC -win2k-hack, -rtc-td-hack, -no-fd-bootchk, -no-acpi, -no-hpet, -acpitable, -smbios only displayed on i386 -semihosting only displayed on ARM, M68K or XTENSA -old-param only displayed on ARM Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19vl.c: Move option generation logic into a wrapper fileMichael Ellerman1-14/+4
In vl.c and qemu-options.h we define macros and include qemu-options.def in order to generate different content. Move the bulk of the def'ing and undef'ing into a wrapper, this will make it cleaner when we add another macro in the next patch. AFAICS undefining GEN_DOCS services no purpose, but I've left it for now. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15vl.c: Print the actual program name in help outputmichael@ozlabs.org1-1/+1
In help() we do what boils down to: printf("%s", "qemu"); This seems to be an artifact of be995c27640a82c7056b6f53d02ec823570114e5 ("removed unused code"), which removed some ifdef'ery that used to print a different name depending on CONFIG_SOFTMMU. Instead print the actual program name, originally from argv[0]. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-02fix spelling in main directoryDong Xu Wang1-1/+1
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-28vl: Tighten parsing of -m argumentMarkus Armbruster1-2/+3
strtosz_suffix() fails unless the size is followed by 0, whitespace or ','. Useless here, because we need to fail for any junk following the size, even if it starts with whitespace or ','. Check manually. Things like "-m 1024," are now caught. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28vl: Tighten parsing of -numa's parameter memMarkus Armbruster1-2/+2
strtosz_suffix() fails unless the size is followed by 0, whitespace or ','. Useless here, because we need to fail for any junk following the size, even if it starts with whitespace or ','. Check manually. Things like -smp 4 -numa "node,mem=1024,cpus=0-1" -numa "node,mem=1024 cpus=2-3" are now caught. Before, the second -numa's argument was silently interpreted as just "node,mem=1024". Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11vl.c: prohibit simultaneous use of -icount with kvm or xenMax Filippov1-0/+5
With -icount, The vm_clock is updated with help from TCG (it counts instructions at 2^ICOUNT ns/instructions). With KVM, the instruction count is not available so KVM cannot provide this help. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11vl.c: Fail gracefully if no machine is foundAndreas Färber1-0/+5
machine defaults to find_default_machine(), then gets overridden via -M and machine_parse(). If no -M is specified and find_default_machine() returns NULL (when no machine compiled in), exit with an error. Avoids a segfault when setting machine->max_cpus. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09Clean up assertion in get_boot_devices_list()Markus Armbruster1-1/+1
g_strdup() can't fail, remove assertion. Assert its argument can't be null, because that's not obvious (add_boot_device_path() ensures it). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-07qemu_timedate_diff() shouldn't modify its argument.Gleb Natapov1-2/+5
The caller of qemu_timedate_diff() does not expect that tm it passes to the function will be modified, but mktime() is destructive and modifies its argument. Pass a copy of tm to it and set tm_isdst so that mktime() will not rely on it since its value may be outdated. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01vl.c: Guard against GThread double-initializationAndreas Färber1-1/+3
GThread-ERROR **: GThread system may only be initialized once. aborting... Making the g_thread_init() call in vl.c conditional resolves an abort on Mac OS X, where coroutine-gthread.c seems to call it before vl.c. Reported-by: Juan Pineda <juan@logician.com> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Cc: Daniel P. Berrange <berrange@redhat.com>
2011-10-31Merge remote-tracking branch 'aneesh/for-upstream-7' into stagingAnthony Liguori1-0/+20
2011-10-31hw/9pfs: Add synthetic file system support using 9pAneesh Kumar K.V1-0/+18
This patch create a synthetic file system with mount tag v_synth when -virtfs_synth command line option is specified in qemu. The synthetic file system can be mounted in guest using 9p using the below command line mount -t 9p -oversion=9p2000.L,trans=virtio v_synth <mountpint> Synthetic file system enabled different qemu subsystem to register callbacks for read and write events from guest. The subsystem can create directories and files in the synthetic file system as show in ex below qemu_v9fs_synth_mkdir(NULL, 0777, "test2", &node); qemu_v9fs_synth_add_file(node, 0777, "testfile", my_test_read, NULL, NULL); Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31hw/9pfs: Read-only support for 9p exportM. Mohan Kumar1-0/+2
A new fsdev parameter "readonly" is introduced to control accessing 9p export. "readonly" can be used to specify the access type. By default "rw" access is given to 9p export. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-27Drop qemu-objects.h from modules that don't require itLuiz Capitulino1-1/+1
Previous commits dropped most qobjects usage from qemu modules (now they are a low level interface used by the QAPI). However, some modules still include the qemu-objects.h header file. This commit drops qemu-objects.h from some of those modules and includes qjson.h instead, which is what they actually need. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-21simplify main loop functionsPaolo Bonzini1-38/+41
Provide a clean example of how to use the main loop in the tools. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21main-loop: create main-loop.cPaolo Bonzini1-122/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21main-loop: create main-loop.hPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21qemu-timer: move more stuff out of qemu-timer.cPaolo Bonzini1-0/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21qemu-timer: use atexit for quit_timersPaolo Bonzini1-1/+0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-20Merge remote-tracking branch 'aneesh/for-upstream-6' into stagingAnthony Liguori1-7/+17
Conflicts: trace-events
2011-10-19runstate: Allow user to migrate twiceLuiz Capitulino1-2/+7
It should be a matter of allowing the transition POSTMIGRATE -> FINISH_MIGRATE, but it turns out that the VM won't do the transition the second time because it's already stopped. So this commit also adds vm_stop_force_state() which performs the transition even if the VM is already stopped. While there also allow other states to migrate. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-19runstate: Allow to transition from paused to postmigrateLuiz Capitulino1-0/+1
The user may already have paused the VM before starting the migration process. If s/he does that, then the state will be 'paused' when we finish the migration process. In that case we want to transition from 'paused' to 'postmigrate' as the latter is now the real reason why the VM is stopped. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-19runstate: Print state transition when invalidLuiz Capitulino1-3/+6
Makes it easier to debug. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-15Drop obsolete nographic timerJan Kiszka1-13/+0
We flush coalesced MMIO in the device models now, and VNC - for which this was once introduced - is also fine without it as it has its own refresh timer. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-15Move graphic-related coalesced MMIO flushes to affected device modelsJan Kiszka1-2/+0
This is conceptually cleaner and will allow us to drop the nographic timer. Moreover, it will be mandatory to fully exploit future per-device coalesced MMIO rings. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-15hw/9pfs: Handle Security model parsingM. Mohan Kumar1-4/+2
Except local fs driver all other fs drivers (handle, synth) don't need security model. Update fsdev parameter parsing accordingly. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-15hw/9pfs: Rename fstype to fsdriver to make it consistent across VirtFS codeAneesh Kumar K.V1-3/+3
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-12hw/9pfs: Add new virtfs option writeout=immediate skip host page cacheAneesh Kumar K.V1-0/+12
writeout=immediate implies the after pwritev we do a sync_file_range. Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-04qapi: Convert query-statusLuiz Capitulino1-21/+11
Please, note that the RunState type as defined in sysemu.h and its runstate_as_string() function are being dropped in favor of the RunState type generated by the QAPI. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04RunState: Rename enum values as generated by the QAPILuiz Capitulino1-59/+59
Next commit will convert the query-status command to use the RunState type as generated by the QAPI. In order to "transparently" replace the current enum by the QAPI one, we have to make some changes to some enum values. As the changes are simple renames, I'll do them in one shot. The changes are: - Rename the prefix from RSTATE_ to RUN_STATE_ - RUN_STATE_SAVEVM to RUN_STATE_SAVE_VM - RUN_STATE_IN_MIGRATE to RUN_STATE_INMIGRATE - RUN_STATE_PANICKED to RUN_STATE_INTERNAL_ERROR - RUN_STATE_POST_MIGRATE to RUN_STATE_POSTMIGRATE - RUN_STATE_PRE_LAUNCH to RUN_STATE_PRELAUNCH - RUN_STATE_PRE_MIGRATE to RUN_STATE_PREMIGRATE - RUN_STATE_RESTORE to RUN_STATE_RESTORE_VM - RUN_STATE_PRE_MIGRATE to RUN_STATE_FINISH_MIGRATE Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04RunState: Drop the RSTATE_NO_STATE valueLuiz Capitulino1-12/+7
The QAPI framework won't generate it, so we need to get rid of it. In order to do that, this commit makes RSTATE_PRE_LAUNCH the initial state and change qemu_vmstop_requested() to use RSTATE_MAX. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04vl: Change qemu_vmstop_requested() to return a boolLuiz Capitulino1-6/+10
The stop reason is returned in the RunState argument. This is a preparation for a future commit which will convert the query-status command to the QAPI. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-20Merge remote-tracking branch 'qmp/queue/qmp' into stagingAnthony Liguori1-18/+138
2011-09-16Fix termination by signal with -no-shutdownKevin Wolf1-0/+1
On signals such as SIGTERM qemu should exit instead of just stopping the VM even with -no-shutdown. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-15QMP: query-status: Introduce 'status' keyLuiz Capitulino1-0/+23
This new key reports the current VM status to clients. Please, check the documentation being added in this commit for more details. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Monitor/QMP: Don't allow cont on bad VM stateLuiz Capitulino1-0/+4
We have two states where issuing cont before system_reset can cause problems: RSTATE_SHUTDOWN (when -no-shutdown is used) and RSTATE_PANICKED (which only happens with kvm). This commit fixes that by doing the following when state is RSTATE_SHUTDOWN or RSTATE_PANICKED: 1. returning an error to the user/client if cont is issued 2. automatically transition to RSTATE_PAUSED during system_reset Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>