mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpe@csd.uu.se>
To: macro@ds2.pg.gda.pl, torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, marcelo@conectiva.com.br
Subject: Re: [PATCH] 2.4.17/2.5.1 apic.c LVTERR fixes
Date: Thu, 3 Jan 2002 21:13:05 +0100 (MET)	[thread overview]
Message-ID: <200201032013.VAA03162@harpo.it.uu.se> (raw)

On Thu, 3 Jan 2002 15:57:34 +0100 (MET), Maciej W. Rozycki wrote:
>> @@ -84,6 +88,8 @@
>>  		apic_write_around(APIC_LVTERR, APIC_LVT_MASKED);
>>  	if (maxlvt >= 4)
>>  		apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
>> +	apic_write(APIC_ESR, 0);
>> +	v = apic_read(APIC_ESR);
>>  }
>
> You mustn't access the ESR unconditionally -- it doesn't exist in the
>i82489DX.  Also check the Pentium erratum 3AP for possible issues (I can't
>recall if writing is safe -- possibly only the contents are lost).
>
> Also note that's really an APIC and not a kernel bug -- writing a
>previously read value to a register is defined as valid by Intel. 

Can you quote chapter and verse on that last statement?
(Preferably from IA32 Vol3.) Writes to APIC registers obviously
_do_ cause side-effects in some cases...

Pentium erratum 3AP can be ignored, since the whole purpose of the
two ESR accesses is to clear ESR. Unfortunately, Pentium erratum 11AP
does apply, since there are back-to-back APIC writes (first to LVTERR,
then to ESR).

The patch below fixes the 11AP and 82489DX issues. It has the usual test
before the write to ESR, which avoids both erratum 11AP (should the code
be moved around) and 3AP (redundantly, to avoid confusion).

(Linus, please apply.)

/Mikael

--- linux-2.5.2-pre6/arch/i386/kernel/apic.c.~1~	Thu Jan  3 19:08:00 2002
+++ linux-2.5.2-pre6/arch/i386/kernel/apic.c	Thu Jan  3 19:58:26 2002
@@ -88,8 +88,12 @@
 		apic_write_around(APIC_LVTERR, APIC_LVT_MASKED);
 	if (maxlvt >= 4)
 		apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
-	apic_write(APIC_ESR, 0);
-	v = apic_read(APIC_ESR);
+	v = GET_APIC_VERSION(apic_read(APIC_LVR));
+	if (APIC_INTEGRATED(v)) {	/* !82489DX */
+		if (maxlvt > 3)		/* Due to Pentium errata 3AP and 11AP. */
+			apic_write(APIC_ESR, 0);
+		apic_read(APIC_ESR);
+	}
 }
 
 void __init connect_bsp_APIC(void)

             reply	other threads:[~2002-01-03 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-03 20:13 Mikael Pettersson [this message]
2002-01-04 12:12 ` Maciej W. Rozycki
  -- strict thread matches above, loose matches on Subject: below --
2002-01-04 15:08 Mikael Pettersson
2002-01-04 16:32 ` Maciej W. Rozycki
2001-12-23 15:14 Mikael Pettersson
2002-01-03 14:57 ` Maciej W. Rozycki

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=200201032013.VAA03162@harpo.it.uu.se \
    --to=mikpe@csd.uu.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@ds2.pg.gda.pl \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®