Hi, Bjorn, On Sat, May 29, 2021 at 4:51 AM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote: > > [+cc Rob, previous discussion at > https://lore.kernel.org/r/20210514080025.1828197-5-chenhuacai@xxxxxxxxxxx] > > On Fri, May 28, 2021 at 03:15:03PM +0800, Huacai Chen wrote: > > From: Jianmin Lv <lvjianmin@xxxxxxxxxxx> > > > > In LS7A, multifunction device use same PCI PIN (because the PIN register > > report the same INTx value to each function) but we need different IRQ > > for different functions, so add a quirk to fix it for standard PCI PIN > > usage. > > This seems to say that PCI_INTERRUPT_PIN reports the same value for > all functions, but the functions actually use *different* IRQs. > > That would be a hardware defect, and of course, we can work around > such things. It's always better if you can assure us that the defect > will be fixed in future designs so we don't have to update the > workaround with more device IDs. Yes, you are right, and new hardware will not need this workaround. > > But Jiaxun suggests [1] that the FDT says all the interrupts go to the > same IRQ. > > So I don't know what's going on here. We can certainly work around a > problem, but of course, this quirk would apply for both FDT and > ACPI-based systems, and the FDT systems seem to work without it. Emmm, I have discussed with Jiaxun, and maybe you missed something. He means that ACPI systems need this workaround, and FDT systems don't need this. But this workaround doesn't break FDT systems, because FDT systems simply ignore the workaround (interrupts are specified in .dts file). Huacai > > [1] https://lore.kernel.org/r/933330cb-9d86-2b22-9bed-64becefbe2d1@xxxxxxxxxxx > > > Signed-off-by: Jianmin Lv <lvjianmin@xxxxxxxxxxx> > > Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> > > --- > > drivers/pci/quirks.c | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > > index 10b3b2057940..6ab4b3bba36b 100644 > > --- a/drivers/pci/quirks.c > > +++ b/drivers/pci/quirks.c > > @@ -242,6 +242,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, > > DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, > > DEV_LS7A_LPC, loongson_system_bus_quirk); > > > > +static void loongson_pci_pin_quirk(struct pci_dev *dev) > > +{ > > + dev->pin = 1 + (PCI_FUNC(dev->devfn) & 3); > > +} > > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, DEV_PCIE_PORT_0, loongson_pci_pin_quirk); > > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, DEV_PCIE_PORT_1, loongson_pci_pin_quirk); > > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, DEV_PCIE_PORT_2, loongson_pci_pin_quirk); > > + > > static void loongson_mrrs_quirk(struct pci_dev *dev) > > { > > struct pci_bus *bus = dev->bus; > > -- > > 2.27.0 > >