BACKPORT: FROMLIST: scsi: core: Reserve one tag for the UFS driver

This is a GKI-compatible version of the following patch: "scsi: core:
Add support for reserved tags".

Bug: 205080886
Link: https://lore.kernel.org/linux-scsi/20211103000529.1549411-2-bvanassche@acm.org.
Change-Id: I6273114ae8cc6c2a74c72f7bc090eb0319ec5772
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche 2021-11-05 13:30:59 -07:00
parent 94ca15ec92
commit ff748ee298
2 changed files with 8 additions and 3 deletions

View File

@ -220,9 +220,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
goto fail; goto fail;
} }
shost->cmd_per_lun = min_t(short, shost->cmd_per_lun,
shost->can_queue);
error = scsi_init_sense_cache(shost); error = scsi_init_sense_cache(shost);
if (error) if (error)
goto fail; goto fail;
@ -231,6 +228,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
if (error) if (error)
goto fail; goto fail;
shost->can_queue = shost->tag_set.queue_depth;
shost->cmd_per_lun = min_t(short, shost->cmd_per_lun,
shost->can_queue);
if (!shost->shost_gendev.parent) if (!shost->shost_gendev.parent)
shost->shost_gendev.parent = dev ? dev : &platform_bus; shost->shost_gendev.parent = dev ? dev : &platform_bus;
if (!dma_dev) if (!dma_dev)

View File

@ -1909,6 +1909,10 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
tag_set->ops = &scsi_mq_ops_no_commit; tag_set->ops = &scsi_mq_ops_no_commit;
tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1; tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1;
tag_set->queue_depth = shost->can_queue; tag_set->queue_depth = shost->can_queue;
if (shost->hostt->name && strcmp(shost->hostt->name, "ufshcd") == 0) {
tag_set->queue_depth--;
tag_set->reserved_tags++;
}
tag_set->cmd_size = cmd_size; tag_set->cmd_size = cmd_size;
tag_set->numa_node = NUMA_NO_NODE; tag_set->numa_node = NUMA_NO_NODE;
tag_set->flags = BLK_MQ_F_SHOULD_MERGE; tag_set->flags = BLK_MQ_F_SHOULD_MERGE;