int128: optimize and add test cases
For add, the carry only requires checking one of the arguments.For sub and neg, we can similarly optimize computation of thecarry.
For ge, we can just do lexicographic order.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()arguments to CPUState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
notify: add NotiferWithReturn so notifier list can abort
notifier_list_notify() has no return value. This is fine when we justwant to invoke side-effects.
Sometimes it's useful for notifiers to produce a return value. Thisallows notifiers to "veto" an operation and will be used by the block...
audio: Replace static functions in header file by macros, remove GCC_ATTR
Using macros instead of static functions for dolog and for ldebugsimplifies the code and can also reduce the total code size.
GCC_ATTR was only used in audio_int.h, so it is now unused and...
memory: make section size a 128-bit integer
So far, the size of all regions passed to listeners could fit in 64 bits,because artificial regions (containers and aliases) are eliminated bythe memory core, leaving only device regions which have reasonable sizes...
qemu-option: check_params() is now unused, drop it
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Message-id: 1371208516-7857-3-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
log.h: Supply missing includes
<stdio.h> has always been missing. Rest missed in commit eeacee4.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>Message-id: 1370610036-10577-3-git-send-email-armbru@redhat.com...
error-report.h: Supply missing include
Missed in commit e5924d8.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>Message-id: 1370610036-10577-2-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
memory_mapping: Move MemoryMappingList typedef to qemu/typedefs.h
This will avoid issues with hwaddr and ram_addr_t when includingsysemu/memory_mapping.h for CONFIG_USER_ONLY, e.g., from qom/cpu.h.
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci: misc cleanups
This includes some pci-related cleanups,and fw cfg cleanups which will be useful for on-goingpci related work.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
fw_cfg: move typedef to qemu/typedefs.h
Less header dependencies this way.
osdep: add qemu_get_local_state_pathname()
This function returns ${prefix}/var/RELATIVE_PATHNAME on POSIX-y systems,and <CSIDL_COMMON_APPDATA>/RELATIVE_PATHNAME on Win32.
http://msdn.microsoft.com/en-us/library/bb762494.aspx
[...] This folder is used for application data that is not user...
remove some double-includes
Some source files #include the same header more thanonce for no good reason. Remove second #includes insuch cases.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
osdep, kvm: rename low-level RAM allocation functions
This is preparatory to the introduction of a separate freeing API.
Reported-by: Amos Kong <akong@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>...
osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory
We switched from qemu_memalign to mmap() but then we don't modifyqemu_vfree() to do a munmap() over free(). Which we cannot dobecause qemu_vfree() frees memory allocated by qemu_{mem,block}align....
osdep.h: include sys/types.h for ssize_t definition
sys/types.h is taken out from "ifdef OpenBSD" guard. It should besafe for other systems, according to following survey:http://hacks.owlfolio.org/header-survey/
This fixes build for CONFIG_IOVEC-less systems (mingw)....
qemu: add castagnoli crc32c checksum algorithm
This adds the Castagnoli CRC32C algorithm, using the 0x11EDC6F41polynomial.
This is extracted from the linux kernel cryptographic crc32.c module.
The algorithm is based on:
Castagnoli93: Guy Castagnoli and Stefan Braeuer and Martin Herrman...
win32: add readv/writev emulation
Commit e9d8fbf (qemu-file: do not use stdio for qemu_fdopen, 2013-03-27)introduced a usage of writev, which mingw32 does not have. Even thoughqemu_fdopen itself is not used on mingw32, the future-proof solution isto add an implementation of it. This is simple and similar to how we...
Remove unnecessary FreeBSD #include
sys/param.h was included to define __FreeBSD_version, but the conditionalusing it was removed by commit d05ef160453e98546a4197496dc8a3cb2defac53(Brad Smith, "Allow clock_gettime() monotonic clock to be utilized on more...
Merge remote-tracking branch 'bonzini/scsi-next' into staging
virtio-scsi: create VirtIOSCSICommon
This patch refactors existing virtio-scsi code into VirtIOSCSICommonin order to allow virtio_scsi_init_common() to be used by both internalvirtio_scsi_init() and external vhost-scsi-pci code.
Cc: Michael S. Tsirkin <mst@redhat.com>...
bswap: fix compiler warning
The bswap functions use memcpy but the bswap.h header itself does not seem toinclude it in some configuration such as cross compiling for powerpc64on x86_64 machine.
The patch explicitly includes string.h.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>...
memory: move core typedefs to qemu/typedefs.h
sysemu: avoid proliferation of include/ subdirectories
aes: move aes.h from include/block to include/qemu
Move aes.h from include/block to include/qemu to show it can be reusedby other subsystems.
Cc: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>...
aes: make Td[0-5] and Te[0-5] tables non static
Remove static attribute to Td[0-5] and Te[0-5] tables so that theycan be used outside of aes.c. Change their type from u32 to uint32_t,to keep the u32 udef local to aes.c. Prefix them with AES_ so that they...
Allow clock_gettime() monotonic clock to be utilized on more OS's
Allow the clock_gettime() code using monotonic clock to be utilized onmore POSIX compliannt OS's. This started as a fix for OpenBSD which waslisted in one function as part of the previous hard coded list of OS's...
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.Rename to qemu_set_nonblock() just like qemu_set_cloexec().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
compiler: fix warning with GCC 4.8.0
GCC 4.8.0 introduces a new warning:
block/qcow2-snapshot.c: In function 'qcow2_write_snapshots’: block/qcow2-snapshot.c:252:18: error: typedef 'qemu_build_bug_on__253' locally defined but not used [-Werror=unused-local-typedefs]...
qemu-socket: Make socket_optslist public
Allow other users to create the QemuOpts needed for inet_connect_opts().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
nbd: Keep hostname and port separate
The NBD block supports an URL syntax, for which a URL parser returnsseparate hostname and port fields. It also supports the traditional qemusyntax encoded in a filename. Until now, after parsing the URL to geteach piece of information, a new string is built to be fed to socket...
main-loop: add qemu_get_aio_context()
It is very useful to get the main loop AioContext, which is a staticvariable in main-loop.c.
I'm not sure whether qemu_get_aio_context() will be necessary in thefuture once devices focus on using their own AioContext instead of the...
qemu-option: Add qemu_opts_absorb_qdict()
This adds a function that adds all entries of a QDict to a QemuOpts ifthe keys are known, and leaves only the rest in the QDict.
This way a single QDict of -drive options can be processed in multipleplaces (generic block layer, block driver, backing file block driver,...
chardev: add udp support to qapi
This patch adds 'udp' support to qapi.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add a TPM Passthrough backend driver implementation
This patch is based of off version 9 of Stefan Berger's patch series "QEMU Trusted Platform Module (TPM) integration" and adds a new backend driver for it.
This patch adds a passthrough backend driver for passing commands sent to the...
qemu-file: check exit status when closing a pipe QEMUFile
This is what exec_close does. Move this to the underlying QEMUFile.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
block-migration: add lock
Some state is shared between the block migration code and its AIOcallbacks. Once block migration will run outside the iothread,the block migration code and the AIO callbacks will be able torun concurrently. Protect the critical sections with a separate...
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
move socket_set_nodelay to osdep.c
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw: move fifo.[ch] to libqemuutil
fifo.c is generic code that can be easily unit tested. So itbelongs in libqemuutil.
qemu-log: default to stderr for logging output
Switch the default for qemu_log logging output from "/tmp/qemu.log" to stderr. This is an incompatible change in some sense, but loggingis mostly used for debugging purposes so it shouldn't affect production...
qemu-log: Remove qemu_log_try_set_file() and its users
Remove the function qemu_log_try_set_file() and its users (whichare all in TCG code generation functions for various targets).This function was added to abstract out code which was originallywritten as "if (!logfile) logfile = stderr;" in order that BUG:...
iohandler: switch to GPollFD
Convert iohandler_select_fill() and iohandler_select_poll() to useGPollFD instead of rfds/wfds/xfds.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Message-id: 1361356113-11049-7-git-send-email-stefanha@redhat.com...
host-utils: Use __int128_t for mul[us]64
Replace some x86_64 specific inline assembly with something thatall 64-bit hosts ought to optimize well. At worst this becomesa call to the gcc __multi3 routine, which is no worse than ourimplementation in util/host-utils.c....
bitops: Remove routines redundant with host-utils
Signed-off-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
bitops: Write bitops_flsl in terms of clzl
hbitmap: Use non-bitops ctzl
Both uses of ctz have already eliminated zero, and thus the differencein edge conditions between the two routines is irrelevant.
Signed-off-by: Richard Henderson <rth@twiddle.net>Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
host-utils: Fix coding style and add comments
Add function comments to the routines, documenting the cornercases upon which we are standardizing. Fix the few instancesof non-standard coding style.
Signed-off-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Eric Blake <eblake@redhat.com>...
host-utils: Add host long specific aliases for clz, ctz, ctpop
We will standardize on these names, rather than the similar routinescurrently residing in qemu/bitops.h.
qemu-log: Rename CPULogItem, cpu_log_items to QEMULogItem, qemu_log_items
Rename the typedef CPULogItem and the public array cpu_log_itemsto names that better reflect the fact that the qemu_log functionalityisn't restricted to TCG CPU debug logs any more....
qemu-log: Rename the public-facing cpu_set_log function to qemu_set_log
Rename the public-facing function cpu_set_log to qemu_set_log. Thisrequires us to rename the internal-only qemu_set_log() todo_qemu_set_log().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
qemu-log: Rename cpu_str_to_log_mask to qemu_str_to_log_mask
Rename cpu_str_to_log_mask() to qemu_str_to_log_mask(), sincethe qemu_log functionality is no longer restricted to TCG CPUdebug logging.
qemu-log: Abstract out "print usage message about valid log categories"
Abstract out the "print a human readable list of all thevalid log categories" functionality which is currently duplicatedin three separate places. (We leave the monitor.c help_cmd()...
qemu-log: Unify {cpu_set,set_cpu}_log_filename as qemu_set_log_filename
The qemu_log() functionality is no longer specific to TCG CPU debug logs.Rename cpu_set_log_filename() to qemu_set_log_filename() and drop thepointless wrapper set_cpu_log_filename()....
bswap: Fix width of swap in leul_to_cpu
The misnamed HOST_LONG_BITS is really HOST_POINTER_BITS. Here we'reexplicitly using an unsigned long, rather than uintptr_t, so it ismore correct to select the swap size via ULONG_MAX.
Acked-by: Andreas Färber <afaerber@suse.de>...
bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl
We had two copies of a ffs function for longs with subtly differentsemantics and, for the one in bitops.h, a confusing name: the resultwas off-by-one compared to the library function ffsl....
hbitmap: add assertion on hbitmap_iter_init
hbitmap_iter_init causes an out-of-bounds access when the "first" argument is or greater than or equal to the size of the bitmap.Forbid this with an assertion, and remove the failing testcase.
Reported-by: Kevin Wolf <kwolf@redhat.com>...
add hierarchical bitmap data type and test cases
HBitmaps provides an array of bits. The bits are stored as usual in anarray of unsigned longs, but HBitmap is also optimized to provide fastiteration over set bits; going from one bit to the next is O(logB n)...
host-utils: add ffsl
We can provide fast versions based on the other functions definedby host-utils.h. Some care is required on glibc, which providesffsl already.
Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
bswap: improve gluing
OpenBSD system compiler (gcc 4.2.1) has problems with concatenationof macro arguments in macro functions: CC aes.oIn file included from /src/qemu/include/qemu-common.h:126, from /src/qemu/aes.c:30:/src/qemu/include/qemu/bswap.h: In function 'leul_to_cpu':...
qemu-option: move standard option definitions out of qemu-config.c
bswap: Rewrite cpu_to_<endian><type>u with {ld,st}<type>_<endian>_p
We've now optimized the ld/st versions; reuse that for the "legacy" versions. Always use inlines so that we get the type checking thatwe expect.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
bswap: Rewrite all ld<type>_<endian>_p functions
Use the new host endian unaligned access functions instead ofopen coding byte-by-byte references. Remove assembly specialcases for i386 and ppc -- we've now exposed the operation tothe compiler sufficiently for these to be optimized automatically....
bswap: Add host endian unaligned access functions
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
bswap: Tidy base definitions of bswapN
Move the bswap_N -> bswapN wrappers inside CONFIG_BYTESWAP_H.
Change the ultimate fallback defintions from macros to inline functions.The proper types recieved by the function arguments means we can removeunnecessary casts, making the code more readable....
iov: add iov_discard_front/back() to remove data
The iov_discard_front/back() functions remove data from the front orback of the vector. This is useful when peeling off header/footerstructs.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Disable semaphores fallback code for OpenBSD
Disable the semaphores fallback code for OpenBSD as modern OpenBSDreleases now have sem_timedwait().
Signed-off-by: Brad Smith <brad@comstyle.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
fpu: move public header file to include/fpu
misc: move include files to include/qemu/
migration: move include files to include/migration/
qom: move include files to include/qom/
qapi: move include files to include/qobject/
stream: fix ratelimit_set_speed
The formula to compute slice_quota was wrong since commit 6ef228fc.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
virtio-rng: fix typos, comments
Fix typos, whitespace and update comments to match currentimplementation.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: make object_finalize static
It is not used anymore, and there is no need to make it public.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: move bus removal to object_unparent
Add an ObjectClass method that is done at object_unparent time. Itshould remove any backlinks to the object in the composition tree,so that object_delete will be able to drop the last reference andfree the object....
qom: make object_delete usable for statically-allocated objects
Store in the object the freeing function that will be used at deletiontime. This makes it possible to use object_delete on statically-allocated(embedded) objects. Dually, it makes it possible to use object_unparent...
rng-random: add an RNG backend that uses /dev/random (v3)
The filename can be overridden but it expects a non-blocking source of entropy.A typical invocation would be:
qemu -object rng-random,id=rng0 -device virtio-rng-pci,rng=rng0
This can also be used with /dev/urandom by using the command line:...
object: add object_property_add_bool (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>---v1 -> v2 - Fix whitespace (Andreas Faerber)
rng: add RndBackend abstract object class
This is the backend used by devices that need to request entropy.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cpus: Pass CPUState to run_on_cpu()
CPUArchState is no longer needed.
Move the declaration to include/qemu/cpu.h and add documentation.
cpu: Move thread_id to CPUState
cpus: Pass CPUState to [qemu_]cpu_has_work()
For target-mips also change the return type to bool.
Make include paths for cpu-qom.h consistent for alpha and unicore32.
Signed-off-by: Andreas Färber <afaerber@suse.de>[AF: Updated new target-openrisc function accordingly]...
cpus: Pass CPUState to qemu_cpu_kick()
CPUArchState is no longer needed there.
cpu: Move queued_work_{first,last} to CPUState
cpu: Move created field to CPUState
Change its type to bool.
cpu: Move stop field to CPUState
cpu: Move stopped field to CPUState
cpus: Pass CPUState to cpu_is_stopped()
Also change the return type to bool.
cpu: Move halt_cond to CPUState
cpus: Pass CPUState to qemu_cpu_is_self()
Change return type to bool, move to include/qemu/cpu.h andadd documentation.
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Igor Mammedov <imammedo@redhat.com>[AF: Updated new caller qemu_in_vcpu_thread()]
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging
qom: Reimplement Interfaces
The current implementation of Interfaces is poorly designed. Each interfacethat an object implements ends up being an object that's tracked by theimplementing object. There's all sorts of gymnastics to deal with castingbetween these objects....
Add cache handling functions
Add MRU page cache mechanism.The page are accessed by their address.
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>Signed-off-by: Petter Svard <petters@cs.umu.se>Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>...
cpu: Move thread_kicked to CPUState
Change field type to bool.
cpu: Move CPU_COMMON_THREAD into CPUState
CPU_COMMON_THREAD was only used for Windows, adding an hThread fieldto CPU_COMMON.
Move the field into QOM CPUState and change its type to HANDLE,which it is assigned from. This requires Windows headers, pulled in...
cpu: Move thread field into CPUState
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging
qom: Push error reporting to object_property_find()
Avoids duplicated error_set().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>[AF: Also drop error_set() in object_property_del().]Signed-off-by: Andreas Färber <afaerber@suse.de>