sim-card
/
qemu
Archived
10
0
Fork 0
Commit Graph

13804 Commits

Author SHA1 Message Date
Jan Kiszka e07bbac542 Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:46 -02:00
Jan Kiszka 0ab07c623c 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>
2011-02-14 12:39:46 -02:00
Jan Kiszka 1640032283 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 the
same with any_cpu_has_work.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:46 -02:00
Jan Kiszka 7e97cd8814 Refactor kvm&tcg function names in cpus.c
Pure interface cosmetics: Ensure that only kvm core services (as
declared in kvm.h) start with "kvm_". Prepend "qemu_" to those that
violate this rule in cpus.c. Also rename the corresponding tcg functions
for the sake of consistency.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:46 -02:00
Glauber Costa b8cc45d6a6 kvm: make tsc stable over migration and machine start
If the machine is stopped, we should not record two different tsc values
upon a save operation. The same problem happens with kvmclock.

But kvmclock is taking a different diretion, being now seen as a separate
device. Since this is unlikely to happen with the tsc, I am taking the
approach here of simply registering a handler for state change, and
using a per-CPUState variable that prevents double updates for the TSC.

Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:46 -02:00
Jan Kiszka cdea50ede1 kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN
The reset we issue on KVM_EXIT_SHUTDOWN implies that we should also
leave the VCPU loop. As we now check for exit_request which is set by
qemu_system_reset_request, this bug is no longer critical. Still it's an
unneeded extra turn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka b30e93e9ec kvm: Remove static return code of kvm_handle_io
Improve the readability of the exit dispatcher by moving the static
return value of kvm_handle_io to its caller.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 9ccfac9ea4 kvm: Unconditionally reenter kernel after IO exits
KVM requires to reenter the kernel after IO exits in order to complete
instruction emulation. Failing to do so will leave the kernel state
inconsistently behind. To ensure that we will get back ASAP, we issue a
self-signal that will cause KVM_RUN to return once the pending
operations are completed.

We can move kvm_arch_process_irqchip_events out of the inner VCPU loop.
The only state that mattered at its old place was a pending INIT
request. Catch it in kvm_arch_pre_run and also trigger a self-signal to
process the request on next kvm_cpu_exec.

This patch also fixes the missing exit_request check in kvm_cpu_exec in
the CONFIG_IOTHREAD case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 46d62fac8a Introduce VCPU self-signaling service
Introduce qemu_cpu_kick_self to send SIG_IPI to the calling VCPU
context. First user will be kvm.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 6d9cb73c1b kvm: Add MCE signal support for !CONFIG_IOTHREAD
Currently, we only configure and process MCE-related SIGBUS events if
CONFIG_IOTHREAD is enabled. The groundwork is laid, we just need to
factor out the required handler registration and system configuration.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka de758970b6 kvm: Fix race between timer signals and vcpu entry under !IOTHREAD
Found by Stefan Hajnoczi: There is a race in kvm_cpu_exec between
checking for exit_request on vcpu entry and timer signals arriving
before KVM starts to catch them. Plug it by blocking both timer related
signals also on !CONFIG_IOTHREAD and process those via signalfd.

As this fix depends on real signalfd support (otherwise the timer
signals only kick the compat helper thread, and the main thread hangs),
we need to detect the invalid constellation and abort configure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka d0f294cec0 Set up signalfd under !CONFIG_IOTHREAD
Will be required for SIGBUS handling. For obvious reasons, this will
remain 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>
2011-02-14 12:39:45 -02:00
Jan Kiszka 9a36085b86 kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD
Move qemu_kvm_eat_signals around and call it also when the IO-thread is
not used. Do not yet process SIGBUS, will be armed in a separate step.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 5db5bdacdf kvm: Refactor qemu_kvm_eat_signals
We do not use the timeout, so drop its logic. As we always poll our
signals, we do not need to drop the global lock. Removing those calls
allows some further simplifications. Also fix the error processing of
sigpending at this chance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka ff48eb5fe7 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 for
self-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As
Windows doesn't support signal services, we need to provide a stub for
the init function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 55f8d6ac3e Refactor signal setup functions in cpus.c
Move {tcg,kvm}_init_ipi and block_io_signals to avoid prototypes, rename
the former two to clarify that they deal with more than SIG_IPI. No
functional changes - except for the tiny fixup of strerror usage.

The forward declaration of sigbus_handler is just temporarily, it will
be moved in a succeeding patch. dummy_signal is moved into the !_WIN32
block as we will soon need it also for !CONFIG_IOTHREAD.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka a1b87fe046 kvm: Provide sigbus services arch-independently
Provide arch-independent kvm_on_sigbus* stubs to remove the #ifdef'ery
from cpus.c. This patch also fixes --disable-kvm build by providing the
missing kvm_on_sigbus_vcpu kvm-stub.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 84b4915dd2 kvm: Handle kvm_init_vcpu errors
Do not ignore errors of kvm_init_vcpu, they are fatal.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka d31ae052a9 kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 748a680b96 kvm: Report proper error on GET_VCPU_MMAP_SIZE failures
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:45 -02:00
Jan Kiszka 46481d3921 Flatten the main loop
First of all, vm_can_run is a misnomer, it actually means "no request
pending". Moreover, there is no need to check all pending requests
twice, the first time via the inner loop check and then again when
actually processing the requests. We can simply remove the inner loop
and do the checks directly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Jan Kiszka 8e1b90ecc5 Leave inner main_loop faster on pending requests
If there is any pending request that requires us to leave the inner loop
if main_loop, makes sure we do this as soon as possible by enforcing
non-blocking IO processing.

At this change, move variable definitions out of the inner loop to
improve readability.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Jan Kiszka 38145df24c Trigger exit from cpu_exec_all on pending IO events
Except for timer events, we currently do not leave the loop over all
VCPUs if an IO event was filed. That may cause unexpected IO latencies
under !CONFIG_IOTHREAD in SMP scenarios. Fix it by setting the global
exit_request which breaks the loop.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Jan Kiszka 1745eaaa7c 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 threads
were simply ignored.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Jan Kiszka b4a3d965de Stop current VCPU on synchronous reset requests
If some I/O operation ends up calling qemu_system_reset_request in VCPU
context, we record this and inform the io-thread, but we do not
terminate the VCPU loop. This can lead to fairly unexpected behavior if
the triggering reset operation is supposed to work synchronously.

Fix this for TCG (when run in deterministic I/O mode) by setting the
VCPU on stop and issuing a cpu_exit. KVM requires some more work on its
VCPU loop.

[ ported from qemu-kvm ]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Jan Kiszka aa2c364b4c Prevent abortion on multiple VCPU kicks
If we call qemu_cpu_kick more than once before the target was able to
process the signal, pthread_kill will fail, and qemu will abort. Prevent
this by avoiding the redundant signal.

This logic can be found in qemu-kvm as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14 12:39:44 -02:00
Blue Swirl 8668f61d20 vmmouse: fix queue_size field initialization
Initialize the field queue_size, dropped by
91c9e09147.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 17:44:11 +00:00
Blue Swirl dd703b991c hpet: make optional
Ignore failure with hpet device creation.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:45:06 +00:00
Blue Swirl 4912371fc3 sysbus: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:45:03 +00:00
Blue Swirl 86d864140b x86: make vmmouse optional
Compile vmmouse in hwlib. Ignore failure if vmmouse device can't be
created.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:43:44 +00:00
Blue Swirl 86f4a9a5c7 isa: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:43:41 +00:00
Blue Swirl 91c9e09147 vmmouse: convert to qdev
Convert to qdev, also add a proper reset function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 09:34:56 +00:00
Blue Swirl 6872ef610b vmport: convert to qdev
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:28:24 +00:00
Blue Swirl 7ba7e49e6a x86,MIPS: make vmware_vga optional
Allow failure with vmware_vga device creation and use standard
VGA instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:28:22 +00:00
Blue Swirl 7cc050b165 pci: add creation functions that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:58 +00:00
Blue Swirl 0bcdeda7e4 qdev: add creation function that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:55 +00:00
Blue Swirl 5c81e4ca9e vmware_vga: refactor device creation
Turn vmsvga_init into an inline function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12 08:27:53 +00:00
Andrzej Zaborowski 55619bb667 mst_fpga: Drop one more pxa.h inclusion.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:35:20 +01:00
Dmitry Eremin-Solenikov c8ba63f829 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>
2011-02-11 23:31:17 +01:00
Dmitry Eremin-Solenikov 987e8b3b03 max7310: finish qdev'ication
1) Move GPIO-related functionality to qdev. Now one can use directly
qdev_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>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:17 +01:00
Dmitry Eremin-Solenikov 2e4b4e79c6 tosa: we aren't connected to VBus, pass this info to Linux kernel
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov bb70651e45 mainstone: pass one irq to the mst_fpga instead of the whole PIC
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov 21c75ddbf9 Drop unnecessary inclusions of pxa.h header
Seceral files contained onnecessary dependencies on hw/pxa.h header.
Drop unused references.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov 7fe63a170a Add scoop post_load callback that sets IRQs to loaded levels
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 23:31:16 +01:00
Dmitry Eremin-Solenikov f23c1b2a38 tc6393xb: correct NAND isr assertion
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:52:04 +01:00
Dmitry Eremin-Solenikov 0fba9fd6c3 sysbus: print number of irqs in dev_print
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:13:52 +01:00
Dmitry Eremin-Solenikov 7a719c7ce5 .gitignore: ignore vi swap files and ctags files
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:13:13 +01:00
Dmitry Eremin-Solenikov 3213883efa arm: drop unused irq-related part of CPUARMState
These two fields were added as a part of ARMv7 support patch (back in
2007), 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>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-02-11 01:10:13 +01:00
Peter Maydell f2f27b9f9b 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 top
of the file anyway.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-10 21:21:30 +01:00
Peter Maydell 005e1a0a02 linux-user/arm: fix compilation failures using softfloat's struct types
Add uses of the float32/float64 boxing and unboxing macros so that
the ARM linux-user targets will compile with USE_SOFTFLOAT_STRUCT_TYPES
enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-10 20:18:36 +01:00