tap: support enabling or disabling a queue
This patch introduce a new bit - enabled in TAPState which tracks whether aspecific queue/fd is enabled. The tap/fd is enabled during initialization andcould be enabled/disabled by tap_enalbe() and tap_disable() which calls platform...
net: intorduce qemu_del_nic()
To support multiqueue nic, this patch separate the nic destructor fromqemu_del_net_client() to a new helper qemu_del_nic() since the mapping bettweenNiCState and NetClientState were not 1:1 in multiqueue. The following patches...
net: introduce qemu_find_net_clients_except()
In multiqueue, all NetClientState that belongs to the same netdev or nic has thesame id. So this patches introduces an helper qemu_find_net_clients_except()which finds all NetClientState with the same id. This will be used by multiqueue...
net: introduce NetClientState destructor
To allow allocating an array of NetClientState and free it once, this patchintroduces destructor of NetClientState. Which could do type specific free,which could be used by multiqueue to free the array once.
Signed-off-by: Jason Wang <jasowang@redhat.com>...
net: multiqueue support
This patch adds basic multiqueue support for qemu. The idea is simple, an arrayof NetClientStates were introduced in NICState, parse_netdev() were extended tofind and match all NetClientStates belongs to the backend and place their...
net: introduce qemu_get_nic()
To support multiqueue, this patch introduces a helper qemu_get_nic() to getNICState from a NetClientState. The following patches would refactor this helperto support multiqueue.
net: introduce qemu_get_queue()
To support multiqueue, the patch introduce a helper qemu_get_queue()which is used to get the NetClientState of a device. The following patches wouldrefactor this helper to support multiqueue.
net: tap: using bool instead of bitfield
Signed-off-by: Jason Wang <jasowang@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-pixman.h: Avoid mutual inclusion loop with console.h
Remove an unnecessary mutual inclusion loop between qemu-pixman.h andconsole.h, since the former was only including the latter for'PixelFormat*', which can be provided by typedefs.h. This requires a...
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
cpu: Unconditionalize CPUState fields
Commits fc8c5b8c41ee5ba69d7a2be63b02a08c7b0b155b (Makefile.user: DefineCONFIG_USER_ONLY for libuser/) anddd83b06ae61cfa2dc4381ab49f365bd0995fc930 (qom: Introduce CPU class)specifically prepared the qom/cpu.c file to be compiled differently for...
kvm: Pass CPUState to kvm_on_sigbus_vcpu()
Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: PassCPUState to kvm_arch_*) CPUArchState is no longer needed.
Allows to change qemu_kvm_eat_signals() argument as well.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
qom: Introduce object_class_is_abstract()
This lets a caller check if an ObjectClass as returned by, e.g.,object_class_by_name() is instantiatable.
Signed-off-by: Andreas Färber <afaerber@suse.de>Cc: Anthony Liguori <anthony@codemonkey.ws>
cpu: Add model resolution support to CPUClass
Introduce CPUClass::class_by_name and add a default implementation.Hook up the alpha and ppc implementations.
Introduce a wrapper function cpu_class_by_name().
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpus.h: Make constant smp_cores/smp_threads available on *-user
The code that calculates the APIC ID will use smp_cores/smp_threads, sojust define them as 1 on *-user to avoid #ifdefs in the code.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm: Add fake KVM_FEATURE_CLOCKSOURCE_STABLE_BIT for builds without KVM
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm: Create kvm_arch_vcpu_id() function
This will allow each architecture to define how the VCPU ID is set onthe KVM_CREATE_VCPU ioctl call.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
fw_cfg: Splash image loader can overrun a stack variable, fix
read_splashfile() passes the address of an int variable as size_t *parameter to g_file_get_contents(), with a cast to gag the compiler.
No problem on machines where sizeof(size_t) == sizeof(int)....
block: Add special error code for wrong format
The block drivers need a special error code for "wrong format".From the available error codes EMEDIUMTYPE fits best.It is not available on all platforms, so a definition inqemu-common.h and a specific error report are needed....
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>...
block: allow customizing the granularity of the dirty bitmap
Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
mirror: allow customizing the granularity
The desired granularity may be very different depending on the kind ofoperation (e.g. continuous replication vs. collapse-to-raw) and whetherthe VM is expected to perform lots of I/O while mirroring is in progress....
mirror: add buf-size argument to drive-mirror
This makes sense when the next commit starts using the extra buffer spaceto perform many I/O operations asynchronously.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: implement dirty bitmap using HBitmap
This actually uses the dirty bitmap in the block layer, and convertsmirroring to use an HBitmapIter.
Reviewed-by: Laszlo Ersek <lersek@redhat.com> (except block/mirror.c parts)Reviewed-by: Eric Blake <eblake@redhat.com>...
block: make round_to_clusters public
This is needed in the following patch.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-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>...
Merge remote-tracking branch 'quintela/thread.next' into staging
Merge remote-tracking branch 'stefanha/block' into staging
tci: Fix broken build (regression)
s390x-linux-user now also uses GETPC. Instead of adding it to the list oftargets which use GETPC, the macro is now defined unconditionally.
This avoids future build regressions like this one:
CC s390x-linux-user/target-s390x/int_helper.o...
cpu-defs.h: Drop qemu_work_item prototype
Commit c64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e (cpu: Movequeued_work_{first,last} to CPUState) moved the qemu_work_item fieldsaway. Clean up the now unused prototype.
vl: Use size_t for sizes in get_boot_devices_list()
Code mixes uint32_t, int and size_t. Very unlikely to go wrong inpractice, but clean it up anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge remote-tracking branch 'luiz/queue/qmp' into staging
qom: Extend documentation on QOM method concepts
Add a documentation section "Methods" and discuss among others how tohandle overriding virtual methods.
Clarify DeviceClass::realize documentation and refer to the above.
migration: remove argument to qemu_savevm_state_cancel
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
migration: move beginning stage to the migration thread
migration: make function static
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
HMP: add QDict to info callback handler
This patch change all info call back function to takeadditional QDict * parameter, which allow those commandtake parameter. Now it is set to NULL at default case.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
aio: Fix return value of aio_poll()
aio_poll() must return true if any work is still pending, even if itdidn't make progress, so that bdrv_drain_all() doesn't stop waiting tooearly. The possibility of stopping early occasionally lead to a failedassertion in bdrv_drain_all(), when some in-flight request was missed...
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':...
chardev: add error reporting for qemu_chr_new_from_opts
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
chardev: fix QemuOpts lifecycle
qemu_chr_new_from_opts handles QemuOpts release now, so callers don'thave to worry. It will either be saved in CharDriverState, thenreleased in qemu_chr_delete, or in the error case released instantly.
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
qom: Make object_resolve_path_component() path argument const
A usage with a hardcoded partial path such as
object_resolve_path_component(obj, "foo")
is totally valid but currently leads to a compilation error. Fix this.
exec: Return CPUState from qemu_get_cpu()
Move the declaration to qemu/cpu.h and add documentation.The implementation still depends on CPUArchState for CPU iteration.
kvm: Add fake KVM constants to avoid #ifdefs on KVM-specific code
Any KVM-specific code that use these constants must check ifkvm_enabled() is true before using them.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Gleb Natapov <gleb@redhat.com>...
cpu: Move nr_{cores,threads} fields to CPUState
To facilitate the field movements, pass MIPSCPU to malta_mips_config();avoid that for mips_cpu_map_tc() since callers only access MIPS ThreadContexts, inside TCG helpers.
cpu: Move numa_node field to CPUState
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
kvm: Pass CPUState to kvm_init_vcpu()
CPUArchState is no longer needed, and it thereby no longer depends onNEED_CPU_H.
block: make qiov_is_aligned() public
The qiov_is_aligned() function checks whether a QEMUIOVector meets aBlockDriverState's alignment requirements. This is needed byvirtio-blk-data-plane so:
1. Move the function from block/raw-posix.c to block/block.c....
build: some simplifications for "trace/Makefile.objs"
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-option: move standard option definitions out of qemu-config.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pixman: fix warning
Cc: afaerber@suse.deCc: agraf@suse.deSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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....
fdt: Use bswapN instead of bswap_N
Fixes the libfdt enabled build for hosts that have <machine/bswap.h>.
The code at the beginning of qemu/bswap.h is attempting to standardizeon bswapN. In the case of CONFIG_MACHINE_BSWAP_H, this is all we get.In the case of CONFIG_BYTESWAP_H, we get bswap_N from the system header...
Make all static TypeInfos const
Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register alltypes natively through QEMU Object Model), TypeInfo as used inthe common, non-iterative pattern is no longer amended with informationand should therefore be const....
cpu: Change parent type to Device
This finally makes the CPU class a subclass of the Device class,allowing us to start using DeviceState properties on CPU subclasses.
It has no_user=1, as creating CPUs using -device doesn't work yet.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>...
qemu-common.h: Make qemu_init_vcpu() stub static inline
Turn the *-user macro into a no-op inline function to avoidunused-variable warnings and band-aiding #ifdef'ery.
This allows to drop an #ifdef for alpha and avoids more for unicore32and other upcoming trivial realizefn implementations....
softfloat: Implement uint64_to_float128
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
iov: add qemu_iovec_concat_iov()
The qemu_iovec_concat() function copies a subset of a QEMUIOVector. Thenew qemu_iovec_concat_iov() function does the same for a iov/cnt pair.
It is easy to define qemu_iovec_concat() in terms ofqemu_iovec_concat_iov(). The existing code is mostly unchanged, except...
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>
raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane
The raw_get_aio_fd() function allows virtio-blk-data-plane to get thefile descriptor of a raw image file with Linux AIO enabled. Thisinterface is really a layering violation that can be resolved once the...
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>
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
migration: merge QEMUFileBuffered into MigrationState
Avoid splitting the state of outgoing migration, more or less arbitrarily,between two data structures. QEMUFileBuffered anyway is used only duringmigration.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
migration: move migration_fd_put_ready()
Put it near its use and un-export it.
migration: Inline qemu_fopen_ops_buffered into migrate_fd_connect
memory: introduce memory_region_test_and_clear_dirty
This function avoids having to do two calls, one to test the dirty bit, andother to reset it.
migration: move buffered_file.c code into migration.c
This only moves the code (also from buffered_file.h to migration.h).Fix whitespace until checkpatch is happy.
migration: make qemu_fopen_ops_buffered() return void
We want the file assignment to happen before the thread is created toavoid locking, so we just do it before creating the thread.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
migration: move migration thread init code to migrate_fd_put_ready
This way everything related with migration is run on the migrationthread and no locking is needed.
migration: make writes blocking
Move all the writes to the migration_thread, and make writingsblocking. Notice that are still using the iothread for everythingthat we do.
migration: remove unfreeze logic
Now that we have a thread, and blocking writes, we don't need it.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: New save live migration method: pending
Code just now does (simplified for clarity)
if (qemu_savevm_state_iterate(s->file) == 1) { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); }
Problem here is that qemu_savevm_state_iterate() returns 1 when it...
exec: change RAM list to a TAILQ
add a version number to ram_list
This will be used to detect if last_block might have become invalidacross different calls to ram_save_live.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Umesh Deshpande <udeshpan@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>...
protect the ramlist with a separate mutex
Add the new mutex that protects shared state between ram_save_liveand the iothread. If the iothread mutex has to be taken togetherwith the ramlist mutex, the iothread shall always be outside.
exec: change ramlist from MRU order to a 1-item cache
Most of the time, only 2 items will be active (from/to for a string operation,or code/data). But TCG guests likely won't have gigabytes of memory, sothis actually goes down to 1 item.
Merge remote-tracking branch 'bonzini/header-dirs' into staging
cpu: Move kvm_state field into CPUState
Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.
cpu: Move kvm_run into CPUState
Pass CPUState / {X86,S390}CPU to helper functions.
cpu: Move kvm_fd into CPUState
kvm: Pass CPUState to kvm_arch_*
Move kvm_vcpu_dirty field into CPUState to simplify things and changeits type to bool while at it.
softmmu: move remaining include files to include/ subdirectories
fpu: move public header file to include/fpu
janitor: move remaining public headers to include/
Headers in the root directory are now used only from within thatdirectory.
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
migration: move include files to include/migration/
qom: move include files to include/qom/
qapi: move include files to include/qobject/
block: move include files to include/block/
exec: move include files to include/exec/