x86/apic: Read Error Status Register correctly
authorRichard Weinberger <richard@nod.at>
Tue, 14 Jan 2014 07:44:47 +0000 (08:44 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 14 Jan 2014 13:05:36 +0000 (14:05 +0100)
commit60283df7ac26a4fe2d56631ca2946e04725e7eaf
tree27ee649bd8612ab1e0f3e531ce952e9b4f50b8e4
parent7e22e91102c6b9df7c4ae2168910e19d2bb14cd6
x86/apic: Read Error Status Register correctly

Currently we do a read, a dummy write and a final read to fetch
the error code. The value from the final read is taken.
This is not the recommended way and leads to corrupted/lost ESR
values.

Intel(c) 64 and IA-32 Architectures Software Developer's Manual,
Combined Volumes 1, 2ABC, 3ABC, Section 10.5.3 states:

  Before attempt to read from the ESR, software should first
  write to it. (The value written does not affect the values read
  subsequently; only zero may be written in x2APIC mode.) This
  write clears any previously logged errors and updates the ESR
  with any errors detected since the last write to the ESR.
  This write also rearms the APIC error interrupt triggering
  mechanism.

This patch removes the first read such that we are conform with
the manual.

On my (very old) Pentium MMX SMP system this patch fixes the
issue that APIC errors:

  a) are not always reported and
  b) are reported with false error numbers.

Signed-off-by: Richard Weinberger <richard@nod.at>
Cc: seiji.aguchi@hds.com
Cc: rientjes@google.com
Cc: konrad.wilk@oracle.com
Cc: bp@alien8.de
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1389685487-20872-1-git-send-email-richard@nod.at
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/apic/apic.c