Defer _spl0() or _splnone() calls (which enable hardware interrupts)

from cpu_configure(9) to cpu_initclocks(9) on mips ports which use
mips3_clockintr.c:mips3_clockintr() (i.e. CPU INT5 clock) to avoid
hardclock(9) before softclock interrupt is initialized in initclocks().
This should be harmless because initclocks() is a part of configure()
in these days and there is no MI function which expects hardware
interrupts between cpu_configure(9) and cpu_initclocks(9).

Disccussed on tech-kern and port-mips.
This commit is contained in:
tsutsui 2006-11-17 21:01:03 +00:00
parent 8bf1f71b17
commit 44e83481b7
8 changed files with 77 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.14 2006/05/05 18:04:41 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.15 2006/11/17 21:01:03 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.14 2006/05/05 18:04:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2006/11/17 21:01:03 tsutsui Exp $");
#include "opt_algor_p4032.h"
#include "opt_algor_p5064.h"
@ -71,7 +71,13 @@ cpu_configure(void)
(void) splhigh();
if (config_rootfound("mainbus", NULL) == 0)
panic("no mainbus found");
(void) spl0();
/*
* Hardware interrupts will be enabled in
* sys/arch/mips/mips/mips3_clockintr.c:mips3_initclocks()
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.23 2006/09/10 06:41:09 tsutsui Exp $ */
/* $NetBSD: autoconf.c,v 1.24 2006/11/17 21:01:03 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2006/09/10 06:41:09 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.24 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -55,8 +55,12 @@ cpu_configure(void)
if (config_rootfound("mainbus", NULL) == NULL)
panic("no mainbus found");
/* enable all interrupts */
_splnone();
/*
* Hardware interrupts will be enabled in
* sys/arch/mips/mips/mips3_clockintr.c:mips3_initclocks()
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.12 2006/05/05 18:04:41 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.13 2006/11/17 21:01:03 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.12 2006/05/05 18:04:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.13 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -67,7 +67,13 @@ cpu_configure(void)
(void)splhigh();
if (config_rootfound("mainbus", NULL) == NULL)
panic("no mainbus found");
(void)spl0();
/*
* Hardware interrupts will be enabled in
* sys/arch/mips/mips/mips3_clockintr.c:mips3_initclocks()
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.6 2006/09/04 05:17:26 gdamore Exp $ */
/* $NetBSD: autoconf.c,v 1.7 2006/11/17 21:01:03 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.6 2006/09/04 05:17:26 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.7 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -61,7 +61,13 @@ cpu_configure(void)
(void)splhigh();
if (config_rootfound("mainbus", NULL) == NULL)
panic("no mainbus found");
(void)spl0();
/*
* Hardware interrupts will be enabled in
* sys/arch/mips/mips/mips3_clockintr.c:mips3_initclocks()
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.9 2006/02/26 05:24:52 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.10 2006/11/17 21:01:03 tsutsui Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2006/02/26 05:24:52 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -58,7 +58,13 @@ cpu_configure()
(void)splhigh();
if (config_rootfound("mainbus", NULL) == NULL)
panic("no mainbus found");
(void)spl0();
/*
* Hardware interrupts will be enabled in
* sys/arch/mips/mips/mips3_clockintr.c:mips3_initclocks()
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips3_clockintr.c,v 1.2 2006/09/10 14:27:38 tsutsui Exp $ */
/* $NetBSD: mips3_clockintr.c,v 1.3 2006/11/17 21:01:03 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mips3_clockintr.c,v 1.2 2006/09/10 14:27:38 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mips3_clockintr.c,v 1.3 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -144,6 +144,12 @@ mips3_initclocks(void)
#ifdef __HAVE_TIMECOUNTER
mips3_init_tc();
#endif
/*
* Now we can enable all interrupts including hardclock(9)
* by CPU INT5.
*/
_splnone();
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.31 2006/07/10 16:28:44 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.32 2006/11/17 21:01:03 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.31 2006/07/10 16:28:44 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.32 2006/11/17 21:01:03 tsutsui Exp $");
#include "opt_ddb.h"
@ -81,7 +81,11 @@ cpu_configure()
splmasks[IPL_BIO] >> 8, splmasks[IPL_NET] >> 8,
splmasks[IPL_TTY] >> 8, splmasks[IPL_CLOCK] >> 8);
_splnone();
/*
* Hardware interrupts will be enabled in cpu_initclocks(9)
* to avoid hardclock(9) by CPU INT5 before softclockintr is
* initialized in initclocks().
*/
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.18 2006/09/16 08:50:27 gdamore Exp $ */
/* $NetBSD: clock.c,v 1.19 2006/11/17 21:01:03 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.18 2006/09/16 08:50:27 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.19 2006/11/17 21:01:03 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -125,11 +125,25 @@ void
cpu_initclocks()
{
switch (mach_type) {
#if defined(MIPS1)
case MACH_SGI_IP12:
/* enable hardware interrupts including hardclock(9) */
_splnone();
break;
#endif /* MIPS1 */
#if defined(MIPS3)
if (mach_type != MACH_SGI_IP12) {
case MACH_SGI_IP20:
case MACH_SGI_IP22:
case MACH_SGI_IP30:
case MACH_SGI_IP32:
mips3_initclocks();
}
break;
#endif /* MIPS3 */
default:
panic("cpu_initclocks(): unknown mach_type IP%d", mach_type);
break;
}
}
void