Currently SCSI low-level drivers are required to manage tags for commands which do not come via the block layer - libata internal commands would be an example of one of these. There was some work to provide "reserved commands" support in such series as https://lore.kernel.org/linux-scsi/20211125151048.103910-1-hare@xxxxxxx/ This was based on allocating a request for the lifetime of the "internal" command. This series tries to solve that problem by not just allocating the request but also sending it through the block layer, that being the normal flow for a request. We need to do this as we may only poll completion of requests through the block layer, so would need to do this for poll queue support. There is still scope to allocate commands just to get a tag as token as that may suit some other scenarios, but it's not what we do here. This series extends blk-mq to support a request queue having a custom set of ops. In addition SCSI core code adds support for these type of requests. This series does not include SCSI core handling for enabling reserved tags per tagset, but that would be easy to add. Based on mkp-scsi 5.18/scsi-staging @ 66daf3e6b993 Please consider as an RFC for now. I think that the libata change has the largest scope for improvement... John Garry (11): blk-mq: Add blk_mq_init_queue_ops() scsi: core: Add SUBMITTED_BY_SCSI_CUSTOM_OPS libata: Send internal commands through the block layer scsi: libsas: Send SMP commands through the block layer scsi: libsas: Send TMF commands through the block layer scsi: core: Add scsi_alloc_request_hwq() scsi: libsas: Send internal abort commands through the block layer scsi: libsas: Change ATA support to deal with each qc having a SCSI command scsi: libsas: Add sas_task_to_unique_tag() scsi: libsas: Add sas_task_to_hwq() scsi: hisi_sas: Remove private tag management block/blk-mq.c | 23 +++- drivers/ata/libata-core.c | 121 +++++++++++++------ drivers/md/dm-rq.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 66 +---------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +- drivers/scsi/libsas/sas_ata.c | 11 +- drivers/scsi/libsas/sas_expander.c | 38 ++++-- drivers/scsi/libsas/sas_internal.h | 1 + drivers/scsi/libsas/sas_scsi_host.c | 153 ++++++++++++++++++++----- drivers/scsi/scsi_lib.c | 14 +++ include/linux/blk-mq.h | 5 +- include/scsi/libsas.h | 4 +- include/scsi/scsi_cmnd.h | 4 + 14 files changed, 298 insertions(+), 150 deletions(-) -- 2.26.2