mbox series

[RFC,0/2] x86/PCI: SiS PIRQ router updates

Message ID alpine.DEB.2.21.2106240047560.37803@angie.orcam.me.uk (mailing list archive)
Headers show
Series x86/PCI: SiS PIRQ router updates | expand

Message

Maciej W. Rozycki June 23, 2021, 11:38 p.m. UTC
Hi,

 Nikolai has observed the trigger mode not being fixed up once it has been 
incorrectly set by the BIOS for PCI devices, causing all kinds of usual 
issues.  As it turns out we don't have a PIRQ router defined for the 
SiS85C497 southbridge, which Nikolai's system uses, and which is different 
from the SiS85C503 southbridge we have support for.

 As we use the generic `sis' infix (capitalised or not) for the SiS85C503 
southbridge I have prepared this small patch series to first make the 
existing SiS program entities use a more specific `sis503' infix, and then
provide a suitable PIRQ router for the SiS85C497 device.

 Posted as an RFC at this stage as it still has to be verified.

 Nikolai, can you please give it a hit with the extra debug patch as 
requested in my other message?

  Maciej

Comments

Nikolai Zhubr July 2, 2021, 5:27 p.m. UTC | #1
Hello Maciej,

24.06.2021 2:38, Maciej W. Rozycki:
>   As we use the generic `sis' infix (capitalised or not) for the SiS85C503
> southbridge I have prepared this small patch series to first make the
> existing SiS program entities use a more specific `sis503' infix, and then
> provide a suitable PIRQ router for the SiS85C497 device.
>
>   Posted as an RFC at this stage as it still has to be verified.
>
>   Nikolai, can you please give it a hit with the extra debug patch as
> requested in my other message?

With
linux-x86-pirq-router-sis85c503.diff applied
linux-x86-pirq-router-sis85c497.diff applied
and DEBUG 1 in arch/x86/include/asm/pci_x86.h
here is new log:

https://pastebin.com/n3udQgcq

My feeling is that something went a bit wrong because:

8139too 0000:00:0d.0: can't route interrupt

and

# 8259A.pl
irq 0: 00, edge
irq 1: 00, edge
irq 2: 00, edge
irq 3: 00, edge
irq 4: 00, edge
irq 5: 00, edge
irq 6: 00, edge
irq 7: 00, edge
irq 8: 00, edge
irq 9: 00, edge
irq 10: 00, edge
irq 11: 00, edge
irq 12: 00, edge
irq 13: 00, edge
irq 14: 00, edge
irq 15: 00, edge

Note: I still used 4.14 kernel for this test but your patches applied 
cleanly with no fuzz so I suppose it should be ok.


Thank you,

Regards,
Nikolai


>
>    Maciej
>
Maciej W. Rozycki July 2, 2021, 11:09 p.m. UTC | #2
Hello Nikolai,

> >   Nikolai, can you please give it a hit with the extra debug patch as
> > requested in my other message?
> 
> With
> linux-x86-pirq-router-sis85c503.diff applied
> linux-x86-pirq-router-sis85c497.diff applied
> and DEBUG 1 in arch/x86/include/asm/pci_x86.h
> here is new log:
> 
> https://pastebin.com/n3udQgcq
> 
> My feeling is that something went a bit wrong because:
> 
> 8139too 0000:00:0d.0: can't route interrupt

 More important is actually the previous line:

PCI: Attempting to find IRQ router for [0000:0000]

meaning that the PIRQ structure defined by the BIOS has not specified the 
vendor:device ID pair for the router [1039:0496] which we match against.

 I don't know where exactly the definition our `struct irq_routing_table' 
corresponds to comes from (I'll appreciate pointers!); it has not been 
given in the PCI BIOS 2.1 specification, only individual IRQ routing 
entries have.  It may well be that [0000:0000] is a legitimate blanket 
entry requesting the OS to figure out itself which device is the hardware 
router.

 Anyway it is something we can handle in a reasonably staightforward 
manner, so I'll spend some time to implement such wildcard matching.  Most 
importantly your system does have the router structure, so barring this 
minor snag it can be handled properly without horrible hacks.  We're very 
close now.

> Note: I still used 4.14 kernel for this test but your patches applied cleanly
> with no fuzz so I suppose it should be ok.

 Indeed, that does not matter.  This code is very old, dating back to 
1990s.

  Maciej
Maciej W. Rozycki July 5, 2021, 10:54 a.m. UTC | #3
On Sat, 3 Jul 2021, Maciej W. Rozycki wrote:

> > >   Nikolai, can you please give it a hit with the extra debug patch as
> > > requested in my other message?
> > 
> > With
> > linux-x86-pirq-router-sis85c503.diff applied
> > linux-x86-pirq-router-sis85c497.diff applied
> > and DEBUG 1 in arch/x86/include/asm/pci_x86.h
> > here is new log:
> > 
> > https://pastebin.com/n3udQgcq
> > 
> > My feeling is that something went a bit wrong because:
> > 
> > 8139too 0000:00:0d.0: can't route interrupt
> 
>  More important is actually the previous line:
> 
> PCI: Attempting to find IRQ router for [0000:0000]
> 
> meaning that the PIRQ structure defined by the BIOS has not specified the 
> vendor:device ID pair for the router [1039:0496] which we match against.

 So it's actually both the vendor:device ID pair and the bus address that 
matter here.  I've now posted a patch I am fairly sure about that combined 
with the earlier changes it will fix your issue.  I have verified it in a 
simulated environment where the PIRQ routing table has an invalid vendor 
ID given, with correct results produced:

PCI: Attempting to find IRQ router for [0000:0000]
PCI: Trying IRQ router for [8086:1250]
PCI: Trying IRQ router for [8086:7000]
pci 0000:00:07.0: SIO/PIIX/ICH IRQ router [8086:7000]

 Please let me know of the outcome.

  Maciej
Maciej W. Rozycki July 8, 2021, 8:49 p.m. UTC | #4
On Thu, 24 Jun 2021, Maciej W. Rozycki wrote:

>  Posted as an RFC at this stage as it still has to be verified.

 So this has passed verification as it is, although with an extra change, 
not directly related.  Shall I repost the series unchanged with the "RFC" 
annotation removed then, or can it go in as posted?

  Maciej