RE: [PATCH] x86/i8259: Work around buggy legacy PIC

From: David Laight
Date: Thu May 13 2021 - 06:36:47 EST




> -----Original Message-----
> From: Maximilian Luz <luzmaximilian@xxxxxxxxx>
> Sent: 13 May 2021 11:12
> To: David Laight <David.Laight@xxxxxxxxxx>; Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Ingo Molnar
> <mingo@xxxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>
> Cc: H. Peter Anvin <hpa@xxxxxxxxx>; Sachi King <nakato@xxxxxxxxx>; x86@xxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] x86/i8259: Work around buggy legacy PIC
>
> On 5/13/21 10:10 AM, David Laight wrote:
> > From: Maximilian Luz
> >> Sent: 12 May 2021 22:05
> >>
> >> The legacy PIC on the AMD variant of the Microsoft Surface Laptop 4 has
> >> some problems on boot. For some reason it consistently does not respond
> >> on the first try, requiring a couple more tries before it finally
> >> responds.
> >
> > That seems very strange, something else must be going on that causes the grief.
> > The 8259 will be built into to the one of the cpu support chips.
> > I can't imagine that requires anything special.
>
> Right, it's definitely strange. Both Sachi (I imagine) and I don't know
> much about these devices, so we're open for suggestions.

I found a copy of the datasheet (I don't seem to have the black book):

https://pdos.csail.mit.edu/6.828/2010/readings/hardware/8259A.pdf

The PC hardware has two 8259 in cascade mode.
(Cascaded using an interrupt that wasn't really using in the original
8088 PC which only had one 8259.)

I wonder if the bios has actually initialised is properly.
Some initialisation writes have to be done to set everything up.

It is also worth noting that the probe code is spectacularly crap.
It writes 0xff and then checks that 0xff is read back.
Almost anything (including a failed PCIe read to the ISA bridge)
will return 0xff and make the test pass.

It's about 35 years since I last wrote the code to initialise an 8259.
The memory cells are foggy.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)