kvm: make tsc stable over migration and machine start
If the machine is stopped, we should not record two different tsc valuesupon a save operation. The same problem happens with kvmclock.
But kvmclock is taking a different diretion, being now seen as a separate...
Refactor kvm&tcg function names in cpus.c
Pure interface cosmetics: Ensure that only kvm core services (asdeclared in kvm.h) start with "kvm_". Prepend "qemu_" to those thatviolate this rule in cpus.c. Also rename the corresponding tcg functionsfor the sake of consistency....
Refactor cpu_has_work/any_cpu_has_work in cpus.c
Avoid duplicate use of the function name cpu_has_work, it's confusing,also their scope. Refactor cpu_has_work to cpu_thread_is_idle and do thesame with any_cpu_has_work.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Fix a few coding style violations in cpus.c
No functional changes.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actuallyhave nothing to do with the EXCP_* defines used so far. At this chance,specify more detailed reasons so that VM state change handlers canevaluate them....
Refactor debug and vmstop request interface
Instead of fiddling with debug_requested and vmstop_requested directly,introduce qemu_system_debug_request and turn qemu_system_vmstop_requestinto a public interface. This aligns those services with exiting ones in...
Move debug exception handling out of cpu_exec
To prepare splitting up KVM and TCG CPU entry/exit, move the debugexception into cpus.c and invoke cpu_handle_debug_exception on returnfrom qemu_cpu_exec.
This also allows to clean up the debug request signaling: We can assign...
kvm: Separate TCG from KVM cpu execution
Mixing up TCG bits with KVM already led to problems around eflagsemulation on x86. Moreover, quite some code that TCG requires on cpuenty/exit is useless for KVM. So dispatch between tcg_cpu_exec andkvm_cpu_exec as early as possible....
kvm: x86: Prepare VCPU loop for in-kernel irqchip
Effectively no functional change yet as kvm_irqchip_in_kernel still onlyreturns 0, but this patch will allow qemu-kvm to adopt the VCPU loop ofupsteam KVM.
kvm: Drop return values from kvm_arch_pre/post_run
We do not check them, and the only arch with non-empty implementationsalways returns 0 (this is also true for qemu-kvm).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>CC: Alexander Graf <agraf@suse.de>...
kvm: Report proper error on GET_VCPU_MMAP_SIZE failures
kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn
kvm: Handle kvm_init_vcpu errors
Do not ignore errors of kvm_init_vcpu, they are fatal.
kvm: Provide sigbus services arch-independently
Provide arch-independent kvm_on_sigbus* stubs to remove the #ifdef'eryfrom cpus.c. This patch also fixes --disable-kvm build by providing themissing kvm_on_sigbus_vcpu kvm-stub.
Refactor signal setup functions in cpus.c
Move {tcg,kvm}_init_ipi and block_io_signals to avoid prototypes, renamethe former two to clarify that they deal with more than SIG_IPI. Nofunctional changes - except for the tiny fixup of strerror usage.
The forward declaration of sigbus_handler is just temporarily, it will...
kvm: Set up signal mask also for !CONFIG_IOTHREAD
Block SIG_IPI, unblock it during KVM_RUN, just like in io-thread mode.It's unused so far, but this infrastructure will be required forself-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As...
kvm: Refactor qemu_kvm_eat_signals
We do not use the timeout, so drop its logic. As we always poll oursignals, we do not need to drop the global lock. Removing those callsallows some further simplifications. Also fix the error processing ofsigpending at this chance....
kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD
Move qemu_kvm_eat_signals around and call it also when the IO-thread isnot used. Do not yet process SIGBUS, will be armed in a separate step.
Set up signalfd under !CONFIG_IOTHREAD
Will be required for SIGBUS handling. For obvious reasons, this willremain a nop on Windows hosts.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
kvm: Fix race between timer signals and vcpu entry under !IOTHREAD
Found by Stefan Hajnoczi: There is a race in kvm_cpu_exec betweenchecking for exit_request on vcpu entry and timer signals arrivingbefore KVM starts to catch them. Plug it by blocking both timer related...
kvm: Add MCE signal support for !CONFIG_IOTHREAD
Currently, we only configure and process MCE-related SIGBUS events ifCONFIG_IOTHREAD is enabled. The groundwork is laid, we just need tofactor out the required handler registration and system configuration....
Introduce VCPU self-signaling service
Introduce qemu_cpu_kick_self to send SIG_IPI to the calling VCPUcontext. First user will be kvm.
kvm: Unconditionally reenter kernel after IO exits
KVM requires to reenter the kernel after IO exits in order to completeinstruction emulation. Failing to do so will leave the kernel stateinconsistently behind. To ensure that we will get back ASAP, we issue a...
kvm: Remove static return code of kvm_handle_io
Improve the readability of the exit dispatcher by moving the staticreturn value of kvm_handle_io to its caller.
kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN
The reset we issue on KVM_EXIT_SHUTDOWN implies that we should alsoleave the VCPU loop. As we now check for exit_request which is set byqemu_system_reset_request, this bug is no longer critical. Still it's an...
Prevent abortion on multiple VCPU kicks
If we call qemu_cpu_kick more than once before the target was able toprocess the signal, pthread_kill will fail, and qemu will abort. Preventthis by avoiding the redundant signal.
This logic can be found in qemu-kvm as well....
Stop current VCPU on synchronous reset requests
If some I/O operation ends up calling qemu_system_reset_request in VCPUcontext, we record this and inform the io-thread, but we do notterminate the VCPU loop. This can lead to fairly unexpected behavior if...
Process vmstop requests in IO thread
A pending vmstop request is also a reason to leave the inner main loop.So far we ignored it, and pending stop requests issued over VCPU threadswere simply ignored.
Trigger exit from cpu_exec_all on pending IO events
Except for timer events, we currently do not leave the loop over allVCPUs if an IO event was filed. That may cause unexpected IO latenciesunder !CONFIG_IOTHREAD in SMP scenarios. Fix it by setting the global...
Leave inner main_loop faster on pending requests
If there is any pending request that requires us to leave the inner loopif main_loop, makes sure we do this as soon as possible by enforcingnon-blocking IO processing.
At this change, move variable definitions out of the inner loop to...
Flatten the main loop
First of all, vm_can_run is a misnomer, it actually means "no requestpending". Moreover, there is no need to check all pending requeststwice, the first time via the inner loop check and then again whenactually processing the requests. We can simply remove the inner loop...
vmmouse: fix queue_size field initialization
Initialize the field queue_size, dropped by91c9e09147ba1f3604a3d5d29b4de7702082a33f.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hpet: make optional
Ignore failure with hpet device creation.
sysbus: add creation function that may fail
x86: make vmmouse optional
Compile vmmouse in hwlib. Ignore failure if vmmouse device can't becreated.
isa: add creation function that may fail
vmmouse: convert to qdev
Convert to qdev, also add a proper reset function.
vmport: convert to qdev
x86,MIPS: make vmware_vga optional
Allow failure with vmware_vga device creation and use standardVGA instead.
pci: add creation functions that may fail
qdev: add creation function that may fail
vmware_vga: refactor device creation
Turn vmsvga_init into an inline function.
mst_fpga: Drop one more pxa.h inclusion.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
max7310: finish qdev'ication
1) Move GPIO-related functionality to qdev. Now one can use directlyqdev_get_gpio_in()/qdev_connect_gpio_out() on max7310 devices.
2) Make reset to be called through qdev.reset callback.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>...
pxa2xx: convert i2c master to use qdev/vmsd
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Add scoop post_load callback that sets IRQs to loaded levels
Drop unnecessary inclusions of pxa.h header
Seceral files contained onnecessary dependencies on hw/pxa.h header.Drop unused references.
mainstone: pass one irq to the mst_fpga instead of the whole PIC
tosa: we aren't connected to VBus, pass this info to Linux kernel
tc6393xb: correct NAND isr assertion
sysbus: print number of irqs in dev_print
.gitignore: ignore vi swap files and ctags files
arm: drop unused irq-related part of CPUARMState
These two fields were added as a part of ARMv7 support patch (back in2007), were never used by any code, so can be dropped.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
target-arm: Remove stray #include from middle of neon_helper.c
Remove a stray #include <stdio.h> from the middle of neon_helper.c:it was harmless but pointless since we include stdio.h at the topof the file anyway.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user/arm: fix compilation failures using softfloat's struct types
Add uses of the float32/float64 boxing and unboxing macros so thatthe ARM linux-user targets will compile with USE_SOFTFLOAT_STRUCT_TYPESenabled.
softfloat: Fix compilation failures with USE_SOFTFLOAT_STRUCT_TYPES
Make softfloat compile with USE_SOFTFLOAT_STRUCT_TYPES defined, byadding and using new macros const_float16(), const_float32() andconst_float64() so you can use array initializers in an array of...
target-arm: Silence NaNs resulting from half-precision conversions
Silence the NaNs that may result from half-precision conversion,as we do for the other conversions.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-arm: Use standard FPSCR for Neon half-precision operations
The Neon half-precision conversion operations (VCVT.F16.F32 andVCVT.F32.F16) use ARM standard floating-point arithmetic, unlikethe VFP versions (VCVTB and VCVTT).
softfloat: Correctly handle NaNs in float16_to_float32()
Correctly handle NaNs in float16_to_float32(), by defining andusing a float16ToCommonNaN() function, as we do with the other formats.
softfloat: Fix single-to-half precision float conversions
Fix various bugs in the single-to-half-precision conversion code: * input NaNs not correctly converted in IEEE mode (fixed by defining and using a commonNaNToFloat16()) * wrong values returned when converting NaN/Inf into non-IEEE...
softfloat: Honour default_nan_mode for float-to-float conversions
Honour the default_nan_mode flag when doing conversions betweendifferent floating point formats, as well as when returning a NaN froma two-operand floating point function. This corrects the behaviour...
softfloat: Add float16 type and float16 NaN handling functions
Add a float16 type to softfloat, rather than using bits16 directly.Also add the missing functions float16_is_quiet_nan(),float16_is_signaling_nan() and float16_maybe_silence_nan(),which are needed for the float16 conversion routines....
Make tb_alloc static
This function is only used within exec.c, so no need to make it public.
Signed-off-by: Tristan Gingold <gingold@adacore.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
microblaze: Handle singlestepping over direct jmps
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
Merge branch 'linux-user-for-upstream' of git://gitorious.org/qemu-maemo/qemu
target-arm: implement vsli.64, vsri.64
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-arm: fix VSHLL Neon instruction.
Fix bit mask used when widening the result of shift on narrow input.
[PATCH] [MIPS] Clear softfpu exception state for round, trunc, ceil and floor
MIPS FPU instructions should start with a clean softfpu status. Thisis done for the arithmetic operations and cvt instructions, but notfor round, trunc, ceil and floor.
Signed-off-by: Chris Dearman <chris@mips.com>...
target-arm: Fix 32 bit signed saturating narrow
The returned value when doing saturating signed 64->32 bitconversion of a negative number was incorrect due to a missing cast.
target-arm: Fix VQMOVUN Neon instruction.
VQMOVUN does a signed-to-unsigned saturating conversion. This isdifferent from both the signed-to-signed and unsigned-to-unsignedconversions already implemented, so we need a new set of helperfunctions (neon_unarrow_sat*)....
linux-user/elfload: add FDPIC support
Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: add ppoll syscall support
Some architectures (like Blackfin) only implement ppoll (and skip poll).So add support for it using existing poll code.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Mike Frysinger <vapier@gentoo.org>...
linux-user: decode MAP_{UNINITIALIZED,EXECUTABLE} in strace
linux-user/FLAT: fix auto-stack sizing
The current auto-stack sizing works like it does on a NOMMU system; theproblem is that this only works if the envp/argv arrays are fairly slim.On a desktop system, this is rarely the case, and can easily blow past...
linux-user/FLAT: allow targets to override FLAT processing
This brings flatload.c more in line with the current Linux FLAT loaderwhich allows targets to handle various FLAT aspects in their own way.For the common behavior, the new functions get stubbed out....
linux-user: implement sched_{g,s}etaffinity
user: speed up init_paths a bit
The current init_paths code will attempt to opendir() every single file itfinds. This can obviously generated a huge number of syscalls with even amoderately small sysroot that will fail. Since the readdir() call provides...
linux-user: fix build errors for mmap2-only ports
The current print_mmap func is only enabled when the target supports themmap syscall, but both mmap and mmap2 syscalls use it. This leads to abuild failure when the target supports mmap2 but not mmap....
linux-user: fix for loopmount ioctl
In case a chrooted build uses XEN or KVM, a looped mount needs to be done to setup the chroot.The ioctl for loop mount works correctly for arm, mips, ppc32 and sh4, so its now activated.
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: Add support for -version option
Add support to the linux-user qemu for the -version command lineoption, bringing it into line with the system emulation qemu.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: Fix possible realloc memory leak
Extract from "man realloc":"If realloc() fails the original block is left untouched;it is not freed or moved."
Fix a possible memory leak (reported by cppcheck).
Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
linux-user: fix sizeof handling for getsockopt
cris, microblaze: use cpu_has_work
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
x86: Fix MCA broadcast parameters for TCG case
When broadcasting MCEs, we need to set MCIP and RIPV in mcg_status likeit is done for KVM. Use the symbolic constants at this chance.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>...
qemu-timer: Fix compilation of new timer code for w32, w64
qemu_next_alarm_deadline() is needed by MinGW, too.
Cc: Paolo Bonzini <pbonzini@redhat.com>Cc: Anthony Liguori <aliguori@us.ibm.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
block-migration: actually disable dirty tracking on cleanup
Call to set_dirty_tracking() is misplaced.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: add refcount to DriveInfo
The host part of a block device can be deleted with in progressblock migration.
To fix this, add a reference count to DriveInfo, freeing resourceson last reference.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>...
block-migration: add reference to target DriveInfo
So that ejection of attached device by guest does not free datain use by block migration instance.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>CC: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Add flag to indicate external users to block device
Certain operations such as drive_del or resize cannot be performedwhile external users (eg. block migration) reference the block device.
Add a flag to indicate that.
block: enable in_use flag
Set block device in use during block migration, disallow drive_del andbdrv_truncate for in use devices.
ahci: make number of ports runtime determined
Different AHCI controllers have a different number of ports, so the coreshouldn't care about the amount of ports available.
This patch makes the number of ports available to the AHCI core runtimeconfigurable, allowing us to have multiple different AHCI implementations...
ahci: Implement HBA reset
The ahci code was missing its soft reset functionality. This wasn't really anissue for Linux guests, but Windows gets confused when the controller doesn'treset when it tells it so.
Using this patch I can now successfully boot Windows 7 from AHCI using AHCI...
ahci: send init d2h fis on fis enable
The drive sends a d2h init fis on initialization. Usually, the guest doesn'treceive fises yet at that point though, so the delivery is deferred.
Let's reflect that by sending the init fis on fis receive enablement....
ahci: split ICH and AHCI even more
Sebastian's patch already did a pretty good job at splitting up ICH-9AHCI code and the AHCI core. We need some more though. Copyright was missing,the lspci dump belongs to ICH-9, we don't need the AHCI core to have its...
ahci: add license header in ahci.h
Due to popular request, this patch adds a license header to ahci.h
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ahci: split ICH9 from core
There are multiple ahci devices out there. The currently implemented ich-9is only one of the many. So let's split that one out into a separate fileto stress the difference.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>Signed-off-by: Alexander Graf <agraf@suse.de>...
block/vdi: Fix wrong size in conditionally used memset, memcmp
Error report from cppcheck:block/vdi.c:122: error: Using sizeof for array given as function argument returns the size of pointer.block/vdi.c:128: error: Using sizeof for array given as function argument returns the size of pointer....
Documentation: add Sheepdog disk images
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qcow2: Really use cache=unsafe for image creation
For cache=unsafe we also need to set BDRV_O_CACHE_WB, otherwise we have somestrange unsafe writethrough mode.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
checkpatch.pl: don't complain about old lines with tabs
Don't complain when the patch includes lines with tabsonly in the hunk's untouched context.