Commit graph

20550 commits

Author SHA1 Message Date
Jan Kiszka 8ab60a0703 ahci: Clean up reset functions
Properly register reset functions via the device class.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Jan Kiszka 8e729e3b52 intel-hda: Fix reset of MSI function
Call msi_reset on device reset as still required by the core.

CC: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Jan Kiszka 868a1a5226 ahci: Fix reset of MSI function
Call msi_reset on device reset as still required by the core.

CC: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Fernando Luis Vazquez Cao fee9d348ff rtl8139: honor RxOverflow flag in can_receive method
Some drivers (Linux' 8139too among them) rely on the NIC
injecting an interrupt in the event of a receive buffer overflow
and, accordingly, set the RxOverflow bit in the interrupt
mask. Unfortunately rtl8139's can_receive method ignores the
RxOverflow flag, which may lead to a situation where rtl8139
stops receiving packets (can_receive returns 0) when the receive
buffer becomes full.

If the driver eventually read from the receive buffer or reset
the card the emulator could recover from this situation. However
some implementations only do this upon receiving an interrupt
with either RxOK or RxOverflow set in the ISR; interrupt that
will never come because QEMU's flow control mechanisms would
prevent rtl8139 from receiving any packet.

Letting packets go through when the overflow interrupt is enabled
makes the QEMU emulator compliant to the spec and solves the
problem.

This patch should fix a relatively common (in our experience)
network stall observed when running enterprise distros with
rtl8139 as the NIC; in some cases the 8139too device driver gets
loaded and when under heavy load the network eventually stops
working.

Reported-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Acked-by: Igor Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:58 +03:00
Michael S. Tsirkin e9adf2605d shpc: unparent device before free
Recent core change removed unparent
so we need to do this in all callers now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:58 +03:00
Anthony Liguori fa79c914ef Merge remote-tracking branch 'bonzini/nested-makefiles-3' into staging
* bonzini/nested-makefiles-3: (29 commits)
  build: do not create directories at configure time
  configure: ensure directory exists when creating symlink
  build: compile oslib-obj-y once
  build: limit usage of vpath
  build: libcacard Makefile cleanups
  build: move device tree to per-target Makefile.objs
  build: move per-target hw/ objects to nested Makefile.objs
  build: convert libhw to nested Makefile.objs
  build: move target-independent hw/ objects to nested Makefile.objs
  build: move qga/ objects to nested Makefile.objs
  build: move qapi/ objects to nested Makefile.objs
  build: move slirp/ objects to nested Makefile.objs
  build: move audio/ objects to nested Makefile.objs
  build: move ui/ objects to nested Makefile.objs
  build: move fsdev/ objects to nested Makefile.objs
  build: move net/ objects to nested Makefile.objs
  build: move block/ objects to nested Makefile.objs
  build: adapt qom/Makefile and move it to Makefile.objs
  build: move rules for nesting to Makefile.objs
  build: move other target-*/ objects to nested Makefile.objs
  ...
2012-06-07 17:21:40 +08:00
Peter A. G. Crosthwaite 083dbf489d target-microblaze: fix swx build breakage
The lazy initialisation of r_check was throwing an error on --enable-debug.
Removed the lazy initialisation of r_check and swx_addr.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-07 10:12:00 +02:00
Gerd Hoffmann f020ed36fe ehci: rework frame skipping
Move the framecount check out of the loop and use the new
ehci_update_frindex function to skip frames if needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 3a21532626 ehci: adaptive wakeup rate.
Adapt the frame timer sleeps according to the actual needs.  With the
periodic schedule being active we'll have to wakeup 1000 times per
second and go check for work.  In case only the async schedule is active
we can be more lazy though.  When idle ehci will increate the sleep time
step by step, so qemu has to wake up less frequently.  When we'll see
transactions on the bus or the guest fiddles with the schedule
enable/disable bits we'll return to a 1000 Hz wakeup rate and full
speed.  With both schedules disabled we stop wakeups altogether.

This patch also drops the freq property (configures wakeup rate
manually) which is obsoleted by this patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 6ceced0b2e ehci: create ehci_update_frindex
Factor out code from ehci_frame_timer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 863b474163 ehci: remove unused attach_poll_counter
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann daf25307b4 ehci: fix halt status handling
When the enable bits for controller / async schedule / periodic schedule
change just make sure we kick the frame timer and let
ehci_advance_periodic_state and ehci_advance_async_state handle the
controller state changes.

This will make ehci set USBSTS_HALT when the controller shutdown is
actually done, once both schedules are in inactive state and the
USBSTS_PSS and USBSTS_ASS bits are clear.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann b53f685d63 ehci: update status bits in ehci_set_state
Update the status register in the ehci_set_state function, to make sure
the guest-visible register is in sync with our internal schedule state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann ec807d12bd ehci: add ehci_*_enabled() helpers
Add helper functions to query whenever the async / periodic schedule
is enabled or not.  Put them into use too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 7046530c36 ehci: fix reset
Check for the reset bit first when processing USBCMD register writes.
Also break out of the switch, there is no need to check the other bits.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0f588df8b3 ehci: kick async schedule on wakeup
Kick async schedule when we get a wakeup
notification from a usb device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann ae710b9905 ehci: schedule async bh on async packet completion
When a packet completes which happens to be part of the async schedule
kick the async bottom half for processing,

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0fb3e299bd ehci: move async schedule to bottom half
This way we can kick the async schedule independant from the
periodic frame timer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann ae0138a8ea ehci: add async field to EHCIQueue
Keep track whenever a EHCIQueue is part of the async or periodic
schedule.  This way we don't have to pass around the async flag
everywhere but can look it up from the EHCIQueue struct when needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 8f6d5e26b1 ehci: tweak queue initialization
Little tweak for the queue initialization, set the QH address in the
allocation function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 773dc9cdfd ehci: add queuing support
Add packet queuing.  Follow the qTD chain to see if there are more
packets we can submit.  Improves performance on larger transfers,
especially with usb-host, as we don't have to wait for a packet to
finish before sending the next one to the host for processing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann cd6657156e ehci: move ehci_flush_qh
Move ehci_flush_qh() function up in the source code.
No code change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann e59928b3d1 ehci: cache USBDevice in EHCIQueue
Keep a USBDevice pointer in EHCIQueue so we don't have to lookup the
device on each usb packet submission.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 4224558f87 ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue
This way it is possible to use ehci_execute to submit others than the
first EHCIPacket of the EHCIQueue.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann eb36a88e6b ehci: add EHCIPacket
Add a separate EHCIPacket struct and move fields over from EHCIQueue.
Preparing for supporting multiple packets per queue being in flight at
the same time.  No functional changes yet.

Fix some codestyle issues along the way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 348f10374a xhci: trace: slots
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 97df650bb9 xhci: trace: transfers
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann c1f6b49326 xhci: trace: endpoints
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0703a4a7a6 xhci: trace: ring fetch
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 7acd279f83 xhci: trace: irq + events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann fc0ddaca33 xhci: trace: run+stop
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 2d754a10e4 xhci: trace: mmio reads+writes
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Jan Kiszka 64619739c4 xhci: Clean up reset function
Properly register reset function via the device class.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 5de88b1d46 usb-storage: migration support
With all scsi migration support bits in place the
final step is pretty simple ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 1dc903673a usb-storage: add scsi_off, remove scsi_buf
Repace the running buffer pointer (scsi_buf) with a buffer offset
field (scsi_off).  The later is alot easier to live-migrate.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 1e6ed80b90 usb-storage: add usb_msd_packet_complete()
Factor out packet completion to a separate function which
cares to get the MSDState->packet update right.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 0659879e6e usb-storage: remove MSDState->residue
We have the field twice, once in MSDState directly and one in the status
word struct.  Drop one.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 18eef3bc4e scsi: prepare migration code for usb-storage support
usb-storage can't handle requests in one go as the data transfer can be
splitted into lots of usb packets.  Because of that there can be
normal in-flight requests at savevm time and we need to handle that.
With other scsi hba's this happens only in case i/o is stopped due to
errors and there are pending requests which need to be restarted
(req->retry = true).

So, first we need to save req->retry and then handle the req->retry =
false case.  Write requests are handled fine already.  For read requests
we have to save the buffer as we will not restart the request (and thus
not refill the buffer) on the target host.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 973002c114 uhci: fix irq routing
The multifunction ich9 ehci controller with uhci companions uses a
different interrupt pin for each function.  The three uhci devices
get pins A, B and C, whereas ehci uses pin D.  This way the guest
can assign different IRQ lines to each controller.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 5852d3bfe1 uhci: zap uhci_pre_save
Cancel transactions before saving vmstate is pretty pointless and just
causes disruptions.  We need to cancel them before *loading* vmstate,
but in that case uhci_reset() handles it already and no special action
is needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 7dd0dfd7f7 uhci: fix trace format strings
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 40141d12de uhci: make bandwidth tunable
Add a property for the uhci bandwidth.  Can be used to make uhci
emulation run faster than real hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 9a16c5950d uhci: use bottom half
Schedule bottom half on completion of async packets instead of calling
uhci_process_frame directly.  This way we run uhci_process_frame only
once in case multiple packets finish in a row.  Also check whenever
there is bandwidth left before scheduling uhci_process_frame.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 4aed20e2d7 uhci: fix bandwidth management
uhci_process_frame() can be invoked multiple times per frame, so
accounting usb bandwith in a local variable doesn't fly, use a variable
in UHCIState instead.  Also check the limit more frequently.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Paolo Bonzini 2dee8d54c6 build: do not create directories at configure time
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:20 +02:00
Anthony Liguori ec5b06d717 configure: ensure directory exists when creating symlink
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-06-07 09:21:19 +02:00
Paolo Bonzini 25f27a4f71 build: compile oslib-obj-y once
There is no difference in oslib-obj-y between user-mode and system
targets.  There used to be when user-mode could optionally be
compiled with PIE.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:19 +02:00
Paolo Bonzini fec90ff0bd build: limit usage of vpath
All paths are now explicitly given, and the object tree mimics
the source tree, so there is no need to apply special vpaths.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:18 +02:00
Paolo Bonzini 00c705fb92 build: libcacard Makefile cleanups
Build vscclient from toplevel Makefile, limit usage of vpath.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:18 +02:00
Paolo Bonzini 49ac9e0a8c build: move device tree to per-target Makefile.objs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:18 +02:00