diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-03-11 21:26:07 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2025-03-13 17:57:23 +0100 |
commit | 1cf18cc9bf5e9f88ad92f89886652e0361e2f41f (patch) | |
tree | f5110b1b76a0380761a0474430b068440ab91045 /include | |
parent | 7eecba37788f48d34c015954f1207cc7b52728f5 (diff) | |
download | qemu-1cf18cc9bf5e9f88ad92f89886652e0361e2f41f.zip qemu-1cf18cc9bf5e9f88ad92f89886652e0361e2f41f.tar.gz qemu-1cf18cc9bf5e9f88ad92f89886652e0361e2f41f.tar.bz2 |
scsi: introduce requests_lock
SCSIDevice keeps track of in-flight requests for device reset and Task
Management Functions (TMFs). The request list requires protection so
that multi-threaded SCSI emulation can be implemented in commits that
follow.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250311132616.1049687-5-stefanha@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/scsi/scsi.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index ffc4820..90ee192 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -49,6 +49,8 @@ struct SCSIRequest { bool dma_started; BlockAIOCB *aiocb; QEMUSGList *sg; + + /* Protected by SCSIDevice->requests_lock */ QTAILQ_ENTRY(SCSIRequest) next; }; @@ -77,10 +79,7 @@ struct SCSIDevice uint8_t sense[SCSI_SENSE_BUF_SIZE]; uint32_t sense_len; - /* - * The requests list is only accessed from the AioContext that executes - * requests or from the main loop when IOThread processing is stopped. - */ + QemuMutex requests_lock; /* protects the requests list */ QTAILQ_HEAD(, SCSIRequest) requests; uint32_t channel; |