aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/scsi-generic.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2020-11-16 19:31:14 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-02-25 14:14:32 +0100
commitb2d50a3343d939a603df4436ccc41b4cf8223f88 (patch)
treeca934d79513fcf913517d247084ebfc0118ca31e /hw/scsi/scsi-generic.c
parentc9b6609b69facad0cc5425d4fa7934c33d7f2e91 (diff)
scsi: add tracing for SG_IO commands
Add tracepoints for SG_IO commands to allow for debugging of SG_IO commands. Signed-off-by: Hannes Reinecke <hare@suse.de> Message-Id: <20201116183114.55703-4-hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi/scsi-generic.c')
-rw-r--r--hw/scsi/scsi-generic.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 3dd3ccd097..176a72951c 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -129,6 +129,8 @@ static int execute_command(BlockBackend *blk,
r->io_header.usr_ptr = r;
r->io_header.flags |= SG_FLAG_DIRECT_IO;
+ trace_scsi_generic_aio_sgio_command(r->req.tag, r->req.cmd.buf[0],
+ r->io_header.timeout);
r->req.aiocb = blk_aio_ioctl(blk, SG_IO, &r->io_header, complete, r);
if (r->req.aiocb == NULL) {
return -EIO;
@@ -525,8 +527,12 @@ int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
io_header.sbp = sensebuf;
io_header.timeout = timeout * 1000;
+ trace_scsi_generic_ioctl_sgio_command(cmd[0], io_header.timeout);
ret = blk_ioctl(blk, SG_IO, &io_header);
- if (ret < 0 || io_header.driver_status || io_header.host_status) {
+ if (ret < 0 || io_header.status ||
+ io_header.driver_status || io_header.host_status) {
+ trace_scsi_generic_ioctl_sgio_done(cmd[0], ret, io_header.status,
+ io_header.host_status);
return -1;
}
return 0;