Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: Don't warn when the 32-bit MSI address allocation fails
@ 2026-11-28 22:11 Yuri Zaporozhets
  2026-11-28 22:16 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Yuri Zaporozhets @ 2026-11-28 22:11 UTC (permalink / raw)
  To: Jingoo Han, Manivannan Sadhasivam
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas, linux-pci, linux-kernel, Yuri Zaporozhets

Since commit f3a296405b6e ("PCI: dwc: Strengthen the MSI address
allocation logic"), dw_pcie_msi_host_init() first tries to allocate the
iMSI-RX target address below 4 GiB, and falls back to a 64-bit address
if that fails. The fallback exists for platforms that have no 32-bit DMA
addresses, so on those platforms the first allocation is expected to
fail. The cfg0_base shortcut taken before it does not apply when the
"config" window itself is above 4 GiB, as it is on the K3.

The page allocator cannot know that, and reports the failure with a
full warn_alloc() splat on every boot. On a SpacemiT K3, whose RAM
starts at 4 GiB, with gigabytes free:

  page allocation failure: order:0, mode:0xcc4(GFP_KERNEL|GFP_DMA32), [...]
  Call Trace:
  [...]
   warn_alloc+0xea/0x100
   __alloc_pages_slowpath.constprop.0+0x8bc/0xf4a
  [...]
   dmam_alloc_attrs+0x50/0x98
   dw_pcie_msi_host_init+0xe0/0x26a
   dw_pcie_host_init+0x2fa/0x45e
  [...]
  Mem-Info:
  [...]
   free:1442450 free_pcp:0 free_cma:0
  [...]
  Failed to allocate 32-bit MSI address

Pass __GFP_NOWARN to the 32-bit attempt; dmam_alloc_coherent() turns it
into DMA_ATTR_NO_WARN for the DMA layer as well. The driver's own
dev_warn() still reports that the 32-bit allocation failed, which is
what matters: endpoints that only support 32-bit MSI addresses will not
get MSIs. A failure of the 64-bit attempt is still reported as before.

The K3's PCIe controller is not supported in mainline yet; this was
seen with an out-of-tree glue driver that calls dw_pcie_host_init(). The
path is generic, though: any DWC host whose "config" window is above
4 GiB and which has no memory below 4 GiB takes it.

The problem was diagnosed, and this change and changelog drafted, with
an AI coding assistant (Claude, Anthropic). Tested on a SpacemiT K3
Pico-ITX: the warn_alloc() splat is gone, the dev_warn() remains, and
the port's devices get their MSIs from the 64-bit target address.

Fixes: f3a296405b6e ("PCI: dwc: Strengthen the MSI address allocation logic")
Signed-off-by: Yuri Zaporozhets <yuriz@vodafonemail.de>
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index ab343ed53ba5..0ac669c26afe 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -375,7 +375,7 @@ int dw_pcie_msi_host_init(struct dw_pcie_rp *pp)
 	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 	if (!ret)
 		msi_vaddr = dmam_alloc_coherent(dev, sizeof(u64), &pp->msi_data,
-						GFP_KERNEL);
+						GFP_KERNEL | __GFP_NOWARN);
 
 	if (!msi_vaddr) {
 		dev_warn(dev, "Failed to allocate 32-bit MSI address\n");
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: dwc: Don't warn when the 32-bit MSI address allocation fails
  2026-11-28 22:11 [PATCH] PCI: dwc: Don't warn when the 32-bit MSI address allocation fails Yuri Zaporozhets
@ 2026-11-28 22:16 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-28 22:16 UTC (permalink / raw)
  To: Yuri Zaporozhets; +Cc: linux-pci

> Since commit f3a296405b6e ("PCI: dwc: Strengthen the MSI address
> allocation logic"), dw_pcie_msi_host_init() first tries to allocate the
> iMSI-RX target address below 4 GiB, and falls back to a 64-bit address
> if that fails. The fallback exists for platforms that have no 32-bit DMA
> addresses, so on those platforms the first allocation is expected to
> fail. The cfg0_base shortcut taken before it does not apply when the
> "config" window itself is above 4 GiB, as it is on the K3.
> 
> The page allocator cannot know that, and reports the failure with a
> full warn_alloc() splat on every boot. On a SpacemiT K3, whose RAM
> starts at 4 GiB, with gigabytes free:
> 
>   page allocation failure: order:0, mode:0xcc4(GFP_KERNEL|GFP_DMA32), [...]
>   Call Trace:
>   [...]
> [ ... ]
> Pico-ITX: the warn_alloc() splat is gone, the dev_warn() remains, and
> the port's devices get their MSIs from the 64-bit target address.
> 
> Fixes: f3a296405b6e ("PCI: dwc: Strengthen the MSI address allocation logic")
> Signed-off-by: Yuri Zaporozhets <yuriz@vodafonemail.de>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128221127.147325-1-yuriz@vodafonemail.de?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-28 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 22:11 [PATCH] PCI: dwc: Don't warn when the 32-bit MSI address allocation fails Yuri Zaporozhets
2026-11-28 22:16 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox