From owner-p4-projects@FreeBSD.ORG Thu Jun 16 19:41:19 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0096516A421; Thu, 16 Jun 2005 19:41:18 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8E2F16A41C for ; Thu, 16 Jun 2005 19:41:18 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A195B43D58 for ; Thu, 16 Jun 2005 19:41:18 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j5GJfIUI045846 for ; Thu, 16 Jun 2005 19:41:18 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j5GJfIus045843 for perforce@freebsd.org; Thu, 16 Jun 2005 19:41:18 GMT (envelope-from jhb@freebsd.org) Date: Thu, 16 Jun 2005 19:41:18 GMT Message-Id: <200506161941.j5GJfIus045843@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 78646 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2005 19:41:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=78646 Change 78646 by jhb@jhb_slimer on 2005/06/16 19:41:15 The current method of turning the local APIC off and then back on is confirmed to work ok, so remove this alternative fix that left the APIC on but registered a handler for the spurious APIC interrupts that can be triggered by the Errata in question. Affected files ... .. //depot/projects/smpng/sys/i386/i386/apic_vector.s#14 edit .. //depot/projects/smpng/sys/i386/i386/exception.s#23 edit .. //depot/projects/smpng/sys/i386/i386/initcpu.c#24 edit .. //depot/projects/smpng/sys/i386/i386/local_apic.c#30 edit .. //depot/projects/smpng/sys/i386/i386/machdep.c#94 edit Differences ... ==== //depot/projects/smpng/sys/i386/i386/apic_vector.s#14 (text+ko) ==== @@ -107,8 +107,6 @@ iret -#ifdef DEV_APIC - ISR_VEC(1, apic_isr1) ISR_VEC(2, apic_isr2) ISR_VEC(3, apic_isr3) @@ -383,4 +381,3 @@ POP_FRAME iret #endif /* SMP */ -#endif /* DEV_APIC */ ==== //depot/projects/smpng/sys/i386/i386/exception.s#23 (text+ko) ==== @@ -234,12 +234,14 @@ #include +#ifdef DEV_APIC .data .p2align 4 .text SUPERALIGN_TEXT #include +#endif .data .p2align 4 ==== //depot/projects/smpng/sys/i386/i386/initcpu.c#24 (text+ko) ==== @@ -68,6 +68,7 @@ #ifdef I686_CPU static void init_6x86MX(void); +static void init_ppro(void); static void init_mendocino(void); #endif @@ -471,6 +472,19 @@ write_eflags(eflags); } +static void +init_ppro(void) +{ + u_int64_t apicbase; + + /* + * Local APIC should be disabled if it is not going to be used. + */ + apicbase = rdmsr(MSR_APICBASE); + apicbase &= ~APICBASE_ENABLED; + wrmsr(MSR_APICBASE, apicbase); +} + /* * Initialize BBL_CR_CTL3 (Control register 3: used to configure the * L2 cache). @@ -561,6 +575,9 @@ case CPU_686: if (strcmp(cpu_vendor, "GenuineIntel") == 0) { switch (cpu_id & 0xff0) { + case 0x610: + init_ppro(); + break; case 0x660: init_mendocino(); break; ==== //depot/projects/smpng/sys/i386/i386/local_apic.c#30 (text+ko) ==== @@ -747,6 +747,7 @@ apic_init(void *dummy __unused) { struct apic_enumerator *enumerator; + uint64_t apic_base; int retval, best; /* We only support built in local APICs. */ @@ -779,6 +780,18 @@ printf("APIC: Using the %s enumerator.\n", best_enum->apic_name); + /* + * To work around an errata, we disable the local APIC on some + * CPUs during early startup. We need to turn the local APIC back + * on on such CPUs now. + */ + if (cpu == CPU_686 && strcmp(cpu_vendor, "GenuineIntel") == 0 && + (cpu_id & 0xff0) == 0x610) { + apic_base = rdmsr(MSR_APICBASE); + apic_base |= APICBASE_ENABLED; + wrmsr(MSR_APICBASE, apic_base); + } + /* Second, probe the CPU's in the system. */ retval = best_enum->apic_probe_cpus(); if (retval != 0) ==== //depot/projects/smpng/sys/i386/i386/machdep.c#94 (text+ko) ==== @@ -112,7 +112,6 @@ #include #include #include -#include #include #include #include @@ -2141,13 +2140,6 @@ setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); - /* - * Workaround for PentiumPro Errata 5AP: Spurious interrupts routed - * to int15 in APIC virtual wire mode. - */ - setidt(15, &IDTVEC(spuriousint), SDT_SYS386IGT, SEL_KPL, - GSEL(GCODE_SEL, SEL_KPL)); - r_idt.rd_limit = sizeof(idt0) - 1; r_idt.rd_base = (int) idt; lidt(&r_idt);