Message ID | 1414584016-25888-11-git-send-email-hare@suse.de |
---|---|
State | New |
Headers | show |
On 10/29/2014 01:00 PM, Hannes Reinecke wrote: > + trace_megasas_dcmd_reset_ld(cmd->index, target_id); > + for (i = 0; i < s->fw_cmds; i++) { > + MegasasCmd *tmp_cmd = &s->frames[i]; > + if (tmp_cmd->req && tmp_cmd->req->dev->lun == target_id) { Why ->lun? Paolo > + SCSIDevice *d = tmp_cmd->req->dev; > + qdev_reset_all(&d->qdev);
On 10/29/2014 01:54 PM, Paolo Bonzini wrote: > > > On 10/29/2014 01:00 PM, Hannes Reinecke wrote: >> + trace_megasas_dcmd_reset_ld(cmd->index, target_id); >> + for (i = 0; i < s->fw_cmds; i++) { >> + MegasasCmd *tmp_cmd = &s->frames[i]; >> + if (tmp_cmd->req && tmp_cmd->req->dev->lun == target_id) { > > Why ->lun? > Gna. You are correct, it should be ->id. Cheers, Hannes
On 10/29/2014 02:23 PM, Hannes Reinecke wrote: > On 10/29/2014 01:54 PM, Paolo Bonzini wrote: >> >> >> On 10/29/2014 01:00 PM, Hannes Reinecke wrote: >>> + trace_megasas_dcmd_reset_ld(cmd->index, target_id); >>> + for (i = 0; i < s->fw_cmds; i++) { >>> + MegasasCmd *tmp_cmd = &s->frames[i]; >>> + if (tmp_cmd->req && tmp_cmd->req->dev->lun == target_id) { >> >> Why ->lun? >> > Gna. You are correct, it should be ->id. No big deal, fixing it myself. Paolo
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index a240cf1..4be4e88 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -1419,9 +1419,23 @@ static int megasas_ctrl_shutdown(MegasasState *s, MegasasCmd *cmd) return MFI_STAT_OK; } +/* Some implementations use CLUSTER RESET LD to simulate a device reset */ static int megasas_cluster_reset_ld(MegasasState *s, MegasasCmd *cmd) { - return MFI_STAT_INVALID_DCMD; + uint16_t target_id; + int i; + + /* mbox0 contains the device index */ + target_id = le16_to_cpu(cmd->frame->dcmd.mbox[0]); + trace_megasas_dcmd_reset_ld(cmd->index, target_id); + for (i = 0; i < s->fw_cmds; i++) { + MegasasCmd *tmp_cmd = &s->frames[i]; + if (tmp_cmd->req && tmp_cmd->req->dev->lun == target_id) { + SCSIDevice *d = tmp_cmd->req->dev; + qdev_reset_all(&d->qdev); + } + } + return MFI_STAT_OK; } static int megasas_dcmd_set_properties(MegasasState *s, MegasasCmd *cmd)
Some implementations use DCMD_CLUSTER_RESET_LD to simulate a device reset. Signed-off-by: Hannes Reinecke <hare@suse.de> --- hw/scsi/megasas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)