From owner-freebsd-smp Tue May 30 9:17:27 2000 Delivered-To: freebsd-smp@freebsd.org Received: from midten.fast.no (midten.fast.no [213.188.8.11]) by hub.freebsd.org (Postfix) with ESMTP id 2968737B6E1; Tue, 30 May 2000 09:17:17 -0700 (PDT) (envelope-from tegge@fast.no) Received: from fast.no (IDENT:tegge@midten.fast.no [213.188.8.11]) by midten.fast.no (8.9.3/8.9.3) with ESMTP id SAA28422; Tue, 30 May 2000 18:17:13 +0200 (CEST) Message-Id: <200005301617.SAA28422@midten.fast.no> To: msmith@FreeBSD.ORG Cc: drew@Poohsticks.Org, freebsd-smp@FreeBSD.ORG, Arne.Juul@fast.no Subject: Re: T_RESERVED prevention kludge From: Tor.Egge@fast.no In-Reply-To: Your message of "Wed, 10 May 2000 18:15:57 -0700" References: <200005110115.SAA01727@mass.cdrom.com> X-Mailer: Mew version 1.70 on Emacs 19.34.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_May_30_18:16:01_2000)--" Content-Transfer-Encoding: 7bit Date: Tue, 30 May 2000 18:17:12 +0200 Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org ----Next_Part(Tue_May_30_18:16:01_2000)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > I've committed this to -current, and will do so to -stable in a day or so. > > I'm also now happily trolling along here with this patch on a Dell > PowerEdge 2450 loaned to us by Dell; if someone wants to play detective > and needs access to the box, let me know - they don't want it back for > another couple of weeks yet. Further experimentation showed that some Dell 2450 machines with the prevention kludge installed still got T_RESERVED traps. CPU interrupt vector 0x7A was observed to be triggered. This might have been the bitwise OR of two different vectors sent from each of the IOAPICs at the same time. IOAPIC #0: 0x68 --> irq 8: RTC timer interrupt IOAPIC #1: 0x32 --> irq 18: scsi host adapter or network interface ---- 0x7a --> T_RESERVED Both IOAPICs had ID 0. Appendix B.3 in the MP spec indicates that the operating system is responsible for assigning unique IDs to the IOAPICs. The enclosed patch programs the IOAPIC IDs according to the IOAPIC entries in the MP table. - Tor Egge ----Next_Part(Tue_May_30_18:16:01_2000)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: "IOAPIC id patch" Index: sys/i386/include/smp.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/smp.h,v retrieving revision 1.51 diff -u -r1.51 smp.h --- sys/i386/include/smp.h 2000/03/28 18:06:38 1.51 +++ sys/i386/include/smp.h 2000/05/30 15:31:52 @@ -165,6 +165,7 @@ int apic_ipi __P((int, int, int)); int selected_apic_ipi __P((u_int, int, int)); int io_apic_setup __P((int)); +void io_apic_set_id __P((int, int)); int ext_int_setup __P((int, int)); #if defined(READY) Index: sys/i386/i386/mp_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/mp_machdep.c,v retrieving revision 1.116 diff -u -r1.116 mp_machdep.c --- sys/i386/i386/mp_machdep.c 2000/03/28 07:16:15 1.116 +++ sys/i386/i386/mp_machdep.c 2000/05/30 15:27:34 @@ -572,6 +581,7 @@ for (apic = 0; apic < mp_napics; ++apic) { ux = io_apic_read(apic, IOAPIC_VER); io_apic_versions[apic] = ux; + io_apic_set_id(apic, IO_TO_ID(apic)); } /* program each IO APIC in the system */ @@ -1661,13 +1671,7 @@ #else if ((io_apic_id == 0) || (io_apic_id == 1) || (io_apic_id == 15)) { #endif /* REALLY_ANAL_IOAPICID_VALUE */ - ux = io_apic_read(0, IOAPIC_ID); /* get current contents */ - ux &= ~APIC_ID_MASK; /* clear the ID field */ - ux |= 0x02000000; /* set it to '2' */ - io_apic_write(0, IOAPIC_ID, ux); /* write new value */ - ux = io_apic_read(0, IOAPIC_ID); /* re-read && test */ - if ((ux & APIC_ID_MASK) != 0x02000000) - panic("can't control IO APIC ID, reg: 0x%08x", ux); + io_apic_set_id(0, 2); io_apic_id = 2; } IO_TO_ID(0) = io_apic_id; Index: sys/i386/i386/mpapic.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/mpapic.c,v retrieving revision 1.38 diff -u -r1.38 mpapic.c --- sys/i386/i386/mpapic.c 2000/05/11 01:12:46 1.38 +++ sys/i386/i386/mpapic.c 2000/05/30 15:44:14 @@ -142,6 +145,24 @@ IOART_INTAHI | \ IOART_DESTPHY | \ IOART_DELLOPRI)) + +void +io_apic_set_id(int apic, int id) +{ + u_int32_t ux; + + ux = io_apic_read(apic, IOAPIC_ID); /* get current contents */ + if (((ux & APIC_ID_MASK) >> 24) != id) { + ux &= ~APIC_ID_MASK; /* clear the ID field */ + ux |= (id << 24); + io_apic_write(apic, IOAPIC_ID, ux); /* write new value */ + ux = io_apic_read(apic, IOAPIC_ID); /* re-read && test */ + if (((ux & APIC_ID_MASK) >> 24) != id) + panic("can't control IO APIC #%d ID, reg: 0x%08x", + apic, ux); + } +} + /* * Setup the IO APIC. ----Next_Part(Tue_May_30_18:16:01_2000)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message