linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: David Laight <David.Laight@aculab.com>
Cc: 'Thomas Gleixner' <tglx@linutronix.de>,
	'Maximilian Luz' <luzmaximilian@gmail.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Sachi King <nakato@nakato.io>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] x86/i8259: Work around buggy legacy PIC
Date: Fri, 14 May 2021 18:19:41 +0200	[thread overview]
Message-ID: <YJ6jHYM5oXyYHIX9@gmail.com> (raw)
In-Reply-To: <bbf5d417ee0d4edbbed31f19ef40fad0@AcuMS.aculab.com>


* David Laight <David.Laight@ACULAB.COM> wrote:

> > > 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.
> > 
> >         unsigned char probe_val = ~(1 << PIC_CASCADE_IR);
> > 
> > 	outb(probe_val, PIC_MASTER_IMR);
> > 	new_val = inb(PIC_MASTER_IMR);
> > 
> > How is that writing 0xFF?
> 
> Sorry I misread the code and diagnostic output.
> 
> In any case writing a value and expecting the same value back
> isn't exactly a high-quality probe.

It's not, and it's not intended to be: 0x21 is a well-known port nobody was 
crazy enough to override yet, so that probe basically filters out the 
"there is nothing at that port, at all" case, which would normally return 
0xff, or in a few weird cases 0x00 perhaps.

Writing something inbetween those values and getting the same value back 
tells us that something functional occupies that well-known IO-port, 
pretending to be a i8259 PIC.

Which is what we wanted to know, given the context.

Thanks,

	Ingo

  reply	other threads:[~2021-05-14 16:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 21:04 [PATCH] x86/i8259: Work around buggy legacy PIC Maximilian Luz
2021-05-13  8:10 ` David Laight
2021-05-13 10:11   ` Maximilian Luz
2021-05-13 10:36     ` David Laight
2021-05-14 13:01       ` Thomas Gleixner
2021-05-14 13:13         ` David Laight
2021-05-14 16:19           ` Ingo Molnar [this message]
2021-05-14 19:41       ` Sachi King
2021-05-14 10:51         ` David Laight
2021-05-14 11:58         ` Maximilian Luz
2021-05-14 17:32           ` Thomas Gleixner
2021-05-14 17:35             ` H. Peter Anvin
2021-05-14 22:47               ` Maximilian Luz
2021-05-17 18:40                 ` Thomas Gleixner
2021-05-17 19:25                   ` Maximilian Luz
2021-05-17 23:27                     ` Thomas Gleixner
2021-05-18  8:28                       ` Andy Shevchenko
2021-05-18 19:58                       ` Sachi King
2021-05-18 15:45                         ` Thomas Gleixner
2021-05-14 13:44     ` Thomas Gleixner
2021-05-14 16:12       ` David Laight
2021-05-14 17:28         ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJ6jHYM5oXyYHIX9@gmail.com \
    --to=mingo@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=mingo@redhat.com \
    --cc=nakato@nakato.io \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).