[PATCH v3] PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts

Yadu M G posted 1 patch 3 days, 20 hours ago
drivers/pci/controller/dwc/pcie-qcom.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH v3] PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts
Posted by Yadu M G 3 days, 20 hours ago
A lockdep warning is observed during boot on a Qcom firmware-managed
platform:

  INFO: trying to register non-static key.
  The code is fine but needs lockdep annotation, or maybe
  you didn't initialize this object before use?
  turning off the locking correctness validator.
  ...
  Call trace:
   register_lock_class+0x128/0x4d8
   __lock_acquire+0x110/0x1db0
   lock_acquire+0x278/0x3d8
   _raw_spin_lock_irq+0x6c/0xc0
   dw_pcie_irq_domain_alloc+0x48/0x190
   irq_domain_alloc_irqs_parent+0x2c/0x48
   msi_domain_alloc+0x90/0x160
  ...

dw_pcie_irq_domain_alloc() takes pp->lock while allocating MSI
interrupts. pp->lock is normally initialized by dw_pcie_host_init(), but
Qcom firmware-managed hosts use the ECAM init path instead:

  pci_host_common_ecam_create()
    pci_ecam_create()
      qcom_pcie_ecam_host_init()
        dw_pcie_msi_host_init()
          dw_pcie_allocate_domains()

That path constructs a fresh struct dw_pcie_rp and calls
dw_pcie_msi_host_init() directly, without going through
dw_pcie_host_init(). As a result, pp->lock has no lockdep key when MSI
vectors are later allocated, which triggers the warning.

Initialize pp->lock in qcom_pcie_ecam_host_init() before registering the
MSI domains so the firmware-managed ECAM path matches the normal DWC host
initialization sequence.

Signed-off-by: Yadu M G <yadu.mg@oss.qualcomm.com>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 11fc60489892..b925a7af1d75 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1794,6 +1794,12 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg)
 	pci->dbi_base = cfg->win;
 	pp->num_vectors = MSI_DEF_NUM_VECTORS;
 
+	/*
+	 * dw_pcie_msi_host_init() is called directly here, bypassing
+	 * dw_pcie_host_init() where pp->lock is normally initialized.
+	 */
+	raw_spin_lock_init(&pp->lock);
+
 	ret = dw_pcie_msi_host_init(pp);
 	if (ret)
 		return ret;
-- 
2.43.0
Re: [PATCH v3] PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts
Posted by Manivannan Sadhasivam 3 days, 17 hours ago
On Thu, 04 Jun 2026 17:54:18 +0530, Yadu M G wrote:
> A lockdep warning is observed during boot on a Qcom firmware-managed
> platform:
> 
>   INFO: trying to register non-static key.
>   The code is fine but needs lockdep annotation, or maybe
>   you didn't initialize this object before use?
>   turning off the locking correctness validator.
>   ...
>   Call trace:
>    register_lock_class+0x128/0x4d8
>    __lock_acquire+0x110/0x1db0
>    lock_acquire+0x278/0x3d8
>    _raw_spin_lock_irq+0x6c/0xc0
>    dw_pcie_irq_domain_alloc+0x48/0x190
>    irq_domain_alloc_irqs_parent+0x2c/0x48
>    msi_domain_alloc+0x90/0x160
>   ...
> 
> [...]

Applied, thanks!

[1/1] PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts
      commit: e0779713a1e2f891aeec53e629dbbd33f423c629

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>