From: "Jan Beulich" Subject: [PATCH] x86: restore (optional) forwarding of PCI SERR induced NMI to Dom0 Date: Mon, 21 Jan 2013 16:11:25 +0000 Message-ID: <50FD76BD02000078000B7FBF@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1021B0BD.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1021B0BD.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline c/s 22949:54fe1011f86b removed the forwarding of NMIs to Dom0 when they were caused by PCI SERR. NMI buttons as well as BMCs (like HP's iLO) may however want such events to be seen in Dom0 (e.g. to trigger a dump). Therefore restore most of the functionality which named c/s removed (adjusted for subsequent changes, and adjusting the public interface to use the modern term, retaining the old one for backwards compatibility). Signed-off-by: Jan Beulich --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -3089,6 +3089,7 @@ static void nmi_mce_softirq(void) static void pci_serr_softirq(void) { printk("\n\nNMI - PCI system error (SERR)\n"); + outb(inb(0x61) & 0x0b, 0x61); /* re-enable the PCI SERR error line. = */ } =20 void async_exception_cleanup(struct vcpu *curr) @@ -3135,9 +3136,20 @@ static void pci_serr_error(struct cpu_us { outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI = SERR error line. */ =20 - /* Would like to print a diagnostic here but can't call printk() - from NMI context -- raise a softirq instead. */ - raise_softirq(PCI_SERR_SOFTIRQ); + switch ( opt_nmi[0] ) + { + case 'd': /* 'dom0' */ + nmi_dom0_report(_XEN_NMIREASON_pci_serr); + case 'i': /* 'ignore' */ + /* Would like to print a diagnostic here but can't call printk() + from NMI context -- raise a softirq instead. */ + raise_softirq(PCI_SERR_SOFTIRQ); + break; + default: /* 'fatal' */ + console_force_unlock(); + printk("\n\nNMI - PCI system error (SERR)\n"); + fatal_trap(TRAP_nmi, regs); + } } =20 static void io_check_error(struct cpu_user_regs *regs) --- a/xen/include/public/nmi.h +++ b/xen/include/public/nmi.h @@ -36,9 +36,14 @@ /* I/O-check error reported via ISA port 0x61, bit 6. */ #define _XEN_NMIREASON_io_error 0 #define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error) + /* PCI SERR reported via ISA port 0x61, bit 7. */ +#define _XEN_NMIREASON_pci_serr 1 +#define XEN_NMIREASON_pci_serr (1UL << _XEN_NMIREASON_pci_serr) +#if __XEN_INTERFACE_VERSION__ < 0x00040300 /* legacy alias of the above = */ /* Parity error reported via ISA port 0x61, bit 7. */ #define _XEN_NMIREASON_parity_error 1 #define XEN_NMIREASON_parity_error (1UL << _XEN_NMIREASON_parity_error) +#endif /* Unknown hardware-generated NMI. */ #define _XEN_NMIREASON_unknown 2 #define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unknown) --=__Part1021B0BD.1__= Content-Type: text/plain; name="x86-forward-serr.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-forward-serr.patch" x86: restore (optional) forwarding of PCI SERR induced NMI to Dom0=0A=0Ac/s= 22949:54fe1011f86b removed the forwarding of NMIs to Dom0 when they=0Awere= caused by PCI SERR. NMI buttons as well as BMCs (like HP's iLO)=0Amay = however want such events to be seen in Dom0 (e.g. to trigger a=0Adump).=0A= =0ATherefore restore most of the functionality which named c/s removed=0A(a= djusted for subsequent changes, and adjusting the public interface = to=0Ause the modern term, retaining the old one for backwards=0Acompatibili= ty).=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/x86/traps.c=0A+++ b/xen/arch/x86/traps.c=0A@@ -3089,6 +3089,7 = @@ static void nmi_mce_softirq(void)=0A static void pci_serr_softirq(void)= =0A {=0A printk("\n\nNMI - PCI system error (SERR)\n");=0A+ = outb(inb(0x61) & 0x0b, 0x61); /* re-enable the PCI SERR error line. */=0A = }=0A =0A void async_exception_cleanup(struct vcpu *curr)=0A@@ -3135,9 = +3136,20 @@ static void pci_serr_error(struct cpu_us=0A {=0A outb((inb(= 0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. = */=0A =0A- /* Would like to print a diagnostic here but can't call = printk()=0A- from NMI context -- raise a softirq instead. */=0A- = raise_softirq(PCI_SERR_SOFTIRQ);=0A+ switch ( opt_nmi[0] )=0A+ {=0A+ = case 'd': /* 'dom0' */=0A+ nmi_dom0_report(_XEN_NMIREASON_pci_ser= r);=0A+ case 'i': /* 'ignore' */=0A+ /* Would like to print a = diagnostic here but can't call printk()=0A+ from NMI context -- = raise a softirq instead. */=0A+ raise_softirq(PCI_SERR_SOFTIRQ);=0A+= break;=0A+ default: /* 'fatal' */=0A+ console_force_unlo= ck();=0A+ printk("\n\nNMI - PCI system error (SERR)\n");=0A+ = fatal_trap(TRAP_nmi, regs);=0A+ }=0A }=0A =0A static void io_check_error= (struct cpu_user_regs *regs)=0A--- a/xen/include/public/nmi.h=0A+++ = b/xen/include/public/nmi.h=0A@@ -36,9 +36,14 @@=0A /* I/O-check error = reported via ISA port 0x61, bit 6. */=0A #define _XEN_NMIREASON_io_error = 0=0A #define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error)= =0A+ /* PCI SERR reported via ISA port 0x61, bit 7. */=0A+#define = _XEN_NMIREASON_pci_serr 1=0A+#define XEN_NMIREASON_pci_serr (1UL = << _XEN_NMIREASON_pci_serr)=0A+#if __XEN_INTERFACE_VERSION__ < 0x00040300 = /* legacy alias of the above */=0A /* Parity error reported via ISA port = 0x61, bit 7. */=0A #define _XEN_NMIREASON_parity_error 1=0A #define = XEN_NMIREASON_parity_error (1UL << _XEN_NMIREASON_parity_error)=0A+#endif= =0A /* Unknown hardware-generated NMI. */=0A #define _XEN_NMIREASON_unknow= n 2=0A #define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unkn= own)=0A --=__Part1021B0BD.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part1021B0BD.1__=--