public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Alexandre Ghiti <alexghiti@rivosinc.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Anup Patel <anup@brainfault.org>,
	Sunil V L <sunilvl@ventanamicro.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: Re: [RFC PATCH] riscv: Fix PCI warning by enabling PCI_MSI_ARCH_FALLBACKS
Date: Fri, 13 Dec 2024 14:12:04 +0100	[thread overview]
Message-ID: <87v7vn917f.ffs@tglx> (raw)
In-Reply-To: <20241213115704.353665-1-alexghiti@rivosinc.com>

On Fri, Dec 13 2024 at 12:57, Alexandre Ghiti wrote:
> When the interrupt controller is not using the IMSIC and ACPI is enabled,
> the following warning appears:
>
> [    0.866401] WARNING: CPU: 1 PID: 1 at drivers/pci/msi/msi.h:121 pci_msi_setup_msi_irqs+0x2c/0x32
> [    0.867071] Modules linked in:
> [    0.867389] CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.13.0-rc2-00001-g795582ce7e24-dirty #44
> [    0.867538] Hardware name: QEMU QEMU Virtual Machine, BIOS
> [    0.867672] epc : pci_msi_setup_msi_irqs+0x2c/0x32
> [    0.867738]  ra : __pci_enable_msix_range+0x30c/0x596

Removing a ton of badly formatted stack trace:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#backtraces-in-commit-messages

>
> So enable PCI_MSI_ARCH_FALLBACKS to get rid of this.

No. PCI_MSI_ARCH_FALLBACKS is really only meant for architectures which
implement the legacy fallbacks and not to paper over the underlying
logic bug in the pci/msi code. Of course the loongson folks ran into the
same problem two years ago and went for the sloppy fix without talking
to anyone...

Thanks for bringing it up instead of silently slapping it into the RISCV
tree !

The uncompiled patch below should fix this for real.

Thanks,

        tglx
---
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -185,7 +185,6 @@ config LOONGARCH
 	select PCI_DOMAINS_GENERIC
 	select PCI_ECAM if ACPI
 	select PCI_LOONGSON
-	select PCI_MSI_ARCH_FALLBACKS
 	select PCI_QUIRKS
 	select PERF_USE_VMALLOC
 	select RTC_LIB
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -350,8 +350,11 @@ bool pci_msi_domain_supports(struct pci_
 
 	domain = dev_get_msi_domain(&pdev->dev);
 
-	if (!domain || !irq_domain_is_hierarchy(domain))
-		return mode == ALLOW_LEGACY;
+	if (!domain || !irq_domain_is_hierarchy(domain)) {
+		if (IS_ENABLED(CONFIG_PCI_MSI_ARCH_FALLBACKS))
+			return mode == ALLOW_LEGACY;
+		return false;
+	}
 
 	if (!irq_domain_is_msi_parent(domain)) {
 		/*
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -442,6 +442,10 @@ int __pci_enable_msi_range(struct pci_de
 	if (nvec > maxvec)
 		nvec = maxvec;
 
+	/* Test for the availability of MSI support */
+	if (!pci_msi_domain_supports(dev, 0, ALLOW_LEGACY))
+		return -ENOTSUPP;
+
 	rc = pci_setup_msi_context(dev);
 	if (rc)
 		return rc;

  reply	other threads:[~2024-12-13 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 11:57 [RFC PATCH] riscv: Fix PCI warning by enabling PCI_MSI_ARCH_FALLBACKS Alexandre Ghiti
2024-12-13 13:12 ` Thomas Gleixner [this message]
2024-12-13 13:51   ` Alexandre Ghiti
2024-12-14 11:50     ` [Patch] PCI/MSI: Handle lack of irqdomain gracefully Thomas Gleixner
2024-12-17 13:08       ` [tip: irq/urgent] " tip-bot2 for Thomas Gleixner
2025-02-03 19:16       ` [Patch] " patchwork-bot+linux-riscv
2026-03-11 11:22       ` Uwe Kleine-König

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=87v7vn917f.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=alexghiti@rivosinc.com \
    --cc=anup@brainfault.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sunilvl@ventanamicro.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