Re: Aw: Re: [PATCH] pci: mediatek: fix warning in msi.h
From: Marc Zyngier
Date: Mon Nov 02 2020 - 06:30:40 EST
On 2020-11-01 22:27, Thomas Gleixner wrote:
On Sun, Nov 01 2020 at 21:47, Marc Zyngier wrote:
On Sun, 01 Nov 2020 18:27:13 +0000,
Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx> wrote:
Thinking of it a bit more, I think this is the wrong solution.
PCI MSIs are optional, and not a requirement. I can trivially spin a
VM with PCI devices and yet no MSI capability (yes, it is more
difficult with real HW), and this results in a bunch of warning, none
of which are actually indicative of anything being wrong.
Well. No.
The problem is that the device enumerates MSI capability, but the host
bridge is not proving support for MSI.
The host bridge fails to mark the bus with PCI_BUS_FLAGS_NO_MSI. That's
the reason why this runs into this issue.
Right, that's the piece I was missing, thanks for that.
However, that doesn't really address the issue when the host bridge and
the MSI widget are two separate entities, oblivious of each other (which
is a pretty common thing on the ARM side).
In this configuration, you can't really decide whether you have a MSI
domain in the host bridge driver (the association is done in the code
PCI code, after you have registered it with the core code), and by the
time you get a pointer to the bus, the endpoints have already been
probed.
The following patch makes it work for me (GICv3 guest without an ITS)by
checking for the presence of an MSI domain at the point where we
actually
perform this association, and before starting to scan for endpoints.
I *think* this should work for the MTK thingy, but someone needs to
go and check.
Thanks,
M.
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4289030b0fff..bb363eb103a2 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -871,6 +871,8 @@ static void pci_set_bus_msi_domain(struct pci_bus
*bus)
d = pci_host_bridge_msi_domain(b);
dev_set_msi_domain(&bus->dev, d);
+ if (!d)
+ bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
}
static int pci_register_host_bridge(struct pci_host_bridge *bridge)
--
Jazz is not dead. It just smells funny...