summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-08-22aio / timers: Add QEMUTimerListGroup and helper functionsAlex Bligh3-0/+92
Add QEMUTimerListGroup and helper functions, to represent a QEMUTimerList associated with each clock. Add a default QEMUTimerListGroup representing the default timer lists which are not associated with any other object (e.g. an AioContext as added by future patches). Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Untangle include filesAlex Bligh36-4/+39
include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Split QEMUClock into QEMUClock and QEMUTimerListAlex Bligh2-79/+476
Split QEMUClock into QEMUClock and QEMUTimerList so that we can have more than one QEMUTimerList associated with the same clock. Introduce a main_loop_timerlist concept and make existing qemu_clock_* calls that actually should operate on a QEMUTimerList call the relevant QEMUTimerList implementations, using the clock's default timerlist. This vastly reduces the invasiveness of this change and means the API stays constant for existing users. Introduce a list of QEMUTimerLists associated with each clock so that reenabling the clock can cause all the notifiers to be called. Note the code to do the notifications is added in a later patch. Switch QEMUClockType to an enum. Remove global variables vm_clock, host_clock and rt_clock and add compatibility defines. Do not fix qemu_next_alarm_deadline as it's going to be deleted. Add qemu_clock_use_for_deadline to indicate whether a particular clock should be used for deadline calculations. When use_icount is true, vm_clock should not be used for deadline calculations as it does not contain a nanosecond count. Instead, icount timeouts come from the execution thread doing aio_notify or qemu_notify as appropriate. This function is used in the next patch. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Make qemu_run_timers and qemu_run_all_timers return progressAlex Bligh2-8/+31
Make qemu_run_timers and qemu_run_all_timers return progress so that aio_poll etc. can determine whether a timer has been run. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slackAlex Bligh2-0/+25
Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer calls. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: add ppoll support with qemu_poll_nsAlex Bligh3-0/+55
Add qemu_poll_ns which works like g_poll but takes a nanosecond timeout. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22MAINTAINERS: Take over 0.15 maintenanceAndreas Färber1-1/+2
SUSE is shipping qemu-kvm 0.15.1 with SLES 11 SP2 so we will be actively tracking all KVM-related issues. Therefore upgrade to Supported. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-08-22Merge remote-tracking branch 'luiz/queue/qmp' into stagingAnthony Liguori16-52/+486
# By Laszlo Ersek (8) and others # Via Luiz Capitulino * luiz/queue/qmp: scripts/qapi.py: Avoid syntax not supported by Python 2.4 monitor: print the invalid char in error message OptsVisitor: introduce unit tests, with test cases for range flattening add "test-int128" and "test-bitops" to .gitignore OptsVisitor: don't try to flatten overlong integer ranges OptsVisitor: opts_type_uint64(): recognize intervals when LM_IN_PROGRESS OptsVisitor: rebase opts_type_uint64() to parse_uint_full() OptsVisitor: opts_type_int(): recognize intervals when LM_IN_PROGRESS OptsVisitor: introduce list modes for interval flattening OptsVisitor: introduce basic list modes Convert stderr message calling error_get_pretty() to error_report() Message-id: 1377015041-6567-1-git-send-email-lcapitulino@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-22Merge remote-tracking branch 'jliu/or32' into stagingAnthony Liguori2-11/+9
# By Jia Liu # Via Jia Liu * jliu/or32: hw/openrisc: Avoid undefined shift in openrisc_pic_cpu_handler() hw/openrisc: Fix masking in openrisc_pic_cpu_handler() hw/openrisc: Avoid using uninitialised variable 'entry' Message-id: 1377050811-11116-1-git-send-email-proljc@gmail.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-22aio / timers: Consistent treatment of disabled clocks for deadlinesAlex Bligh1-1/+1
Make treatment of disabled clocks consistent in deadline calculation Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: add qemu-timer.c utility functionsAlex Bligh2-0/+92
Add utility functions to qemu-timer.c for nanosecond timing. Add qemu_clock_deadline_ns to calculate deadlines to nanosecond accuracy. Add utility function qemu_soonest_timeout to calculate soonest deadline. Add qemu_timeout_ns_to_ms to convert a timeout in nanoseconds back to milliseconds for when ppoll is not used. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Rename qemu_new_clock and expose clock typesAlex Bligh2-8/+8
Rename qemu_new_clock to qemu_clock_new. Expose clock types. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Rename qemu_timer_* functionsAlex Bligh10-27/+27
Rename four functions in preparation for new API. Rename qemu_timer_expired to timer_expired Rename qemu_timer_expire_time_ns to timer_expire_time_ns Rename qemu_timer_pending to timer_pending Rename qemu_timer_expired_ns to timer_expired_ns Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22vmdk: support vmfs filesPaolo Bonzini1-2/+3
VMware ESX hosts also use different create and extent types for flat files, respectively "vmfs" and "VMFS". This is not documented, but it can be found at http://kb.vmware.com/kb/10002511 (Recreating a missing virtual machine disk (VMDK) descriptor file). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22vmdk: support vmfsSparse filesFam Zheng1-8/+9
VMware ESX hosts use a variant of the VMDK3 format, identified by the vmfsSparse create type ad the VMFSSPARSE extent type. It has 16 KB grain tables (L2) and a variable-size grain directory (L1). In addition, the grain size is always 512, but that is not a problem because it is included in the header. The format of the extents is documented in the VMDK spec. The format of the descriptor file is not documented precisely, but it can be found at http://kb.vmware.com/kb/10026353 (Recreating a missing virtual machine disk (VMDK) descriptor file for delta disks). With these patches, vmfsSparse files only work if opened through the descriptor file. Data files without descriptor files, as far as I could understand, are not supported by ESX. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> -- v2: Rebase to patch 01. Change le64_to_cpu to le32_to_cpu. Rename vmdk_open_vmdk3 to vmdk_open_vmfs_sparse, which represents the current usage of this format. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22vmdk: fix L1 and L2 table size in vmdk3 openFam Zheng1-8/+8
VMDK3 header has the field l1dir_size, but vmdk_open_vmdk3 hardcoded the value. This patch honors the header field. And the L2 table size is 4096 according to VMDK spec[1], instead of 1 << 9 (512). [1]: http://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf?src=vmdk Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22vmdk: Move l1_size check into vmdk_add_extent()Fam Zheng1-8/+8
This header check is common to VMDK3 and VMDK4, so move it into vmdk_add_extent(). Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22block: better error message for read only format nameFam Zheng1-1/+5
When user tries to use read-only whitelist format in the command line option, failure message was "'foo' invalid format". It might be invalid only for writable, but valid for read-only, so it is confusing. Give the user easier to understand information. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22block: Produce zeros when protocols reading beyond end of fileMORITA Kazutaka1-1/+29
While Asias is debugging an issue creating qcow2 images on top of non-file protocols. It boils down to this example using NBD: $ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512' Notice the open -g option to set bs->growable. This means you can read/write beyond end of file. Reading beyond end of file is supposed to produce zeroes. We rely on this behavior in qcow2_create2() during qcow2 image creation. We create a new file and then write the qcow2 header structure using bdrv_pwrite(). Since QCowHeader is not a multiple of sector size, block.c first uses bdrv_read() on the empty file to fetch the first sector (should be all zeroes). Here is the output from the qemu-io NBD example above: $ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512' 00000000: ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ................ 00000010: ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ................ 00000020: ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ................ ... We are not zeroing the buffer! As a result qcow2 image creation on top of protocols is not guaranteed to work even when file creation is supported by the protocol. [Adapted this patch to use bs->zero_beyond_eof. -- Stefan] Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22block: Introduce bs->zero_beyond_eofAsias He3-0/+8
In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when protocols reading beyond end of file), we break qemu-iotests ./check -qcow2 022. This happens because qcow2 temporarily sets ->growable = 1 for vmstate accesses (which are stored beyond the end of regular image data). We introduce the bs->zero_beyond_eof to allow qcow2_load_vmstate() to disable ->zero_beyond_eof temporarily in addition to enable ->growable. [Since the broken patch "block: Produce zeros when protocols reading beyond end of file" has not been merged yet, I have applied this fix *first* and will then apply the next patch to keep the tree bisectable. -- Stefan] Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-21pc_piix: Kill pc_init1() memory region argsEduardo Habkost1-5/+5
All callers always use the same values (get_system_memory(), get_system_io()), so the parameters are pointless. If one day we decide to eliminate get_system_memory() and get_system_io(), we will be able to do that more easily by adding the values to struct QEMUMachineInitArgs. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21pc: pc_compat_1_4() now can call pc_compat_1_5()Eduardo Habkost2-4/+4
It just needs to set has_pvpanic=false after calling it. This way, it won't be a special case anymore. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21pc: Create pc_compat_*() functionsEduardo Habkost2-18/+65
Making the older compat functions call the newer compat functions at the beginning allows the older functions undo what's done by newer compat functions. e.g.: pc_compat_1_4() will be able to call pc_compat_1_5() and then set has_pvpanic=false. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21pc: Kill pc_init_pci_1_0()Eduardo Habkost1-10/+4
The pc_init_pci_1_2()/pc_init_pci_1_0() split was made on commit 6fd028f64f662c801fd5a54d0e3a1d2baeee93ea, in preparation for commit 9953f8822cc316eec9962f0a2858c3439a80adec. The latter was reverted, so there's no reason to keep two separate functions that do exactly the same, anymore. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21pc: Don't explode QEMUMachineInitArgs into local variables needlesslyMarkus Armbruster1-13/+9
Don't explode when the variable is used just a few times, and never changed. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21pc: Don't prematurely explode QEMUMachineInitArgsMarkus Armbruster1-49/+16
Don't explode QEMUMachineInitArgs before passing it to pc_init1(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21ppc: Don't duplicate QEMUMachineInitArgs in PPCE500ParamsMarkus Armbruster4-41/+23
Pass on the generic arguments unadulterated, and the machine-specific ones as separate argument. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21ppc: Don't explode QEMUMachineInitArgs into local variables needlesslyMarkus Armbruster2-24/+12
Don't explode when the variable is used just once, and never changed. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21sun4: Don't prematurely explode QEMUMachineInitArgsMarkus Armbruster2-125/+40
Don't explode QEMUMachineInitArgs before passing it to sun4m_hw_init(), sun4uv_init(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21qcow2: Change default for new images to compat=1.1Kevin Wolf1-1/+1
By the time that qemu 1.7 will be released, enough time will have passed since qemu 1.1, which is the first version to understand version 3 images, that changing the default shouldn't hurt many people any more and the benefits of using the new format outweigh the pain. qemu-iotests already runs with compat=1.1 by default. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-21q35: Add PCIe switch to example q35 configurationAlex Williamson1-0/+23
Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-21hw/openrisc: Avoid undefined shift in openrisc_pic_cpu_handler()Jia Liu1-1/+3
In C99 signed shift (1 << 31) is undefined behavior, since the result exceeds INT_MAX. Use 1U instead and move the shift after the check. Signed-off-by: Xi Wang <xi.wang@gmail.com> Acked-by: Jia Liu <proljc@gmail.com>
2013-08-21hw/openrisc: Fix masking in openrisc_pic_cpu_handler()Jia Liu1-8/+5
Consider the masking of PICSR and PICMR: ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) To correctly mask bits, we should use the bitwise AND "&" rather than the logical AND "&&". Also, the loop is not necessary for masking. Simply use (cpu->env.picsr & cpu->env.picmr). Signed-off-by: Xi Wang <xi.wang@gmail.com> Acked-by: Jia Liu <proljc@gmail.com>
2013-08-21hw/openrisc: Avoid using uninitialised variable 'entry'Jia Liu1-2/+1
clang warns that cpu_openrisc_load_kernel() can use 'entry' uninitialized: hw/openrisc/openrisc_sim.c:69:9: error: variable 'entry' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] if (kernel_filename && !qtest_enabled()) { ^~~~~~~~~~~~~~~ hw/openrisc/openrisc_sim.c:91:19: note: uninitialized use occurs here cpu->env.pc = entry; ^~~~~ Fix this by not attempting to change the CPU's starting PC unless we actually loaded a kernel. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jia Liu <proljc@gmail.com>
2013-08-21loader: store FW CFG ROM files in RAMMichael S. Tsirkin4-3/+51
ROM files that are put in FW CFG are copied to guest ram, by BIOS, but they are not backed by RAM so they don't get migrated. Each time we change two bytes in such a ROM this breaks cross-version migration: since we can migrate after BIOS has read the first byte but before it has read the second one, getting an inconsistent state. Future-proof this by creating, for each such ROM, an MR serving as the backing store. This MR is never mapped into guest memory, but it's registered as RAM so it's migrated with the guest. Naturally, this only helps for -M 1.7 and up, older machine types will still have the cross-version migration bug. Luckily the race window for the problem to trigger is very small, which is also likely why we didn't notice the cross-version migration bug in testing yet. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2013-08-21arch_init: align MR size to target page sizeMichael S. Tsirkin1-1/+2
Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE: MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration never completes. But this isn't really required for regions set up with memory_region_init_ram, since that calls qemu_ram_alloc which aligns size up using TARGET_PAGE_ALIGN. Align MR size up to full target page sizes, this way migration completes even if we create a RAM MR which is not a full target page size. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2013-08-21pc: cleanup 1.4 compat supportMichael S. Tsirkin2-4/+4
Make 1.4 compat code call the 1.6 one, reducing code duplication. Add comment explaining why we can't make 1.4 call 1.5 as usual. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
2013-08-20kvm: i386: fix LAPIC TSC deadline timer save/restoreMarcelo Tosatti1-3/+26
The configuration of the timer represented by MSR_IA32_TSCDEADLINE depends on: - APIC LVT Timer register. - TSC value. Change the order to respect the dependency. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-20kvm-all.c: max_cpus should not exceed KVM vcpu limitMarcelo Tosatti1-0/+7
maxcpus, which specifies the maximum number of hotpluggable CPUs, should not exceed KVM's vcpu limit. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> [Reword message. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-20kvm: Simplify kvm_handle_ioJan Kiszka1-26/+2
Now that cpu_in/out is just a wrapper around address_space_rw, we can also call the latter directly. As host endianness == guest endianness, there is no need for the memory access helpers st*_p/ld*_p as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-20kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabledLiu Jinsong1-2/+15
This patch is to fix the bug https://bugs.launchpad.net/qemu-kvm/+bug/1207623 IA32_FEATURE_CONTROL is pointless if not expose VMX or SMX bits to cpuid.1.ecx of vcpu. Current qemu-kvm will error return when kvm_put_msrs or kvm_get_msrs. Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-20Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20130820' into ↵Anthony Liguori26-210/+514
staging target-arm queue # gpg: Signature made Tue 20 Aug 2013 08:56:28 AM CDT using RSA key ID 14360CDE # gpg: Can't check signature: public key not found # By Peter Maydell (20) and Peter Chubb (1) # Via Peter Maydell * pmaydell/tags/pull-target-arm-20130820: (21 commits) hw/timer/imx_epit: Simplify and fix imx_epit implementation default-configs: Fix A9MP and A15MP config names hw/cpu/a15mpcore: Wire generic timer outputs to GIC inputs target-arm: Implement the generic timer target-arm: Support coprocessor registers which do I/O target-arm: Allow raw_read() and raw_write() to handle 64 bit regs hw/arm/pic_cpu: Remove the now-unneeded arm_pic_init_cpu() hw/arm/xilinx_zynq: Don't use arm_pic_init_cpu() hw/arm/vexpress: Don't use arm_pic_init_cpu() hw/arm/versatilepb: Don't use arm_pic_init_cpu() hw/arm/strongarm: Don't use arm_pic_init_cpu() hw/arm/realview: Don't use arm_pic_init_cpu() hw/arm/omap*: Don't use arm_pic_init_cpu() hw/arm/musicpal: Don't use arm_pic_init_cpu() hw/arm/kzm: Don't use arm_pic_init_cpu() hw/arm/integratorcp: Don't use arm_pic_init_cpu() hw/arm/highbank: Don't use arm_pic_init_cpu() hw/arm/exynos4210: Don't use arm_pic_init_cpu() hw/arm/armv7m: Don't use arm_pic_init_cpu() target-arm: Make IRQ and FIQ gpio lines on the CPU object ... Message-id: 1377007680-4934-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-20scripts/qapi.py: Avoid syntax not supported by Python 2.4Peter Maydell1-1/+1
The Python "except Foo as x" syntax was only introduced in Python 2.6, but we aim to support Python 2.4 and later. Use the old-style "except Foo, x" syntax instead, thus fixing configure/compile on systems with older Python. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20monitor: print the invalid char in error messageFam Zheng1-3/+7
It's more friendly to print which char is invalid to user, especially when user tries to input a float value and expect the monitor to round it to int. Since we don't round float number when we look for a integer, telling which char is invalid is less confusing. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20OptsVisitor: introduce unit tests, with test cases for range flatteningLaszlo Ersek5-3/+300
According to commit 4f193e34 ("tests: Use qapi-schema-test.json as schema parser test") the "tests/qapi-schema/qapi-schema-test.out" file must be updated as well. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20add "test-int128" and "test-bitops" to .gitignoreLaszlo Ersek1-0/+2
"test-int128" was probably missed in commit 6046c620 ("int128: optimize and add test cases"). "test-bitops" was probably missed in commit 3464700f ("tests: Add test-bitops.c with some sextract tests"). Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20OptsVisitor: don't try to flatten overlong integer rangesLaszlo Ersek2-2/+11
Prevent mistyped command line options from incurring high memory and CPU usage at startup. 64K elements in a range should be enough for everyone (TM). The OPTS_VISITOR_RANGE_MAX macro is public so that unit tests can construct corner cases with it. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20OptsVisitor: opts_type_uint64(): recognize intervals when LM_IN_PROGRESSLaszlo Ersek1-5/+27
When a well-formed range value, bounded by unsigned integers, is encountered while processing a repeated option, enter LM_UNSIGNED_INTERVAL and return the low bound. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20OptsVisitor: rebase opts_type_uint64() to parse_uint_full()Laszlo Ersek1-18/+5
Simplify the code in preparation for the next patch. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20OptsVisitor: opts_type_int(): recognize intervals when LM_IN_PROGRESSLaszlo Ersek1-6/+28
When a well-formed range value, bounded by signed integers, is encountered while processing a repeated option, enter LM_SIGNED_INTERVAL and return the low bound. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>