Skip to content

hw/ufs: Support MCQ runtime registers and Task Management Requests

Stanley Jhu qemu-devel 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyIn review
  2. v33 patches 4 repliesSuperseded
  3. v23 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches0 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hw/ufs: Track SCSIRequest and cancel pending requests in ufs_clear_reqhw/ufs/lu.c hw/ufs/ufs.c hw/ufs/ufs.h+15 -00 replies
2/4hw/ufs: Support MCQ runtime interrupt and queue status registershw/ufs/trace-events hw/ufs/ufs.c include/block/ufs.h+126 -20 replies
3/4hw/ufs: Implement Task Management Request (TMR) handlinghw/ufs/trace-events hw/ufs/ufs.c include/block/ufs.h+134 -10 replies
4/4hw/ufs: Skip nullified MCQ submission queue entries with OCS_ABORTEDhw/ufs/ufs.c include/block/ufs.h+17 -10 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJeuk Kim
SeriesR-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] hw/ufs: Support MCQ runtime registers and Task Management Requests

This series adds support for Task Management Requests (TMR) and Multi-Circular Queue (MCQ) runtime status, interrupt, and queue cleanup operations in the QEMU UFS emulator.

Why:
Linux UFS error recovery issues Task Management Requests (TMR) via the UTP Task Management Request List (UTMRL). In MCQ mode, the driver also uses per-queue operational registers (SQnRTC, SQnRTS, SQnCTI, CQnIS) to stop queues and clean up aborted tasks, and nullifies unfetched SQEs by setting Command Type to 0xF. QEMU does not yet model these paths or track per-request SCSIRequest pointers needed to cancel individual in-flight commands. Per-SQ interrupt status/enable bits (SQIS.SSS/SUS, SQIE, and IS.SQES) remain unmodeled.

What:
- Patch 1: Track SCSIRequest in UfsRequest and cancel it in ufs_clear_req().
- Patch 2: Implement MCQ runtime operational registers and SQnRTC.ICU cleanup.
- Patch 3: Implement UTMRL doorbell and TMR handling (QUERY_TASK and ABORT_TASK).
- Patch 4: Skip nullified MCQ SQEs (CT = 0xF) and post CQEs with UFS_OCS_ABORTED.

Differences from v3:
- Report SQRTS.RTC (0..3) and preserve SQRTS.CUS across SQ_START (Jeuk)
- Separate TMR rsp_header.response from output_param1 and gate IS.UTMRCS on the UTMRD I-bit (Jeuk)
- Drop non-spec MMIO configuration register resets in ufs_hce_reset()
- Complete nullified MCQ SQEs (CT = 0xF) with UFS_OCS_ABORTED

Tested:
Verified on QEMU ARM64 with qos-test and Linux guest MCQ TMR abort, SQ cleanup, and host reset.

Stanley Jhu (4):
hw/ufs: Track SCSIRequest and cancel pending requests in ufs_clear_req hw/ufs: Support MCQ runtime interrupt and queue status registers hw/ufs: Implement Task Management Request (TMR) handling hw/ufs: Skip nullified MCQ submission queue entries with OCS_ABORTED

 hw/ufs/lu.c         |   8 ++
 hw/ufs/trace-events |   2 +
 hw/ufs/ufs.c        | 268 +++++++++++++++++++++++++++++++++++++++++++-
 hw/ufs/ufs.h        |   1 +
 include/block/ufs.h |  17 +++
 5 files changed, 292 insertions(+), 4 deletions(-)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog