summaryrefslogtreecommitdiffstats
path: root/hw/spapr_vscsi.c
Commit message (Collapse)AuthorAgeFilesLines
* scsi: add channel to addressingPaolo Bonzini2011-10-281-6/+3
| | | | | | | | | This also requires little more than adding the new argument to scsi_device_find, and the qdev property. All devices by default end up on channel 0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: allow arbitrary LUNsPaolo Bonzini2011-10-281-4/+35
| | | | | | | | | | | | | This only requires changes in two places: in SCSIBus, we need to look for a free LUN if somebody creates a device with a pre-existing scsi-id but the default LUN (-1, meaning "search for a free spot"); in vSCSI, we need to actually parse the LUN according to the SCSI spec. For vSCSI, max_target/max_lun are set according to the logical unit addressing format in SAM. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: remove devs array from SCSIBusPaolo Bonzini2011-10-281-8/+6
| | | | | | | | | | | | | Change the devs array into a linked list, and add a scsi_device_find function to navigate the children list instead. This lets the SCSI bus use more complex addressing, and HBAs can talk to the correct device when there are multiple LUNs per target. scsi_device_find may return another LUN on the same target if none is found that matches exactly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)Paolo Bonzini2011-10-281-3/+5
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* vscsi: send the CHECK_CONDITION status down together with autosense dataPaolo Bonzini2011-10-061-1/+0
| | | | | | | | | | | | | | | | | I introduced this bug in commit 05751d3 (vscsi: always use get_sense, 2011-08-03) because at the time there was no way to expose a sense condition to SLOF and Linux manages to work around the bug. However, the bug becomes evident now that SCSI devices also report unit attention on reset. SLOF also has problems dealing with unit attention conditions, so it still will not boot even with this fix (just like OpenBIOS). IBM folks are aware of their part of the bug. :-) Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* spapr: prepare for qdevification of irqPaolo Bonzini2011-10-061-3/+1
| | | | | | | | | | Restructure common properties for sPAPR devices so that IRQ definitions can be added in one place. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Alexander Graf <agraf@suse.de> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* spapr: proper qdevificationPaolo Bonzini2011-10-061-7/+1
| | | | | | | | | | | | | | | | | | | Right now the spapr devices cannot be instantiated with -device, because the IRQs need to be passed to the spapr_*_create functions. Do this instead in the bus's init wrapper. This is particularly important with the conversion from scsi-disk to scsi-{cd,hd} that Markus made. After his patches, if you specify a scsi-cd device attached to an if=none drive, the default VSCSI controller will not be created and, without qdevification, you will not be able to add yours. NOTE from agraf: added small compile fix Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Alexander Graf <agraf@suse.de> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-1/+1
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: pass cdb already to scsi_req_newPaolo Bonzini2011-08-121-2/+2
| | | | | | | | | | | | Right now the CDB is not passed to the SCSIBus until scsi_req_enqueue. Passing it to scsi_req_new will let scsi_req_new dispatch common requests through different reqops. Moving the memcpy to scsi_req_new is a hack that will go away as soon as scsi_req_new will also take care of the parsing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vscsi: always use get_sensePaolo Bonzini2011-08-121-70/+21
| | | | | | | | | | | | vscsi supports autosensing by providing sense data directly in the response. When get_sense was added, the older state machine approach that sent REQUEST SENSE commands separately was left in place. Remove it, all existing SCSIDevices do support autosensing and the next patches will make the support come for free from the SCSIBus. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: Add 'hba_private' to SCSIRequestHannes Reinecke2011-07-191-19/+9
| | | | | | | | | | | | | 'tag' is just an abstraction to identify the command from the driver. So we should make that explicit by replacing 'tag' with a driver-defined pointer 'hba_private'. This saves the lookup for driver handling several commands in parallel. 'tag' is still being kept for tracing purposes. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: rename arguments to the new callbacksPaolo Bonzini2011-05-261-17/+14
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
* scsi: split command_complete callback in twoPaolo Bonzini2011-05-261-45/+56
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
* scsi: Implement 'get_sense' callbackHannes Reinecke2011-05-261-1/+9
| | | | | | | | | | 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>
* scsi: introduce scsi_req_get_bufPaolo Bonzini2011-05-261-6/+2
| | | | | | | ... 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>
* scsi: introduce scsi_req_continuePaolo Bonzini2011-05-261-16/+10
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
* scsi: introduce scsi_req_newPaolo Bonzini2011-05-261-1/+1
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
* scsi: do not call send_command directlyPaolo Bonzini2011-05-261-2/+2
| | | | | | | 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>
* scsi: introduce scsi_req_cancelPaolo Bonzini2011-05-261-1/+10
| | | | | | | | | 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>
* scsi: introduce scsi_req_abortPaolo Bonzini2011-05-261-6/+2
| | | | | | | | 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>
* scsi: Use 'SCSIRequest' directlyHannes Reinecke2011-05-261-19/+25
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* scsi: introduce SCSIBusOpsPaolo Bonzini2011-05-261-1/+5
| | | | | | | | | | | | | 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>
* spapr_vscsi: Set uninitialized variableStefan Weil2011-04-081-1/+1
| | | | | | | | | | | cppcheck reports this error: hw/spapr_vscsi.c:274: error: Uninitialized variable: rc If llen == 0, rc was indeed used without being initialized. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* Implement PAPR virtual SCSI interface (ibmvscsi)Ben Herrenschmidt2011-04-011-0/+988
This patch implements the infrastructure and hypercalls necessary for the PAPR specified Virtual SCSI interface. This is the normal method for providing (virtual) disks to PAPR partitions. Signed-off-by: Ben Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
OpenPOWER on IntegriCloud