Hi, Krzysztof and Bjorn I will improve my spelling, others see below please. On Fri, May 14, 2021 at 11:51 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote: > > On Fri, May 14, 2021 at 04:00:24PM +0800, Huacai Chen wrote: > > From: Jianmin Lv <lvjianmin@xxxxxxxxxxx> > > > > In LS7A, multifunction device use same pci PIN and different > > irq for different function, so fix it for standard pci PIN > > usage. > > Apparently the defect here is that the Interrupt Pin register reports > the wrong INTx values? In LS7A, the Pin register is hardcoded to the same value for all functions in multi-function devices, so we need this. > > Will this be fixed in future hardware so we don't have to add more > devices to the quirk? This will be fixed in future hardware. Huacai > > > 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,23 @@ 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) > > +{ > > + static const struct pci_device_id devids[] = { > > + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_0) }, > > + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_1) }, > > + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_2) }, > > + { 0, }, > > + }; > > + > > + if (pci_match_id(devids, dev)) { > > + u8 fun = dev->devfn & 7; > > Use PCI_FUNC(). > > > + dev->pin = 1 + (fun & 3); > > + } > > +} > > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_ANY_ID, loongson_pci_pin_quirk); > > The usual pattern is to list each device here instead of using > pci_match_id() in the quirk, e.g., > > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, 0x7a09, loongson_pci_pin_quirk); > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, 0x7a19, loongson_pci_pin_quirk); > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, 0x7a29, loongson_pci_pin_quirk); > > > static void loongson_mrrs_quirk(struct pci_dev *dev) > > { > > struct pci_bus *bus = dev->bus; > > -- > > 2.27.0 > >