Re: [PATCH] scsi: ufs: core: Check LSDBS cap when !mcq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/3/24 8:38 PM, Kyoungrul Kim wrote:
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 1b65e6ae4137..c706645c0914 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2413,6 +2413,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
  	}
hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);
+	hba->lsdb_sup = FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
  	if (!hba->mcq_sup)
  		return 0;
@@ -10449,6 +10450,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
  	}
if (!is_mcq_supported(hba)) {
+		if (!hba->lsdb_sup) {
+			dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported\n",
+				__func__, hba->lsdb_sup);
+			err = -EINVAL;
+			goto out_disable;
+		}
  		err = scsi_add_host(host, hba->dev);
  		if (err) {
  			dev_err(hba->dev, "scsi_add_host failed\n");
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index bad88bd91995..fd391f6eee73 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1074,6 +1074,7 @@ struct ufs_hba {
  	bool ext_iid_sup;
  	bool scsi_host_added;
  	bool mcq_sup;
+	bool lsdb_sup;
  	bool mcq_enabled;
  	struct ufshcd_res_info res[RES_MAX];
  	void __iomem *mcq_base;
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index 385e1c6b8d60..22ba85e81d8c 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -75,6 +75,7 @@ enum {
  	MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT	= 0x02000000,
  	MASK_UIC_DME_TEST_MODE_SUPPORT		= 0x04000000,
  	MASK_CRYPTO_SUPPORT			= 0x10000000,
+	MASK_LSDB_SUPPORT			= 0x20000000,
  	MASK_MCQ_SUPPORT			= 0x40000000,
  };

The LSDB bit is defined in the UFSHCI 4.0 specification but not in the
UFSHCI 3.0 specification. Has this patch been tested on a setup with a
UFSHCI 3.0 controller? I think that this patch breaks UFSHCI 3.0
support.

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux