Linux-PCI Archive mirror
 help / color / mirror / Atom feed
From: Yadu M G <yadu.mg@oss.qualcomm.com>
To: shawn.lin@rock-chips.com
Cc: jingoohan1@gmail.com, mani@kernel.org, lpieralisi@kernel.org,
	kwilczynski@kernel.org, bhelgaas@google.com, robh@kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] PCI: dwc: Initialize pp->lock before MSI domain registration
Date: Thu, 14 May 2026 23:49:01 +0530	[thread overview]
Message-ID: <20260514181901.315647-1-yadu.mg@oss.qualcomm.com> (raw)

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 initialized in dw_pcie_host_init(). However, on
Qcom firmware managed platforms the MSI domain is allocated from a
custom .msi_init callback by calling dw_pcie_allocate_domains()
directly, bypassing dw_pcie_host_init(). This leaves pp->lock without a
lockdep key and triggers the warning when MSI vectors are later
allocated.

Initialize pp->lock in dw_pcie_allocate_domains() before registering the
MSI IRQ domain so direct callers from custom .msi_init() paths always
have a properly initialized lock. Keep the existing initialization in
dw_pcie_host_init(), since pp->lock is also used by legacy INTx handling
and may be taken from glue .init() callbacks even when MSI is disabled.

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

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index c9517a348836..de316f103c73 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -215,6 +215,13 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
 		.host_data	= pp,
 	};
 
+	/*
+	 * Initialize pp->lock here to cover direct callers from custom
+	 * .msi_init() paths (e.g. firmware-managed platforms) that
+	 * bypass dw_pcie_host_init().
+	 */
+	raw_spin_lock_init(&pp->lock);
+
 	pp->irq_domain = msi_create_parent_irq_domain(&info, &dw_pcie_msi_parent_ops);
 	if (!pp->irq_domain) {
 		dev_err(pci->dev, "Failed to create IRQ domain\n");
-- 
2.43.0


             reply	other threads:[~2026-05-14 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 18:19 Yadu M G [this message]
2026-05-14 21:26 ` [PATCH v2] PCI: dwc: Initialize pp->lock before MSI domain registration sashiko-bot
2026-06-04  7:45   ` Manivannan Sadhasivam
2026-06-04 12:24     ` [PATCH v3] PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts Yadu M G
2026-06-04 15:17       ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260514181901.315647-1-yadu.mg@oss.qualcomm.com \
    --to=yadu.mg@oss.qualcomm.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).