Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: ufs: core: Allocate the SCSI host earlier

Call ufshcd_add_scsi_host() before any UPIU commands are sent to the UFS
device. This patch prepares for letting ufshcd_add_scsi_host() allocate
memory for both SCSI and UPIU commands.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251031204029.2883185-19-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
f46b9a59 e8ea985a

+12 -5
+12 -5
drivers/ufs/core/ufshcd.c
··· 10605 10605 { 10606 10606 int err; 10607 10607 10608 + WARN_ON_ONCE(!hba->host->can_queue); 10609 + WARN_ON_ONCE(!hba->host->cmd_per_lun); 10610 + 10608 10611 if (is_mcq_supported(hba)) { 10609 10612 ufshcd_mcq_enable(hba); 10610 10613 err = ufshcd_alloc_mcq(hba); ··· 10768 10765 ufshcd_host_memory_configure(hba); 10769 10766 10770 10767 host->can_queue = hba->nutrs - UFSHCD_NUM_RESERVED; 10771 - host->cmd_per_lun = hba->nutrs - UFSHCD_NUM_RESERVED; 10768 + /* 10769 + * Set the queue depth for WLUNs. ufs_get_device_desc() will increase 10770 + * host->cmd_per_lun to a larger value. 10771 + */ 10772 + host->cmd_per_lun = 1; 10772 10773 host->max_id = UFSHCD_MAX_ID; 10773 10774 host->max_lun = UFS_MAX_LUNS; 10774 10775 host->max_channel = UFSHCD_MAX_CHANNEL; ··· 10864 10857 FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3); 10865 10858 } 10866 10859 10860 + err = ufshcd_add_scsi_host(hba); 10861 + if (err) 10862 + goto out_disable; 10863 + 10867 10864 /* Hold auto suspend until async scan completes */ 10868 10865 pm_runtime_get_sync(dev); 10869 10866 ··· 10915 10904 10916 10905 initialized: 10917 10906 ufshcd_process_probe_result(hba, probe_start, err); 10918 - if (err) 10919 - goto out_disable; 10920 - 10921 - err = ufshcd_add_scsi_host(hba); 10922 10907 if (err) 10923 10908 goto out_disable; 10924 10909