This is a pretty important step in the modernization and improvement of the SCSI backends, and a prerequisite for pretty much everything that is on the table: migration, addressing, improved CD-ROM support, hotplug.
The series touches two main parts: 1) sense data. Autosense is made a first-class citizen of the subsystem. Sense data is communicated to the target primarily via autosense, and it is then the target that uses this information to reply to REQUEST SENSE commands. In addition, each LUN or target can be in a unit attention condition, which will be communicated via either autosense or REQUEST SENSE, or cleared automatically. 2) target requests. The common example of this is REPORT LUNS and commands sent to invalid LUNs. Handling of these commands previously had to be done for every SCSIDevice. This series splits request-related SCSIDevice callbacks out into a new SCSIReqOps structure, thus allowing the target (SCSIBus) to hijack those requests and reply to them without involving the SCSIDevice at all. The system is quite flexible, and is also used for invalid commands, REQUEST SENSE and commands sent while a unit attention condition is pending. Finally, other parts of the SCSIDevice code are moved to common code including general parsing of requests. The two parts are slightly intertwined. Sense data is handled by patches 2/3/4/12/13/14/15, and target requests are handled by patches 5 to 11. (patches 1 and 16 are somewhat unrelated). The reason for this is that the current device-specific handling of sense data conflicts heavily with the goal of handling some commands in a device-independent way. So, the series starts by moving sense handling to generic code, and comes back to generic handling of REQUEST SENSE and unit attention after implementing a few others device-independent requests. It conflicts somewhat with Markus's tray series, but not in a fatal way; the conflicts are trivial. Paolo Bonzini (16): scsi-disk: no need to call scsi_req_data on a short read vscsi: always use get_sense scsi: pass status when completing scsi: move sense handling to generic code scsi: introduce SCSIReqOps scsi: move request-related callbacks from SCSIDeviceInfo to SCSIReqOps scsi: pass cdb already to scsi_req_new scsi: introduce SCSICommand scsi: push lun field to SCSIDevice scsi: move request parsing to common code scsi: move handling of REPORT LUNS and invalid LUNs to common code scsi: move handling of REQUEST SENSE to common code scsi: add a bunch more common sense codes scsi: add support for unit attention conditions scsi: report unit attention on reset scsi: add special traces for common commands hw/esp.c | 4 +- hw/lsi53c895a.c | 4 +- hw/scsi-bus.c | 578 +++++++++++++++++++++++++++++++++++++++++++++-------- hw/scsi-defs.h | 4 + hw/scsi-disk.c | 164 +++++----------- hw/scsi-generic.c | 156 ++++----------- hw/scsi.h | 72 +++++-- hw/spapr_vscsi.c | 95 ++------- hw/usb-msd.c | 4 +- trace-events | 5 + 10 files changed, 668 insertions(+), 418 deletions(-) -- 1.7.6