Skip to contentSkip to conversation

scsi: ufs: qcom: fix platform_msi_domain_free_irqs() reference

PATCH Applied Arnd Bergmann 4 participants 7 messages Jan 26, 2023 – Feb 9, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: qcom: fix platform_msi_domain_free_irqs() reference

From: Arnd Bergmann <[email protected]>

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

 1698 |         platform_msi_domain_free_irqs(hba->dev);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above that, the symbol that guards the other call was recently removed, so that is all dead code at the moment.

Remove the incorrect #ifdef and instead of a Kconfig dependency to only allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both of which should be present on kernels that can run on Qualcomm SoCs.

The 'select RESET_CONTROLLER' in combination with this dependency unfortunately causes a dependency loop and this is a user-visible symbol, so it's better to change both to 'depends on'.

Fixes 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Fixes 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")

---
Not sure if this is the best solution, both the GENERIC_MSI_IRQ dependencies and the RESET_CONTROLLER dependencies are a bit inconsistent already. Feel free to pick another approach that addresses both of the bugs I found.

---
 drivers/ufs/host/Kconfig    | 3 ++-
 drivers/ufs/host/ufs-qcom.c | 8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/ufs/host/Kconfig +2 -1
index 139064e70a34..663881437921 100644
@@ -57,8 +57,9 @@ config SCSI_UFS_DWC_TC_PLATFORM
 config SCSI_UFS_QCOM
 	tristate "QCOM specific hooks to UFS controller platform driver"
 	depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
+	depends on GENERIC_MSI_IRQ
+	depends on RESET_CONTROLLER
 	select QCOM_SCM if SCSI_UFS_CRYPTO
-	select RESET_CONTROLLER
 	help
 	  This selects the QCOM specific additions to UFSHCD platform driver.
 	  UFS host on QCOM needs some vendor specific configuration before
drivers/ufs/host/ufs-qcom.c +0 -8
index 681da3ea7154..eb66b5f6cf19 100644
@@ -1538,7 +1538,6 @@ static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
 	return 0;
 }
 
-#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
 static void ufs_qcom_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
 {
 	struct device *dev = msi_desc_to_dev(desc);
@@ -1626,13 +1625,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
 	return ret;
 }
 
-#else
-static int ufs_qcom_config_esi(struct ufs_hba *hba)
-{
-	return -EOPNOTSUPP;
-}
-#endif
-
 /*
  * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
  *
Signature · 1 line
2.39.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

 1698 |         platform_msi_domain_free_irqs(hba->dev);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above that, the symbol that guards the other call was recently removed, so that is all dead code at the moment.

Remove the incorrect #ifdef and instead of a Kconfig dependency to only allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both of which should be present on kernels that can run on Qualcomm SoCs.

Quoted 7 lines

The 'select RESET_CONTROLLER' in combination with this dependency unfortunately causes a dependency loop and this is a user-visible symbol, so it's better to change both to 'depends on'.

Fixes 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Fixes 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")
Quoted 5 lines

---
Not sure if this is the best solution, both the GENERIC_MSI_IRQ dependencies and the RESET_CONTROLLER dependencies are a bit inconsistent already. Feel free to pick another approach that addresses both of the bugs I found.

I think your proposed solution works best at the moment.

Thanks,
Mani

Quoted 49 lines
---
 drivers/ufs/host/Kconfig    | 3 ++-
 drivers/ufs/host/ufs-qcom.c | 8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/ufs/host/Kconfig +2 -1
index 139064e70a34..663881437921 100644
@@ -57,8 +57,9 @@ config SCSI_UFS_DWC_TC_PLATFORM
 config SCSI_UFS_QCOM
 	tristate "QCOM specific hooks to UFS controller platform driver"
 	depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
+	depends on GENERIC_MSI_IRQ
+	depends on RESET_CONTROLLER
 	select QCOM_SCM if SCSI_UFS_CRYPTO
-	select RESET_CONTROLLER
 	help
 	  This selects the QCOM specific additions to UFSHCD platform driver.
 	  UFS host on QCOM needs some vendor specific configuration before
drivers/ufs/host/ufs-qcom.c +0 -8
index 681da3ea7154..eb66b5f6cf19 100644
@@ -1538,7 +1538,6 @@ static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
 	return 0;
 }
 
-#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
 static void ufs_qcom_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
 {
 	struct device *dev = msi_desc_to_dev(desc);
@@ -1626,13 +1625,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
 	return ret;
 }
 
-#else
-static int ufs_qcom_config_esi(struct ufs_hba *hba)
-{
-	return -EOPNOTSUPP;
-}
-#endif
-
 /*
  * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
  *
Signature · 1 line
2.39.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#2 lore raw

Hi Mani and Arnd,

Quoted 76 lines · Manivannan Sadhasivam
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

  1698 |         platform_msi_domain_free_irqs(hba->dev);
       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above that, the symbol that guards the other call was recently removed, so that is all dead code at the moment.

Remove the incorrect #ifdef and instead of a Kconfig dependency to only allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both of which should be present on kernels that can run on Qualcomm SoCs.

Quoted 7 lines

The 'select RESET_CONTROLLER' in combination with this dependency unfortunately causes a dependency loop and this is a user-visible symbol, so it's better to change both to 'depends on'.

Fixes 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Fixes 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")
Quoted 5 lines

---
Not sure if this is the best solution, both the GENERIC_MSI_IRQ dependencies and the RESET_CONTROLLER dependencies are a bit inconsistent already. Feel free to pick another approach that addresses both of the bugs I found.

I think your proposed solution works best at the moment.

Thanks,
Mani

Quoted 36 lines
---
  drivers/ufs/host/Kconfig    | 3 ++-
  drivers/ufs/host/ufs-qcom.c | 8 --------
  2 files changed, 2 insertions(+), 9 deletions(-)
drivers/ufs/host/Kconfig +2 -1
index 139064e70a34..663881437921 100644
@@ -57,8 +57,9 @@ config SCSI_UFS_DWC_TC_PLATFORM
  config SCSI_UFS_QCOM
  	tristate "QCOM specific hooks to UFS controller platform driver"
  	depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
+	depends on GENERIC_MSI_IRQ
+	depends on RESET_CONTROLLER
  	select QCOM_SCM if SCSI_UFS_CRYPTO
-	select RESET_CONTROLLER
  	help
  	  This selects the QCOM specific additions to UFSHCD platform driver.
  	  UFS host on QCOM needs some vendor specific configuration before
drivers/ufs/host/ufs-qcom.c +0 -1
index 681da3ea7154..eb66b5f6cf19 100644
@@ -1538,7 +1538,6 @@ static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
  	return 0;
  }
 
-#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
  static void ufs_qcom_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
  {
  	struct device *dev = msi_desc_to_dev(desc);
@@ -1626,13 +1625,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
  	return ret;
  }
 
Quoted 13 lines
Quoted 13 lines
drivers/ufs/host/ufs-qcom.c +0 -7
-#else
-static int ufs_qcom_config_esi(struct ufs_hba *hba)
-{
-	return -EOPNOTSUPP;
-}
-#endif
-
  /*
   * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
   *
Signature · 1 line
2.39.0

Thank you for pointing to 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN"),

which I was not aware of. I am thinking about fixing it just like how

13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN") is fixing drivers/dma/qcom/hidma.c -

In ufs-qcom.c, use CONFIG_GENERIC_MSI_IRQ instead of CONFIG_GENERIC_MSI_IRQ_DOMAIN,

and meanwhile add #ifdef check before calling platform_msi_domain_free_irqs().

Please let me know your idea.

Thanks.
Regards,
Can Guo

#3 lore raw
Quoted 99 lines · Can Guo

Hi Mani and Arnd,

Quoted 79 lines · Manivannan Sadhasivam
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

  1698 |         platform_msi_domain_free_irqs(hba->dev);
       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above that, the symbol that guards the other call was recently removed, so that is all dead code at the moment.

Remove the incorrect #ifdef and instead of a Kconfig dependency to only allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both of which should be present on kernels that can run on Qualcomm SoCs.

Quoted 7 lines

The 'select RESET_CONTROLLER' in combination with this dependency unfortunately causes a dependency loop and this is a user-visible symbol, so it's better to change both to 'depends on'.

Fixes 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Fixes 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")
Quoted 5 lines

---
Not sure if this is the best solution, both the GENERIC_MSI_IRQ dependencies and the RESET_CONTROLLER dependencies are a bit inconsistent already. Feel free to pick another approach that addresses both of the bugs I found.

I think your proposed solution works best at the moment.

Thanks,
Mani

Quoted 39 lines
---
  drivers/ufs/host/Kconfig    | 3 ++-
  drivers/ufs/host/ufs-qcom.c | 8 --------
  2 files changed, 2 insertions(+), 9 deletions(-)
drivers/ufs/host/Kconfig +2 -1
index 139064e70a34..663881437921 100644
@@ -57,8 +57,9 @@ config SCSI_UFS_DWC_TC_PLATFORM
  config SCSI_UFS_QCOM
  	tristate "QCOM specific hooks to UFS controller platform driver"
  	depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
+	depends on GENERIC_MSI_IRQ
+	depends on RESET_CONTROLLER
  	select QCOM_SCM if SCSI_UFS_CRYPTO
-	select RESET_CONTROLLER
  	help
  	  This selects the QCOM specific additions to UFSHCD platform driver.
  	  UFS host on QCOM needs some vendor specific configuration before
drivers/ufs/host/ufs-qcom.c +0 -6
index 681da3ea7154..eb66b5f6cf19 100644
@@ -1538,7 +1538,6 @@ static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
  	return 0;
  }
-#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
  static void ufs_qcom_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
  {
  	struct device *dev = msi_desc_to_dev(desc);
@@ -1626,13 +1625,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
  	return ret;
  }
-#else
-static int ufs_qcom_config_esi(struct ufs_hba *hba)
-{
-	return -EOPNOTSUPP;
-}
Quoted 8 lines
Quoted 8 lines
drivers/ufs/host/ufs-qcom.c +0 -2
-#endif
-
  /*
   * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
   *
Signature · 1 line
2.39.0

Thank you for pointing to 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN"),

which I was not aware of. I am thinking about fixing it just like how

13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN") is fixing drivers/dma/qcom/hidma.c -

Quoted 8 lines

In ufs-qcom.c, use CONFIG_GENERIC_MSI_IRQ instead of CONFIG_GENERIC_MSI_IRQ_DOMAIN,

and meanwhile add #ifdef check before calling
platform_msi_domain_free_irqs().

Please let me know your idea.

No. Let's get rid of the ifdef's please... I like Arnd's patch as it models the dependency nicely in Kconfig. And most (all?) of the qcom platforms require GENERIC_MSI_IRQ and RESET_CONTROLLER one way or the other anyway.

Thanks,
Mani

Quoted 6 lines

Thanks.
Regards,
Can Guo

Signature · 1 line
மணிவண்ணன் சதாசிவம்
#4 lore raw

Hi Mani,

Quoted 105 lines · Manivannan Sadhasivam
Quoted 104 lines · Can Guo

Hi Mani and Arnd,

Quoted 79 lines · Manivannan Sadhasivam
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

   1698 |         platform_msi_domain_free_irqs(hba->dev);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above that, the symbol that guards the other call was recently removed, so that is all dead code at the moment.

Remove the incorrect #ifdef and instead of a Kconfig dependency to only allow building the driver when CONFIG_GENERIC_MSI_IRQ is enabled. This symbol is always present when PCI_MSI or ARM_GIC_V3_ITS are enabled, both of which should be present on kernels that can run on Qualcomm SoCs.

Quoted 7 lines

The 'select RESET_CONTROLLER' in combination with this dependency unfortunately causes a dependency loop and this is a user-visible symbol, so it's better to change both to 'depends on'.

Fixes 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Fixes 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN")
Quoted 5 lines

---
Not sure if this is the best solution, both the GENERIC_MSI_IRQ dependencies and the RESET_CONTROLLER dependencies are a bit inconsistent already. Feel free to pick another approach that addresses both of the bugs I found.

I think your proposed solution works best at the moment.

Thanks,
Mani

Quoted 39 lines
---
   drivers/ufs/host/Kconfig    | 3 ++-
   drivers/ufs/host/ufs-qcom.c | 8 --------
   2 files changed, 2 insertions(+), 9 deletions(-)
drivers/ufs/host/Kconfig +2 -1
index 139064e70a34..663881437921 100644
@@ -57,8 +57,9 @@ config SCSI_UFS_DWC_TC_PLATFORM
   config SCSI_UFS_QCOM
   	tristate "QCOM specific hooks to UFS controller platform driver"
   	depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
+	depends on GENERIC_MSI_IRQ
+	depends on RESET_CONTROLLER
   	select QCOM_SCM if SCSI_UFS_CRYPTO
-	select RESET_CONTROLLER
   	help
   	  This selects the QCOM specific additions to UFSHCD platform driver.
   	  UFS host on QCOM needs some vendor specific configuration before
drivers/ufs/host/ufs-qcom.c +0 -6
index 681da3ea7154..eb66b5f6cf19 100644
@@ -1538,7 +1538,6 @@ static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
   	return 0;
   }
-#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
   static void ufs_qcom_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
   {
   	struct device *dev = msi_desc_to_dev(desc);
@@ -1626,13 +1625,6 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba)
   	return ret;
   }
-#else
-static int ufs_qcom_config_esi(struct ufs_hba *hba)
-{
-	return -EOPNOTSUPP;
-}
Quoted 8 lines
Quoted 8 lines
drivers/ufs/host/ufs-qcom.c +0 -2
-#endif
-
   /*
    * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
    *
Signature · 1 line
2.39.0

Thank you for pointing to 13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN"),

which I was not aware of. I am thinking about fixing it just like how

13e7accb81d6 ("genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN") is fixing drivers/dma/qcom/hidma.c -

In ufs-qcom.c, use CONFIG_GENERIC_MSI_IRQ instead of CONFIG_GENERIC_MSI_IRQ_DOMAIN,

and meanwhile add #ifdef check before calling
platform_msi_domain_free_irqs().

Quoted 8 lines
Quoted 2 lines

Please let me know your idea.

No. Let's get rid of the ifdef's please... I like Arnd's patch as it models the dependency nicely in Kconfig. And most (all?) of the qcom platforms require GENERIC_MSI_IRQ and RESET_CONTROLLER one way or the other anyway.

Thanks,
Mani

Make sense, I agree.

Thanks,

Can Guo.

Quoted 6 lines
Quoted 6 lines

Thanks.
Regards,
Can Guo

#5 lore raw
In reply to Arnd Bergmann

Arnd,

Quoted 3 lines

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

Applied to 6.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#6 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

The newly added MSI support is mostly hidden inside of an #ifdef, except for one line that now causes a build failure when MSI is disabled:

drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_remove':
drivers/ufs/host/ufs-qcom.c:1698:9: error: implicit declaration of function 'platform_msi_domain_free_irqs' [-Werror=i]

 1698 |         platform_msi_domain_free_irqs(hba->dev);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Applied to 6.3/scsi-queue, thanks!

[1/1] scsi: ufs: qcom: fix platform_msi_domain_free_irqs() reference

      https://git.kernel.org/mkp/scsi/c/49f262bc3c7a
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering