aboutsummaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2011-05-31Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori1-1/+1
2011-05-31Merge remote-tracking branch 'amit/for-anthony' into stagingAnthony Liguori3-71/+70
2011-05-31Merge remote-tracking branch 'bonzini/scsi.2' into stagingAnthony Liguori8-573/+860
Conflicts: hw/usb-msd.c
2011-05-31Merge remote-tracking branch 'kraxel/usb.14.pull' into stagingAnthony Liguori18-80/+2263
2011-05-29pflash_cfi02: Fix a typo in debug code (TARGET_FMT_pld -> TARGET_FMT_plx)Stefan Weil1-1/+1
Thanks to Tobias Hoffmann <th55@gmx.de> for this patch. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-28bitbang_i2c: Fix spurious slave read after NACKMarcus Comstedt1-1/+4
After NACKing a read operation, a raising SCL should not trigger a new read from the slave. Introduce a new state which just waits for a stop or start condition after NACK. Signed-off-by: Marcus Comstedt <marcus@mc.pp.se> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-05-27virtio-console: Simplify init callbacksMarkus Armbruster1-26/+9
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27virtio-serial: Drop redundant VirtIOSerialPort member infoMarkus Armbruster3-20/+32
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27virtio-serial: Drop useless property is_consoleMarkus Armbruster2-5/+0
All you could ever achieve with it is break stuff, so removing it should be safe. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27virtio-serial: Clean up virtconsole detectionMarkus Armbruster3-6/+11
virtio-serial-bus needs to treat "virtconsole" devices specially. It uses VirtIOSerialPort member is_console to recognize them. It gets its value via property initialization. Cute hack, except it lets users mess with it: "-device virtconsole,is_console=0" isn't plugged into port 0 as it should. Move the flag to VirtIOSerialPortInfo. Keep the property for backward compatibility; its value has no effect. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27virtio-serial: Plug memory leak on qdev exit()Markus Armbruster1-18/+9
virtio_serial_init() allocates the VirtIOSerialBus dynamically, but virtio_serial_exit() doesn't free it. Fix by getting rid of the allocation. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-27virtio-serial-bus: use bh for unthrottlingAlon Levy2-2/+15
Instead of calling flush_queued_data when unthrottling, schedule a bh. That way we can return immediately to the caller, and the flush uses the same call path as a have_data for callbackee. No migration change is required because bh are called from vm_stop. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-05-26scsi: ignore LUN field in the CDBPaolo Bonzini2-6/+5
The LUN field in the CDB is a historical relic. Ignore it as reserved, which is what modern SCSI specifications actually say. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: rename arguments to the new callbacksPaolo Bonzini4-37/+34
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: split command_complete callback in twoPaolo Bonzini6-137/+168
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26esp: rename sense to statusPaolo Bonzini1-5/+5
This mirrors the LSI patch that was recently committed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi-generic: Handle queue fullPaolo Bonzini1-0/+3
The sg driver currently has a hardcoded limit of commands it can handle simultaneously. When this limit is reached the driver will return -EDOM. So we need to capture this to enable proper return values here. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: make write_data return voidPaolo Bonzini3-10/+5
The return value is unused anyway. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi-disk: add data direction checkingHannes Reinecke1-11/+24
scsi_req_parse() already provides for a data direction setting, so we should be using it to check for correct direction. And we should return the sense code 'INVALID FIELD IN CDB' in these cases. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: Implement 'get_sense' callbackHannes Reinecke5-1/+49
The get_sense callback copies existing sense information into the provided buffer. This is required if sense information should be transferred together with the command response. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_get_bufPaolo Bonzini6-9/+11
... and remove some SCSIDevice variables or fields that now become unused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_continuePaolo Bonzini6-60/+46
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_newPaolo Bonzini6-5/+10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: do not call send_command directlyPaolo Bonzini8-9/+14
Move the common part of scsi-disk.c and scsi-generic.c to the SCSI layer. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: Update sense code handlingHannes Reinecke4-67/+208
The SCSI spec has a quite detailed list of sense codes available. It even mandates the use of specific ones for some failure cases. The current implementation just has one type of generic error which is actually a violation of the spec in certain cases. This patch introduces various predefined sense codes to have the sense code reporting more in line with the spec. On top of Hannes's patch I fixed the reply to REQUEST SENSE commands with DESC=0 and a small (<18) length. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: use scsi_req_completePaolo Bonzini1-3/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_cancelPaolo Bonzini8-17/+80
This is for when the request must be dropped in the void, but still memory should be freed. To this end, the devices register a second callback in SCSIBusOps. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_abortPaolo Bonzini3-6/+12
This covers the case of canceling a request's I/O and still completing it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: commonize purging requestsPaolo Bonzini4-32/+17
The code for canceling requests upon reset is already the same. Clean it up and move it to scsi-bus.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: Use 'SCSIRequest' directlyHannes Reinecke8-252/+173
Currently the SCSIRequest structure is abstracted away and cannot accessed directly from the driver. This requires the handler to do a lookup on an abstract 'tag' which identifies the SCSIRequest structure. With this patch the SCSIRequest structure is exposed to the driver. This allows use to use it directly as an argument to the SCSIDeviceInfo callback functions and remove the lookup. A new callback function 'alloc_req' is introduced matching 'free req'; unref'ing to free up resources after use is moved into the scsi_command_complete callbacks. This temporarily introduces a leak of requests that are cancelled, when they are removed from the queue and not from the driver. This is fixed later by introducing scsi_req_cancel. That patch in turn depends on this one, because the argument to scsi_req_cancel is a SCSIRequest. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26lsi: extract lsi_find_by_tagPaolo Bonzini1-25/+38
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: reference-count requestsPaolo Bonzini4-23/+58
With the next patch, a device may hold SCSIRequest for an indefinite time. Split a rather big patch, and protect against access errors, by reference counting them. There is some ugliness in scsi_send_command implementation due to the need to unref the request when it fails. This will go away with the next patches, which move the unref'ing to the devices. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi-generic: do not use a stale aiocbPaolo Bonzini1-0/+3
If a request is canceled after it has been completed, scsi_cancel_io would pass a stale aiocb to bdrv_aio_cancel. Avoid this. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce SCSIBusOpsPaolo Bonzini7-17/+34
There are more operations than a SCSI bus can handle, besides completing commands. One example, which this series will introduce, is cleaning up after a request is cancelled. More long term, a "SCSI bus" can represent the LUNs attached to a target; in this case, while all commands will ultimately reach a logical unit, it is the target who is in charge of answering REPORT LUNs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: introduce scsi_req_dataPaolo Bonzini4-7/+19
This abstracts calling the command_complete callback, reducing churn in the following patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi-generic: Remove bogus double completePaolo Bonzini1-2/+4
scsi-generic scsi_read_complete() should not -both- call the client complete callback with SCSI_REASON_DATA -and- call scsi_command_complete(). The former will cause the client to queue a new read or write request, while the later will free the request data structure, thus causing the new read or write request to use a freed/stale structure when it completes. This patch fixes the bug, fixing a crash with scsi-generic & RHEL5.5 installer. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26scsi: add tracing of scsi requestsPaolo Bonzini1-0/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-05-26usb: add ehci adapterGerd Hoffmann2-0/+2038
This patch finally merges the EHCI host adapter aka USB 2.0 support. Based on the ehci bits collected @ git://git.kiszka.org/qemu.git ehci EHCI has a long out-of-tree history. Project was started by Mark Burkley, with contributions by Niels de Vos. David S. Ahern continued working on it. Kevin Wolf, Jan Kiszka and Vincent Palatin contributed bugfixes. /me (Gerd Hoffmann) picked it up where it left off, prepared the code for merge, fixed a few bugs and added basic user docs. Cc: David S. Ahern <daahern@cisco.com> Cc: Jan Kiszka <jan.kiszka@web.de> Cc: Kevin Wolf <mail@kevin-wolf.de> Cc: Vincent Palatin <vincent.palatin_qemu@m4x.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: move cancel callback to USBDeviceInfoGerd Hoffmann3-18/+9
Remove the cancel callback from the USBPacket struct, move it over to USBDeviceInfo. Zap usb_defer_packet() which is obsolete now. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: keep track of packet owner.Gerd Hoffmann2-15/+35
Keep track of the device which owns the usb packet for async processing. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: add usb_handle_packetGerd Hoffmann6-7/+22
Add a usb_handle_packet function, put it into use everywhere. Right now it just calls dev->info->handle_packet(), that will change in future patches though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb-storage: don't call usb_packet_complete twiceGerd Hoffmann1-1/+1
usb_msd_copy_data() may cause a recursive call to usb_msd_command_complete() which in turn may complete the packet, setting s->packet to NULL in case it does. Recheck s->packet before calling usb_packet_complete() to fix the double call. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb-linux: use usb_generic_handle_packet()Hans de Goede2-3/+39
Make the linux usb host passthrough code use the usb_generic_handle_packet() function, rather then the curent DYI code. This removes 200 lines of almost identical code. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-05-26usb: Pass the packet to the device's handle_control callbackHans de Goede13-35/+38
This allows using the generic usb_generic_handle_packet function from device code which does ASYNC control requests (such as the linux host pass through code). Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-05-26Bug #757654: UHCI fails to signal stall response patchJan Vesely1-0/+4
UHCI host controller status register indicates error and an interrupt is triggered on BABBLE and STALL errors. Signed-off-by: Jan Vesely <jano.vesely@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: add support for "grouped" interfaces and the Interface Association ↵Brad Hards3-0/+68
Descriptor This is used for some devices that have multiple interfaces that form a logic device. An example is Video Class, which has a Control interface and a Streaming interface. There can be additional interfaces on the same (physical) devices (e.g. a microphone), and Interface Association Descriptor handles this case. Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: remove fallback to bNumInterfaces if no .nifBrad Hards1-3/+2
All callers have been updated. Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: update config descriptors to identify number of interfacesBrad Hards5-0/+8
Previously we relied on the .bNumInterfaces, but that won't always be accurate after the introduction of grouped interfaces. Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-26usb: Add Interface Association Descriptor descriptor typeBrad Hards1-0/+1
Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-05-25Merge remote-tracking branch 'kraxel/CVE-2011-1751' into stagingAnthony Liguori1-1/+3