sdk/emulator/qemu.git
12 years agoxhci: implement mfindex
Gerd Hoffmann [Tue, 21 Aug 2012 10:32:58 +0000 (12:32 +0200)]
xhci: implement mfindex

Implement mfindex register and mfindex wrap event.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoxhci: move device lookup into xhci_setup_packet
Gerd Hoffmann [Fri, 24 Aug 2012 12:21:39 +0000 (14:21 +0200)]
xhci: move device lookup into xhci_setup_packet

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoxhci: drop buffering
Gerd Hoffmann [Fri, 17 Aug 2012 09:04:36 +0000 (11:04 +0200)]
xhci: drop buffering

This patch splits the xhci_xfer_data function into three.
The xhci_xfer_data function used to do does two things:

  (1) copy transfer data between guest memory and a temporary buffer.
  (2) report transfer results to the guest using events.

Now we three functions to handle this:

  (1) xhci_xfer_map creates a scatter list for the transfer and
      uses that (instead of the temporary buffer) to build a
      USBPacket.
  (2) xhci_xfer_unmap undoes the mapping.
  (3) xhci_xfer_report sends out events.

The patch also fixes reporting of transaction errors which must be
reported unconditinally, not only in case the guest asks for it
using the ISP flag.

[ v2: fix warning ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoxhci: rip out background transfer code
Gerd Hoffmann [Fri, 17 Aug 2012 12:05:21 +0000 (14:05 +0200)]
xhci: rip out background transfer code

original xhci code (the one which used libusb directly) used to use
'background transfers' for iso streams.  In upstream qemu the iso
stream buffering is handled by usb-host & usb-redir, so we will
never ever need this.  It has been left in as reference, but is dead
code anyway.  Rip it out.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-audio: fix usb version
Gerd Hoffmann [Tue, 28 Aug 2012 14:43:34 +0000 (16:43 +0200)]
usb-audio: fix usb version

usb-audio is a full speed (1.1) device,
but bcdUSB claims it is usb 2.0.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoBetter name usb braille device
Samuel Thibault [Thu, 23 Aug 2012 07:59:27 +0000 (09:59 +0200)]
Better name usb braille device

Windows users need to know that they have to use the Baum driver to make
the qemu braille device work.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Enable pipelining for bulk endpoints
Hans de Goede [Mon, 3 Sep 2012 11:44:04 +0000 (13:44 +0200)]
usb-redir: Enable pipelining for bulk endpoints

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Ensure our peer has the necessary caps when redirecting to XHCI
Hans de Goede [Mon, 3 Sep 2012 10:04:49 +0000 (12:04 +0200)]
usb-redir: Ensure our peer has the necessary caps when redirecting to XHCI

In order for redirection to work properly when redirecting to an emulated
XHCI controller, the usb-redir-host must support both
usb_redir_cap_ep_info_max_packet_size and usb_redir_cap_64bits_ids,
reject any devices redirected to an XHCI controller when these are not
supported.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Add a usbredir_reject_device helper function
Hans de Goede [Mon, 3 Sep 2012 09:53:28 +0000 (11:53 +0200)]
usb-redir: Add a usbredir_reject_device helper function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Set ep max_packet_size if available
Hans de Goede [Mon, 3 Sep 2012 09:49:07 +0000 (11:49 +0200)]
usb-redir: Set ep max_packet_size if available

This is needed for usb-redir to work properly with the xhci emulation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Convert to new libusbredirparser 0.5 API
Hans de Goede [Fri, 31 Aug 2012 11:41:38 +0000 (13:41 +0200)]
usb-redir: Convert to new libusbredirparser 0.5 API

This gives us support for 64 bit ids which is needed for using XHCI with
the new hcd generated ids.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Return babble when getting more bulk data then requested
Hans de Goede [Tue, 28 Aug 2012 09:33:47 +0000 (11:33 +0200)]
usb-redir: Return babble when getting more bulk data then requested

Babble is the appropriate error in this case (rather then signalling a stall).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Move to core packet id and queue handling
Hans de Goede [Tue, 28 Aug 2012 09:30:13 +0000 (11:30 +0200)]
usb-redir: Move to core packet id and queue handling

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Get rid of unused async-struct dev member
Hans de Goede [Tue, 28 Aug 2012 07:08:45 +0000 (09:08 +0200)]
usb-redir: Get rid of unused async-struct dev member

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Get rid of local shadow copy of packet headers
Hans de Goede [Tue, 28 Aug 2012 07:05:38 +0000 (09:05 +0200)]
usb-redir: Get rid of local shadow copy of packet headers

The shadow copy only serves as an extra check (besides the packet-id) to
ensure the packet we get back is a reply to the packet we think it is.

This check has never triggered in all the time usb-redir is in use now,
and since the verified data in the returned packet-header is not used
otherwise, removing the check does not open any possibilities for the
usbredirhost to confuse us.

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Get rid of async-struct get member
Hans de Goede [Mon, 27 Aug 2012 14:33:08 +0000 (16:33 +0200)]
usb-redir: Get rid of async-struct get member

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Don't delay handling of open events to a bottom half
Hans de Goede [Thu, 23 Aug 2012 14:37:19 +0000 (16:37 +0200)]
usb-redir: Don't delay handling of open events to a bottom half

There is no need for this, and doing so means that a backend trying to
write immediately after an open event will see qemu_chr_be_can_write
returning 0, which not all backends handle well as there is no wakeup
mechanism to detect when the frontend does become writable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-redir: Never return USB_RET_NAK for async handled packets
Hans de Goede [Fri, 17 Aug 2012 15:27:08 +0000 (17:27 +0200)]
usb-redir: Never return USB_RET_NAK for async handled packets

USB_RET_NAK is not a valid response for async handled packets (and will
trigger an assert as such).

Also drop the warning when receiving a status of cancelled for packets not
cancelled by qemu itself, this can happen when a device gets unredirected
by the usbredir-host while transfers are pending.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: Correct a comment in fetchqtd packet processing
Hans de Goede [Mon, 3 Sep 2012 10:17:48 +0000 (12:17 +0200)]
ehci: Correct a comment in fetchqtd packet processing

Since my previous comment said "Should never happen", I tried changing the
next line to an assert(0), which did not go well, which as the new comments
explains is logical if you think about it for a moment.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: Handle USB_RET_PROCERR in ehci_fill_queue
Hans de Goede [Mon, 3 Sep 2012 09:35:58 +0000 (11:35 +0200)]
ehci: Handle USB_RET_PROCERR in ehci_fill_queue

USB_RET_PROCERR can be triggered by the guest (by for example requesting more
then BUFFSIZE bytes), so don't assert on it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: Fix memory leak in handling of NAK-ed packets
Hans de Goede [Mon, 3 Sep 2012 09:01:13 +0000 (11:01 +0200)]
ehci: Fix memory leak in handling of NAK-ed packets

Currently each time we try to execute a NAK-ed packet we redo
ehci_init_transfer, and usb_packet_map, re-allocing (without freeing) the
sg list every time.

This patch fixes this, it does this by introducing another async state, so
that we also properly cleanup a NAK-ed packet on cancel.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: Add some additional ehci_trace_guest_bug() calls
Hans de Goede [Mon, 3 Sep 2012 08:22:16 +0000 (10:22 +0200)]
ehci: Add some additional ehci_trace_guest_bug() calls

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: add doorbell trace events
Gerd Hoffmann [Fri, 31 Aug 2012 10:41:43 +0000 (12:41 +0200)]
ehci: add doorbell trace events

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: trace guest bugs
Gerd Hoffmann [Fri, 31 Aug 2012 08:44:21 +0000 (10:44 +0200)]
ehci: trace guest bugs

make qemu_queue_{cancel,reset} return the number of packets released,
so the caller can figure whenever there have been active packets even
though there shouldn't have been any.  Add tracepoint to log this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: check for EHCI_ASYNC_FINISHED first in ehci_free_packet
Gerd Hoffmann [Fri, 31 Aug 2012 08:31:54 +0000 (10:31 +0200)]
ehci: check for EHCI_ASYNC_FINISHED first in ehci_free_packet

Otherwise we'll see the packet free twice in the trace log even though
it actually happens only once.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: Properly report completed but not yet processed packets to the guest
Hans de Goede [Thu, 30 Aug 2012 13:18:24 +0000 (15:18 +0200)]
ehci: Properly report completed but not yet processed packets to the guest

Reported packets which have completed before being cancelled as such to the
host. Note that the new code path this patch adds is untested since it I've
been unable to actually trigger the race which needs this code path.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 years agoehci: Properly cleanup packets on cancel
Hans de Goede [Thu, 30 Aug 2012 13:00:33 +0000 (15:00 +0200)]
ehci: Properly cleanup packets on cancel

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 years agoehci: Update copyright headers to reflect recent work
Hans de Goede [Tue, 28 Aug 2012 14:21:12 +0000 (16:21 +0200)]
ehci: Update copyright headers to reflect recent work

Update copyright headers to reflect all the work Gerd and I have been doing
on the EHCI emulation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 years agoehci: Validate qh is not changed unexpectedly by the guest
Hans de Goede [Wed, 29 Aug 2012 08:37:37 +0000 (10:37 +0200)]
ehci: Validate qh is not changed unexpectedly by the guest

-combine the qh check with the check for devaddr changes
-also ensure that p gets set to NULL when the queue gets cancelled on
 devaddr change, which was not done properly before this patch

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 years agoRevert "ehci: don't flush cache on doorbell rings."
Hans de Goede [Wed, 29 Aug 2012 08:12:52 +0000 (10:12 +0200)]
Revert "ehci: don't flush cache on doorbell rings."

This reverts commit 9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0, which got
added to fix an issue where the real, underlying cause was not stopping
the ep queue on an error.

Now that the underlying cause is fixed by the "usb: Halt ep queue and
cancel pending packets on a packet error" patch, the "don't flush" fix
is no longer needed.

Not only is it not needed, it causes us to see cancellations (unlinks)
done by the Linux EHCI driver too late, which in combination with the new
usb-core packet-id generation where qtd addresses are used as ids, causes
duplicate ids for in flight packets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
12 years agousb-core: Allow the first packet of a pipelined ep to complete immediately
Hans de Goede [Mon, 3 Sep 2012 10:48:49 +0000 (12:48 +0200)]
usb-core: Allow the first packet of a pipelined ep to complete immediately

This can happen with usb-redir live-migration when the packet gets re-queued
after the migration and the original queuing from the migration source side
has already finished.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-core: Add a usb_ep_find_packet_by_id() helper function
Hans de Goede [Tue, 28 Aug 2012 07:43:18 +0000 (09:43 +0200)]
usb-core: Add a usb_ep_find_packet_by_id() helper function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-core: Don't set packet state to complete on a nak
Hans de Goede [Mon, 3 Sep 2012 10:33:44 +0000 (12:33 +0200)]
usb-core: Don't set packet state to complete on a nak

This way the hcd can re-use the same packet to retry without needing
to re-init it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: controllers do not need to check for babble themselves
Hans de Goede [Fri, 17 Aug 2012 09:39:16 +0000 (11:39 +0200)]
usb: controllers do not need to check for babble themselves

If an (emulated) usb-device tries to write more data to a packet then
its iov len, this will trigger an assert in usb_packet_copy(), and if
a driver somehow circumvents that check and writes more data to the
iov then there is space, we have a much bigger problem then not correctly
reporting babble to the guest.

In practice babble will only happen with (real) redirected devices, and there
both the usb-host os and the qemu usb-device code already check for it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoAdd ability to force enable/disable of tools build
Daniel P. Berrange [Mon, 10 Sep 2012 11:26:29 +0000 (12:26 +0100)]
Add ability to force enable/disable of tools build

The qemu-img, qemu-nbd and qemu-io tools are built conditionally
based on whether any softmmu target is enabled. These are useful
self-contained tools which can be used in many other scenarios.
Add new --enable-tools/--disable-tools args to configure to allow
the user to explicitly turn on / off their build. The default
behaviour is now to build these tools are all times, regardless
of whether any softmmu target is enabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd ability to disable build of all targets
Daniel P. Berrange [Mon, 10 Sep 2012 11:27:21 +0000 (12:27 +0100)]
Add ability to disable build of all targets

Allow passing of '--target-list=' to configure to request that
all targets are to be disabled. This allows for doing a very
fast tools-only build of things like qemu-img, qemu-io, qemu-nbd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Remove the current_tm field
Paolo Bonzini [Thu, 2 Aug 2012 16:04:13 +0000 (18:04 +0200)]
RTC: Remove the current_tm field

This is not used anymore and only written to.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Get and set time without going through s->current_tm
Paolo Bonzini [Thu, 2 Aug 2012 16:04:12 +0000 (18:04 +0200)]
RTC: Get and set time without going through s->current_tm

This patch makes rtc_set_time and rtc_set_cmos work without reading
s->current_tm.  In the case of rtc_set_time I introduce a new
function that retrieves the time and stores into a given struct tm
(not hard-coded to s->current_tm).  In the case of rtc_set_cmos, the
current time is similarly taken from a struct tm rather than
s->current_tm.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Do not fire timer periodically to catch next alarm
Paolo Bonzini [Thu, 2 Aug 2012 16:04:11 +0000 (18:04 +0200)]
RTC: Do not fire timer periodically to catch next alarm

This patch limits further the usage of a periodic timer.  It computes the
time of the next alarm, and uses it to skip all intermediate occurrences
of the timer.

Cc: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Add divider reset support
Yang Zhang [Thu, 2 Aug 2012 16:04:10 +0000 (18:04 +0200)]
RTC: Add divider reset support

The first update cycle begins one-half seconds after divider
reset is removed.  This feature is useful for testing.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Update the RTC clock only when reading it
Yang Zhang [Thu, 2 Aug 2012 16:04:09 +0000 (18:04 +0200)]
RTC: Update the RTC clock only when reading it

Calculate guest RTC based on the time of the last update, instead of
using timers.  The formula is

    (base_rtc + guest_time_now - guest_time_last_update + offset)

Base_rtc is the RTC value when the RTC was last updated.
Guest_time_now is the guest time when the access happens.
Guest_time_last_update was the guest time when the RTC was last updated.
Offset is used when divider reset happens or the set bit is toggled.

The timer is kept in order to signal interrupts, but it only needs to
run when either UF or AF is cleared.  When the bits are both set, the
timer does not run.

UIP is now synthesized when reading register A.  If the timer is not set,
or if there is more than one second before it (as is the case at the
end of this series), the leading edge of UIP is computed and the rising
edge occurs 220us later.  If the update timer occurs within one second,
however, the rising edge of the AF and UF bits should coincide withe
the falling edge of UIP.  We do not know exactly when this will happen
because there could be delays in the servicing of the timer.  Hence, in
this case reading register A only computes for the rising edge of UIP,
and latches the bit until the timer is fired and clears it.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovmstate: add VMSTATE_TIMER_V
Paolo Bonzini [Thu, 2 Aug 2012 16:04:08 +0000 (18:04 +0200)]
vmstate: add VMSTATE_TIMER_V

Also, for consistency with other occurrences, implement VMSTATE_TIMER
as a special case of VMSTATE_TIMER_V rather than VMSTATE_TIMER_TEST.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Update interrupt state when interrupts are masked/unmasked
Yang Zhang [Thu, 2 Aug 2012 16:04:07 +0000 (18:04 +0200)]
RTC: Update interrupt state when interrupts are masked/unmasked

If an interrupt flag is already set when the interrupt becomes enabled,
raise an interrupt immediately, and vice versa if interrupts become
disabled.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: introduce RTC_CLOCK_RATE
Paolo Bonzini [Thu, 2 Aug 2012 16:04:06 +0000 (18:04 +0200)]
RTC: introduce RTC_CLOCK_RATE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Rename rtc_timer_update
Yang Zhang [Thu, 2 Aug 2012 16:04:05 +0000 (18:04 +0200)]
RTC: Rename rtc_timer_update

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Remove the logic to update time format when DM bit changed
Yang Zhang [Thu, 2 Aug 2012 16:04:04 +0000 (18:04 +0200)]
RTC: Remove the logic to update time format when DM bit changed

Changing the DM (binary/BCD) and 24/12 control bit doesn't affect the internal
registers. It only indicates what format is used for those registers.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 10 Sep 2012 17:51:44 +0000 (12:51 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: i386: Add classic PCI device assignment
  kvm: i386: Add services required for PCI device assignment
  kvm: Introduce kvm_has_intx_set_mask
  kvm: Introduce kvm_irqchip_update_msi_route
  kvm: Clean up irqfd API
  qemu: Use valgrind annotations to mark kvm guest memory as defined

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 10 Sep 2012 17:48:43 +0000 (12:48 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  vhost: Pass device path to vhost_dev_init()
  monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
  pcie_aer: clear cmask for Advanced Error Interrupt Message Number
  pcie: drop version_id field for live migration
  qemu: add .exrc

12 years agosocket: don't attempt to reconnect a TCP socket in server mode
Anthony Liguori [Wed, 5 Sep 2012 18:52:49 +0000 (13:52 -0500)]
socket: don't attempt to reconnect a TCP socket in server mode

Commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6 introduced a possible SEGV when
using a socket chardev with server=on because it assumes that all TCP sockets
are in client mode.

This patch adds a check to only reconnect when in client mode.

Cc: Lei Li <lilei@linux.vnet.ibm.com>
Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agouse --libexecdir instead of ignoring it first and reinventing it later
Michael Tokarev [Wed, 6 Jun 2012 21:11:00 +0000 (01:11 +0400)]
use --libexecdir instead of ignoring it first and reinventing it later

Commit 7b93fadf3a38d1ed65ea5536a52efc2772c6e3b8 "Add basic version
of bridge helper" put the bridge helper executable into a fixed
${prefix}/libexec/ location, instead of using ${libexecdir} for
this.  At the same time, --libexecdir is being happily ignored
by ./configure.  Even more, the same patch sets unused $libexecdir
variable in the generated config-host.mak, and uses fixed string
(\${prefix}/libexecdir) for the bridge helper binary.

Fix this braindamage by introducing $libexecdir variable, using
it for the bridge helper binary, and recognizing --libexecdir.

This patch is applicable to stable-1.1.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: Corey Bryant <coreyb@linux.vnet.ibm.com>
Cc: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge branch 'spice.v59' of git://anongit.freedesktop.org/spice/qemu
Aurelien Jarno [Mon, 10 Sep 2012 13:32:11 +0000 (15:32 +0200)]
Merge branch 'spice.v59' of git://anongit.freedesktop.org/spice/qemu

* 'spice.v59' of git://anongit.freedesktop.org/spice/qemu:
  Remove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP
  qxl: Add set_client_capabilities() interface to QXLInterface
  spice: make number of surfaces runtime-configurable.
  configure: print spice-protocol and spice-server versions
  qxl: add QXL_IO_MONITORS_CONFIG_ASYNC
  qxl: disallow unknown revisions
  qxl/update_area_io: guest_bug on invalid parameters
  spice: increase the verbosity of spice section in "qemu --help"
  spice: adding seamless-migration option to the command line
  spice: add 'migrated' flag to spice info
  spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED
  spice: notify on vm state change only via spice_server_vm_start/stop
  spice: notify spice server on vm start/stop
  spice: abort on invalid streaming cmdline params

12 years agoMerge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
Aurelien Jarno [Mon, 10 Sep 2012 13:04:36 +0000 (15:04 +0200)]
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable

* 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable:
  tcx: tcx_screen_dump(): add error handling
  tcx: tcx24_screen_dump(): add error handling
  g364fb: g364fb_screen_dump(): add error handling
  omap_lcdc: omap_ppm_save(): add error handling
  omap_lcdc: rename ppm_save() to omap_ppm_save()
  vga: ppm_save(): add error handling
  qapi: convert screendump
  console: vga_hw_screen_dump_ptr: take Error argument
  error: add error_setg()
  json-parser: Fix potential NULL pointer segfault
  qapi: Fix potential NULL pointer segfault
  qapi: convert sendkey
  monitor: move key_defs[] table and introduce two help functions
  qapi: add the QKeyCode enum
  qapi: generate list struct and visit_list for enum
  hmp: rename arguments
  monitor: rename keyname '<' to 'less'
  fix doc of using raw values with sendkey
  Add support for pretty-printing response in qmp-shell

12 years agohw/mcf5206: Fix buffer overflow for MBAR read / write
Stefan Weil [Tue, 4 Sep 2012 17:37:39 +0000 (19:37 +0200)]
hw/mcf5206: Fix buffer overflow for MBAR read / write

Report from smatch:

mcf5206.c:384 m5206_mbar_readb(7) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:403 m5206_mbar_readw(8) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:427 m5206_mbar_readl(8) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:451 m5206_mbar_writeb(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:475 m5206_mbar_writew(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:503 m5206_mbar_writel(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128

m5206_mbar_width has 0x80 elements and supports 0 <= offset < 0x200.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-arm: Fix potential buffer overflow
Stefan Weil [Tue, 4 Sep 2012 05:35:57 +0000 (07:35 +0200)]
target-arm: Fix potential buffer overflow

Report from smatch:

target-arm/helper.c:651 arm946_prbs_read(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8
target-arm/helper.c:661 arm946_prbs_write(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8

c7_region is an array with 8 elements, so the index must be less than 8.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agohw/wm8750: Fix potential buffer overflow
Stefan Weil [Mon, 3 Sep 2012 20:56:00 +0000 (22:56 +0200)]
hw/wm8750: Fix potential buffer overflow

Report from smatch:

hw/wm8750.c:369 wm8750_tx(12) error: buffer overflow 's->i2c_data' 2 <= 2

It looks like the preprocessor statements were simply misplaced.

Replace also __FUNCTION__ by __func__ to please checkpatch.pl.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agokvm: i386: Add classic PCI device assignment
Jan Kiszka [Thu, 30 Aug 2012 18:30:00 +0000 (20:30 +0200)]
kvm: i386: Add classic PCI device assignment

This adds PCI device assignment for i386 targets using the classic KVM
interfaces. This version is 100% identical to what is being maintained
in qemu-kvm for several years and is supported by libvirt as well. It is
expected to remain relevant for another couple of years until kernels
without full-features and performance-wise equivalent VFIO support are
obsolete.

A refactoring to-do that should be done in-tree is to model MSI and
MSI-X support via the generic PCI layer, similar to what VFIO is already
doing for MSI-X. This should improve the correctness and clean up the
code from duplicate logic.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: i386: Add services required for PCI device assignment
Jan Kiszka [Mon, 27 Aug 2012 06:28:40 +0000 (08:28 +0200)]
kvm: i386: Add services required for PCI device assignment

These helpers abstract the interaction of upcoming pci-assign with the
KVM kernel services. Put them under i386 only as other archs will
implement device pass-through via VFIO and not this classic interface.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Introduce kvm_has_intx_set_mask
Jan Kiszka [Mon, 27 Aug 2012 06:28:39 +0000 (08:28 +0200)]
kvm: Introduce kvm_has_intx_set_mask

Will be used by PCI device assignment code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Introduce kvm_irqchip_update_msi_route
Jan Kiszka [Mon, 27 Aug 2012 06:28:38 +0000 (08:28 +0200)]
kvm: Introduce kvm_irqchip_update_msi_route

This service allows to update an MSI route without releasing/reacquiring
the associated VIRQ. Will be used by PCI device assignment, later on
likely also by virtio/vhost and VFIO.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agotcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
Aurelien Jarno [Sat, 8 Sep 2012 03:45:43 +0000 (03:45 +0000)]
tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0

The load/store slow path has been broken in e141ab52d:
- We need to move 4 registers for store functions and 3 registers for
  load functions and not the reverse.
- According to the s390x calling convention the arguments of a function
  should be zero extended. This means that the register shift should be
  done with TCG_TYPE_I64 to ensure the higher word is correctly zero
  extended when needed.

I am aware that CONFIG_TCG_PASS_AREG0 is being removed and thus that
this patch can be improved, but doing so means it can also be applied to
the 1.1 and 1.2 stable branches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 07:33:40 +0000 (07:33 +0000)]
target-s390x: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflicts]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for misc helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:39 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for misc helpers

Make misc helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:38 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for condition code helpers

Make condition code helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:37 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for integer helpers

Make integer helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for FPU helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:36 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: rename op_helper.c to misc_helper.c
Blue Swirl [Sun, 2 Sep 2012 07:33:35 +0000 (07:33 +0000)]
target-s390x: rename op_helper.c to misc_helper.c

Now op_helper.c contains miscellaneous helpers, rename
it to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split memory access helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:34 +0000 (07:33 +0000)]
target-s390x: split memory access helpers

Move memory access helpers to mem_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fold softmmu include ifdefs together]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:33 +0000 (07:33 +0000)]
target-s390x: split integer helpers

Move integer helpers to int_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:32 +0000 (07:33 +0000)]
target-s390x: split condition code helpers

Move condition code helpers to cc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split FPU ops
Blue Swirl [Sun, 2 Sep 2012 07:33:31 +0000 (07:33 +0000)]
target-s390x: split FPU ops

Move floating point instructions to fpu_helper.c.

While exporting some condition code helpers,
avoid duplicate identifier conflict with translate.c.

Remove unused set_cc_nz_f64() in translate.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: fix style
Blue Swirl [Sun, 2 Sep 2012 07:33:30 +0000 (07:33 +0000)]
target-s390x: fix style

Before splitting op_helper.c and helper.c in the next patches,
fix style issues. No functional changes.

Replace also GCC specific __FUNCTION__ with
standard __func__.

Don't init static variable (cpu_s390x_init:inited) with 0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agokvm: Clean up irqfd API
Jan Kiszka [Mon, 20 Aug 2012 08:55:56 +0000 (10:55 +0200)]
kvm: Clean up irqfd API

No need to expose the fd-based interface, everyone will already be fine
with the more handy EventNotifier variant. Rename the latter to clarify
that we are still talking about irqfds here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoqemu: Use valgrind annotations to mark kvm guest memory as defined
Christian Borntraeger [Fri, 10 Aug 2012 13:11:45 +0000 (15:11 +0200)]
qemu: Use valgrind annotations to mark kvm guest memory as defined

valgrind with kvm produces a big amount of false positives regarding
"Conditional jump or move depends on uninitialised value(s)". This
happens because the guest memory is allocated with qemu_vmalloc which
boils down posix_memalign etc. This function is (correctly) considered
by valgrind as returning undefined memory.

Since valgrind is based on jitting code, it will not be able to see
changes made by the guest to guest memory if this is done by KVM_RUN,
thus keeping most of the guest memory undefined.

Now lots of places in qemu will then use guest memory to change behaviour.
To avoid the flood of these messages, lets declare the whole guest
memory as defined. This will reduce the noise and allows us to see real
problems.

In the future we might want to make this conditional, since there
is actually something that we can use those false positives for:
These messages will point to code that depends on guest memory, so
we can use these backtraces to actually make an audit that is focussed
only at those code places. For normal development we dont want to
see those messages, though.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomusicpal: Fix flash mapping
Jan Kiszka [Sat, 8 Sep 2012 09:52:39 +0000 (11:52 +0200)]
musicpal: Fix flash mapping

The old arithmetic assumed 32 physical address bits which is no longer
true for ARM since 3cc0cd61f4.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd MAINTAINERS entry for leon3
Fabien Chouteau [Tue, 22 May 2012 08:14:28 +0000 (10:14 +0200)]
Add MAINTAINERS entry for leon3

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: fix fcmp{s,d,q} instructions wrt exception
Aurelien Jarno [Fri, 7 Sep 2012 15:13:28 +0000 (17:13 +0200)]
target-sparc: fix fcmp{s,d,q} instructions wrt exception

fcmp{s,d,q} instructions are supposed to ignore quiet NaN (contrary to
the fcmpe{s,d,q} instructions), but the current code is wrongly setting
the NV exception in that case. Moreover the current code is duplicated:
first the arguments are checked for NaN to generate an exception, and
later in case the comparison is unordered (which can only happens if one
of the argument is a NaN), the same check is done to generate an
exception.

Fix that by calling clear_float_exceptions() followed by
check_ieee_exceptions() as for the other floating point instructions.
Use the _compare_quiet functions for fcmp{s,d,q} and the _compare ones
for fcmpe{s,d,q}. Simplify the flag setting by not clearing a flag that
is set the line just below.

This fix allows the math glibc testsuite to pass.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix missing errno codes for mingw32
Max Filippov [Thu, 6 Sep 2012 00:36:46 +0000 (04:36 +0400)]
target-xtensa: fix missing errno codes for mingw32

Put the following errno value mappings under #ifdef:

xtensa-semi.c: In function 'errno_h2g':
xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function)
xtensa-semi.c:113: error: (Each undeclared identifier is reported only once
xtensa-semi.c:113: error: for each function it appears in.)
xtensa-semi.c:113: error: array index in initializer not of integer type
xtensa-semi.c:113: error: (near initialization for 'guest_errno')
xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function)
xtensa-semi.c:124: error: array index in initializer not of integer type
xtensa-semi.c:124: error: (near initialization for 'guest_errno')
xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
xtensa-semi.c:134: error: array index in initializer not of integer type
xtensa-semi.c:134: error: (near initialization for 'guest_errno')

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-cris: Fix buffer overflow
Stefan Weil [Fri, 7 Sep 2012 20:36:08 +0000 (22:36 +0200)]
target-cris: Fix buffer overflow

Report from smatch:

target-cris/translate.c:3464 cpu_dump_state(32) error:
 buffer overflow 'env->sregs' 4 <= 255

sregs is declared 'uint32_t sregs[4][16]', so the first index must be
less than 4 or ARRAY_SIZE(env->sregs).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoMIPS/user: Fix reset CPU state initialization
Maciej W. Rozycki [Fri, 8 Jun 2012 01:04:40 +0000 (02:04 +0100)]
MIPS/user: Fix reset CPU state initialization

 This change updates the CPU reset sequence to use a common piece of code
that figures out CPU state flags, fixing the problem with MIPS_HFLAG_COP1X
not being set where applicable that causes floating-point MADD family
instructions (and other instructions from the MIPS IV FP subset) to trap.

 As compute_hflags is now shared between op_helper.c and translate.c, the
function is now moved to a common header.  There are no changes to this
function.

 The problem was seen with the 24Kf MIPS32r2 processor in user emulation.
The new approach prevents system and user emulation from diverging -- all
the hflags state is initialized in one place now.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agolan9118: fix multicast filtering
Aurelien Jarno [Sun, 10 Jun 2012 21:18:44 +0000 (23:18 +0200)]
lan9118: fix multicast filtering

The lan9118 emulation tries to compute the multicast index by calling
directly the crc32() function from zlib, but fails to get the correct
result.

Use the common compute_mcast_idx() function instead, which gives the
correct result. This fixes IPv6 support.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agofix entry pointer for ELF kernels loaded with -kernel option
Henning Schild [Wed, 5 Sep 2012 12:56:39 +0000 (14:56 +0200)]
fix entry pointer for ELF kernels loaded with -kernel option

 Find a hopefully proper patch attached. Take it or leave it.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Henning Schild <henning@hennsch.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agovhost: Pass device path to vhost_dev_init()
Stefan Hajnoczi [Tue, 21 Aug 2012 20:52:08 +0000 (20:52 +0000)]
vhost: Pass device path to vhost_dev_init()

The path to /dev/vhost-net is currently hardcoded in vhost_dev_init().
This needs to be changed so that /dev/vhost-scsi can be used.  Pass in
the device path instead of hardcoding it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomonitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
Nicholas Bellinger [Tue, 21 Aug 2012 20:52:07 +0000 (20:52 +0000)]
monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param

This patch renames+moves the net_handle_fd_param() caller used to
obtain a file descriptor from either qemu_parse_fd() (the normal case)
or from monitor_get_fd() (migration case) into a generically prefixed
monitor_handle_fd_param() to be used by vhost-scsi code.

Also update net/[socket,tap].c consumers to use the new prefix.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopcie_aer: clear cmask for Advanced Error Interrupt Message Number
Jason Baron [Tue, 4 Sep 2012 20:22:46 +0000 (16:22 -0400)]
pcie_aer: clear cmask for Advanced Error Interrupt Message Number

The Advanced Error Interrupt Message Number (bits 31:27 of the Root
Error Status Register) is updated when the number of msi messages assigned to a
device changes. Migration of windows 7 on q35 chipset failed because the check
in get_pci_config_device() fails due to cmask being set on these bits. Its valid
to update these bits and we must restore this state across migration.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopcie: drop version_id field for live migration
Jason Baron [Wed, 8 Aug 2012 18:29:12 +0000 (14:29 -0400)]
pcie: drop version_id field for live migration

While testing q35 live migration, I found that the migration would abort with
the following error: "Unknown savevm section type 76".

The error is due to this check failing in 'vmstate_load_state()':

    while(field->name) {
        if ((field->field_exists &&
             field->field_exists(opaque, version_id)) ||
            (!field->field_exists &&
             field->version_id <= version_id)) {

The VMSTATE_PCIE_DEVICE() currently has a 'version_id' set to 2. However,
'version_id' in the above check is 1. And thus we fail to load the pcie device
field. Further the code returns to 'qemu_loadvm_state()' which produces the
error that I saw.

I'm proposing to fix this by simply dropping the 'version_id' field from
VMSTATE_PCIE_DEVICE(). VMSTATE_PCI_DEVICE() defines no such field and further
the vmstate_pcie_device that VMSTATE_PCI_DEVICE() refers to is already
versioned. Thus, any versioning issues could be detected at the vmsd level.

Taking a step back, I think that the 'field->version_id' should be compared
against a saved version number for the field not the 'version_id'. Futhermore,
once vmstate_load_state() is called recursively on another vmsd, the check of:

    if (version_id > vmsd->version_id) {
        return -EINVAL;
    }

Will never fail since version_id is always equal to vmsd->version_id. So I'm
wondering why we aren't storing the vmsd version id of the source in the
migration stream?

This patch also renames the 'name' field of vmstate_pcie_device from:
PCIDevice -> PCIEDevice to differentiate it from vmstate_pci_device.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoqemu: add .exrc
Michael S. Tsirkin [Thu, 19 Jul 2012 14:26:10 +0000 (17:26 +0300)]
qemu: add .exrc

I've been using this to get correct indenting with vim
in qemu for a while, but it's a bit easier if we
put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure'
   options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's
   need to bypass this configuration.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agohw/pl110: Fix spelling of 'palette'
Peter Maydell [Mon, 27 Aug 2012 11:32:36 +0000 (12:32 +0100)]
hw/pl110: Fix spelling of 'palette'

Fix the spelling of 'palette' used in various local variables,
structure members and comments.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-xtensa: convert host errno values to guest
Max Filippov [Wed, 29 Aug 2012 19:54:25 +0000 (23:54 +0400)]
target-xtensa: convert host errno values to guest

Guest errno values are taken from the newlib. Convert only those errno
values that can be returned from used system calls.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add warning for single else statement.
Don Slutz [Sun, 2 Sep 2012 23:22:38 +0000 (19:22 -0400)]
CHECKPATCH: Add warning for single else statement.

For an example:

WARNING: braces {} are necessary even for single statement blocks
+    } else
+        return env->regs[R_EAX];

total: 0 errors, 1 warnings, 41 lines checked
Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_apw
Don Slutz [Sun, 2 Sep 2012 23:22:37 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_apw

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_checking
Don Slutz [Sun, 2 Sep 2012 23:22:36 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_checking

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_dcs
Don Slutz [Sun, 2 Sep 2012 23:22:35 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_dcs

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcx: tcx_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:33:25 +0000 (11:33 -0300)]
tcx: tcx_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agotcx: tcx24_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:30:40 +0000 (11:30 -0300)]
tcx: tcx24_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agog364fb: g364fb_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:28:17 +0000 (11:28 -0300)]
g364fb: g364fb_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoomap_lcdc: omap_ppm_save(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:24:34 +0000 (11:24 -0300)]
omap_lcdc: omap_ppm_save(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoomap_lcdc: rename ppm_save() to omap_ppm_save()
Luiz Capitulino [Mon, 21 May 2012 18:18:58 +0000 (15:18 -0300)]
omap_lcdc: rename ppm_save() to omap_ppm_save()

Avoids confusion with the global ppm_save() defined in hw/vga.c.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12 years agovga: ppm_save(): add error handling
Luiz Capitulino [Thu, 24 May 2012 13:42:25 +0000 (10:42 -0300)]
vga: ppm_save(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: convert screendump
Luiz Capitulino [Thu, 24 May 2012 16:48:23 +0000 (13:48 -0300)]
qapi: convert screendump

Next commits will update devices to propagate errors.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoconsole: vga_hw_screen_dump_ptr: take Error argument
Luiz Capitulino [Mon, 21 May 2012 19:41:37 +0000 (16:41 -0300)]
console: vga_hw_screen_dump_ptr: take Error argument

All devices that register a screen dump callback via
graphic_console_init() are updated.

The new argument is not used in this commit. Error handling will
be added to each device individually later.

This change is a preparation to convert the screendump command
to the QAPI.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>