Commit Graph

11673 Commits

Author SHA1 Message Date
Amit Shah e85ba9b2dc virtio-serial: Handle scatter/gather input from the guest
Current guests don't send more than one iov but it can change later.
Ensure we handle that case.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:22 -05:00
Amit Shah e61da14d60 virtio-serial: Handle scatter-gather buffers for control messages
Current control messages are small enough to not be split into multiple
buffers but we could run into such a situation in the future or a
malicious guest could cause such a situation.

So handle the entire iov request for control messages.

Also ensure the size of the control request is >= what we expect
otherwise we risk accessing memory that we don't own.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Reported-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:22 -05:00
Amit Shah fa6111f215 iov: Add iov_to_buf and iov_size helpers
iov_to_buf() puts the buffer contents in the iov in a linearized buffer.

iov_size() gets the length of the contents in the iov.

The iov_to_buf() function is the memcpy_to_iovec() function that was
used in virtio-ballon.c.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:22 -05:00
Amit Shah e4d5639dbb iov: Introduce a new file for helpers around iovs, add iov_from_buf()
The virtio-net code uses iov_fill() which fills an iov from a linear
buffer. The virtio-serial-bus code does something similar in an
open-coded function.

Create a new iov.c file that has iov_from_buf().

Convert virtio-net and virtio-serial-bus over to use this functionality.
virtio-net used ints to hold sizes, the new function is going to use
size_t types.

Later commits will add the opposite functionality -- going from an iov
to a linear buffer.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:22 -05:00
Amit Shah 3ecb45f893 virtio-serial: Send out guest data to ports only if port is opened
Data should be written only when ports are open.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 4048c7c321 virtio-serial: Propagate errors in initialising ports / devices in guest
If adding of ports or devices in the guest fails we can send out a QMP
event so that management software can deal with it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 71c092e92b virtio-serial: Update copyright year to 2010
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah e30f328c74 virtio-serial: Remove redundant check for 0-sized write request
The check for a 0-sized write request to a guest port is not necessary;
the while loop below won't be executed in this case and all will be
fine.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 306eb457fd virtio-serial: whitespace: match surrounding code
The virtio-serial code doesn't mix declarations and definitions, so
separate them out on different lines.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 055b889f94 virtio-serial: Use control messages to notify guest of new ports
Allow the port 'id's to be set by a user on the command line. This is
needed by management apps that will want a stable port numbering scheme
for hot-plug/unplug and migration.

Since the port numbers are shared with the guest (to identify ports in
control messages), we just send a control message to the guest
indicating addition of new ports (hot-plug) or notifying the guest of
the available ports when the guest sends us a DEVICE_READY control
message.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 31abe21f4f virtio-serial: save/load: Send target host connection status if different
If the host connection to a port is closed on the destination machine
after migration, whereas the connection was open on the source, the
guest has to be informed of that.

Similar for a host connection open on the destination.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 16af2e3c35 virtio-serial: save/load: Ensure we have hot-plugged ports instantiated
If some ports that were hot-plugged on the source are not available on
the destination, fail migration instead of trying to deref a NULL
pointer.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah 295587f747 virtio-serial: save/load: Ensure nr_ports on src and dest are same.
The number of ports on the source as well as the destination machines
should match. If they don't, it means some ports that got hotplugged on
the source aren't instantiated on the destination. Or that ports that
were hot-unplugged on the source are created on the destination.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Amit Shah e245795b50 virtio-serial: save/load: Ensure target has enough ports
The target could be started with max_nr_ports for a virtio-serial device
lesser than what was available on the source machine. Fail the migration
in such a case.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-28 08:58:21 -05:00
Thomas Monjalon aacf456387 microblaze: fix custom fprintf
Using GCC-4.2.4-1ubuntu4, there is a warning:
	microblaze-dis.c:792: warning: unused variable 'fprintf'

Indeed, fprintf() is shadowed by a custom redefinition but is not used because
of FORTIFY_SOURCE option which replace calls to fprintf() by fprintf_chk().
So, fprintf refers to the libc implementation instead of the qemu one.
It's a bug.

It is fixed by renaming the variable to something different of "fprintf".
It prevents from hazardous shadowing.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-27 18:56:11 +00:00
Richard Henderson 14a6063a91 Implement cpu_get_real_ticks for Alpha.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:42 +02:00
Richard Henderson 18f8e2c08b target-alpha: Implement RPCC.
A minimal implementation that more or less corresponds to the
user-level version used by target-i386.  More hoops will want
to be jumped through when alpha gets system-level emulation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:42 +02:00
Richard Henderson 6910b8f66a target-alpha: Fix load-locked/store-conditional.
Use an exception plus start_exclusive to implement the compare-and-swap.
This follows the example set by the MIPS and PPC ports.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 8aa3fa2038 target-alpha: Indicate NORETURN status when raising exception.
When (indirectly) calling raise_exception, don't emit cleanup
code at the end of the TB, as it is unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson a4b388ff51 target-alpha: Enable NPTL.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 49563a7274 target-alpha: Update commentary for opcode 0x1A.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 4af7037462 target-alpha: Emit goto_tb opcodes.
Use an ExitStatus enumeration instead of magic numbers as the return
value from translate_one.  Emit goto_tb opcodes when ending a TB via
a direct branch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 593f17e5f2 target-alpha: Implement cvtlq inline.
It's a simple shift and mask sequence.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson ac316ca4b7 target-alpha: Implement rs/rc properly.
This is a per-cpu flag; there's no need for a spinlock of any kind.

We were also failing to manipulate the flag with $31 as a target reg
and failing to clear the flag on execution of a return-from-interrupt
instruction.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson dc96be4b97 target-alpha: Implement cpys{, n, e} inline.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Anthony Liguori caa972256d Merge remote branch 'qmp/for-anthony' into staging 2010-04-26 15:10:14 -05:00
Paolo Bonzini e53f27b9d9 stash away SCM_RIGHTS fd until a getfd command arrives
If there is already a fd in s->msgfd before recvmsg it is
closed by parts that this patch does not touch.  So, only
one descriptor can be "leaked" by attaching it to a command
other than getfd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 16:36:31 -03:00
Jan Kiszka 97331287ed chardev: Document mux option
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 16:36:31 -03:00
Jan Kiszka 157b931987 monitor: Reorder intialization to drop initial mux focus
So far a multiplexed monitor started disabled. Restore this property for
the new way of configuring by moving the monitor initialization before
all devices (the last one to attach to a char-mux will gain the focus).

Once we have a real use case for that, we may also consider assigning
the initial focus explicitly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 16:36:31 -03:00
Jan Kiszka 140e065d72 monitor: Cleanup ID assignment for compat switch
Canonicalize the ID assignment when creating monitor devices via the
legacy switch and use less easily colliding names.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 16:36:31 -03:00
Luiz Capitulino 0e8d2b5575 Monitor: Return before exiting with 'quit'
The 'quit' Monitor command (implemented by do_quit()) calls
exit() directly, this is problematic under QMP because QEMU
exits before having a chance to send the ok response.

Clients don't know if QEMU exited because of a problem or
because the 'quit' command has been executed.

This commit fixes that by moving the exit() call to the main
loop, so that do_quit() requests the system to quit, instead
of calling exit() directly.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 16:36:01 -03:00
Richard Henderson 70ec48ef55 tcg-hppa: Remove automatically implemented opcodes.
Remove neg, ext8u, ext16u, as requested.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:18 +02:00
Richard Henderson 2d097a83e2 tcg-hppa: Fix branch offset during retranslation.
Branch offsets should only be overwritten during relocation,
to support partial retranslation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:17 +02:00
Richard Henderson 739734cb5c tcg-hppa: Schedule the address masking after the TLB load.
Issue the tlb load as early as possible and perform the address
masking while the load is completing.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:17 +02:00
Richard Henderson f061b40e91 tcg-hppa: Fix softmmu loads and stores.
Along the tlb hit path, we were modifying the variables holding the input
register numbers, which lead to incorrect expansion of the tlb miss path.
Fix this by extracting the tlb hit path to separate functions with their
own local variables.  This also makes the difference between softmmu and
user-only easier to read.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:17 +02:00
Richard Henderson 884d348b7b tcg-hppa: Fix GUEST_BASE initialization in prologue.
Load from the guest_base variable rather than embed a constant.
Always reserve TCG_GUEST_BASE_REG if guest base support enabled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:17 +02:00
Richard Henderson 0085bd5161 tcg-hppa: Constrain immediate inputs to and_i32, or_i32, andc_i32.
Define "M" constraint for and_mask_p and "O" constraint for or_mask_p.
Assume that inputs are correct in tcg_out_ori and tcg_out_andi.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-26 20:06:17 +02:00
Richard Henderson ed18c5ce1d linux-user: Fix sparc32plus stat64 syscalls.
Check TARGET_ABI_BITS, not TARGET_LONG_BITS, when deciding
whether or not the guest needs special 64-bit stat translation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-26 17:30:17 +00:00
Richard Henderson 060718c194 target-sparc: Fix -singlestep.
Single-stepping was not properly updating npc, resulting in some
instructions being executed twice.  In addition, we were emitting
dead code at the end of the TB.

Fix both by teaching gen_goto_tb to avoid goto_tb for single-step
and removing the special-case code in gen_intermediate_code_internal.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-26 17:23:58 +00:00
Marcelo Tosatti 6164e6d6e8 kvm_init_vcpu requires global lock held
Since it accesses data protected by the lock.

Signed-off-by: Avi Kivity <avi@redhat.com>
2010-04-26 11:28:35 -03:00
Sheng Yang 204204308b kvm: allow qemu to set EPT identity mapping address
If we use larger BIOS image than current 256KB, we would need move reserved
TSS and EPT identity mapping pages. Currently TSS support this, but not
EPT.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-04-26 11:28:35 -03:00
Marcelo Tosatti 7c80eef899 kvm: handle internal error
Port qemu-kvm's KVM_EXIT_INTERNAL_ERROR handling to upstream.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-04-26 11:28:35 -03:00
Marcelo Tosatti b5e5a93417 target-i386: print EFER in cpu_dump_state
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-04-26 11:28:35 -03:00
Jan Kiszka ff44f1a373 KVM: x86: Add debug register saving and restoring
Make use of the new KVM_GET/SET_DEBUGREGS to save/restore the x86 debug
registers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-04-26 11:28:35 -03:00
Luiz Capitulino 04f8c053cc QMP: Check "arguments" member's type
Otherwise the following input crashes QEMU:

{ "execute": "migrate", "arguments": "tcp:0:4446" }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 11:17:19 -03:00
Luiz Capitulino abaf2f5271 QError: Improve QERR_QMP_BAD_INPUT_OBJECT desc
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 11:17:14 -03:00
Luiz Capitulino 88f7db8462 QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER
The QERR_QMP_BAD_INPUT_OBJECT error is going to be used only
for two problems: the input is not an object or the "execute"
key is missing.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 11:17:09 -03:00
Luiz Capitulino 7dfb61238a QError: New QERR_QMP_BAD_INPUT_OBJECT_MEMBER
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-04-26 11:17:02 -03:00
Blue Swirl a303f9e37b sh4: remove dead assignments, spotted by clang analyzer
Value stored is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25 20:42:43 +00:00
Blue Swirl 9fad3eb7fa ppc: add missing 'break', spotted by clang analyzer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25 20:33:43 +00:00