Module Name: src Committed By: tsutsui Date: Wed Aug 30 17:10:17 UTC 2023
Modified Files: src/sys/arch/arc/arc: autoconf.c interrupt.c timer.c timervar.h Log Message: Remove ENABLE_INT5_STATCLOCK broken since matt-nb5-mips64 merge. Noticed by andvar@. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arc/arc/autoconf.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arc/arc/interrupt.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arc/arc/timer.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arc/arc/timervar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arc/arc/autoconf.c diff -u src/sys/arch/arc/arc/autoconf.c:1.35 src/sys/arch/arc/arc/autoconf.c:1.36 --- src/sys/arch/arc/arc/autoconf.c:1.35 Sat Oct 27 17:17:35 2012 +++ src/sys/arch/arc/arc/autoconf.c Wed Aug 30 17:10:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.35 2012/10/27 17:17:35 chs Exp $ */ +/* $NetBSD: autoconf.c,v 1.36 2023/08/30 17:10:17 tsutsui Exp $ */ /* $OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $ */ /* @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.35 2012/10/27 17:17:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.36 2023/08/30 17:10:17 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -131,28 +131,14 @@ void cpu_configure(void) { -#ifdef ENABLE_INT5_STATCLOCK - evcnt_attach_static(&statclock_ev); -#endif - (void)splhigh(); /* To be really sure.. */ if (config_rootfound("mainbus", NULL) == NULL) panic("no mainbus found"); /* Configuration is finished, turn on interrupts. */ -#ifdef ENABLE_INT5_STATCLOCK - /* - * Enable interrupt sources. - * We can't enable CPU INT5 which is used by statclock(9) here - * until cpu_initclocks(9) is called because there is no way - * to disable it other than setting status register by spl(9). - */ - _spllower(MIPS_INT_MASK_5); -#error need fix -#else + /* enable all source forcing SOFT_INTs cleared */ spl0(); -#endif } #if defined(NFS_BOOT_BOOTP) || defined(NFS_BOOT_DHCP) Index: src/sys/arch/arc/arc/interrupt.c diff -u src/sys/arch/arc/arc/interrupt.c:1.9 src/sys/arch/arc/arc/interrupt.c:1.10 --- src/sys/arch/arc/arc/interrupt.c:1.9 Wed Mar 2 10:51:04 2011 +++ src/sys/arch/arc/arc/interrupt.c Wed Aug 30 17:10:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.9 2011/03/02 10:51:04 tsutsui Exp $ */ +/* $NetBSD: interrupt.c,v 1.10 2023/08/30 17:10:17 tsutsui Exp $ */ /* $OpenBSD: trap.c,v 1.22 1999/05/24 23:08:59 jason Exp $ */ /* @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.9 2011/03/02 10:51:04 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2023/08/30 17:10:17 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -65,11 +65,6 @@ static struct cpu_inttab cpu_int_tab[ARC uint32_t cpu_int_mask; /* External cpu interrupt mask */ -#ifdef ENABLE_INT5_STATCLOCK -struct evcnt statclock_ev = - EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "cpu", "statclock"); -#endif - /* * Set up handler for external interrupt events. * Events are checked in priority order. @@ -114,17 +109,11 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s while (ppl < (ipl = splintr(&ipending))) { /* check MIPS3 internal clock interrupt */ if (ipending & MIPS_INT_MASK_5) { -#ifdef ENABLE_INT5_STATCLOCK - /* call statclock(9) handler */ - statclockintr(&cf); - statclock_ev.ev_count++; -#else /* * Writing a value to the Compare register, as a side * effect, clears the timer interrupt request. */ mips3_cp0_compare_write(0); -#endif } /* Index: src/sys/arch/arc/arc/timer.c diff -u src/sys/arch/arc/arc/timer.c:1.11 src/sys/arch/arc/arc/timer.c:1.12 --- src/sys/arch/arc/arc/timer.c:1.11 Sat Oct 27 17:17:35 2012 +++ src/sys/arch/arc/arc/timer.c Wed Aug 30 17:10:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.c,v 1.11 2012/10/27 17:17:35 chs Exp $ */ +/* $NetBSD: timer.c,v 1.12 2023/08/30 17:10:17 tsutsui Exp $ */ /* NetBSD: clock.c,v 1.31 2001/05/27 13:53:24 sommerfeld Exp */ /* @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.11 2012/10/27 17:17:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.12 2023/08/30 17:10:17 tsutsui Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -56,22 +56,6 @@ const struct timerfns *timerfns; int timerinitted; uint32_t last_cp0_count; -#ifdef ENABLE_INT5_STATCLOCK -/* - * Statistics clock variance, in usec. Variance must be a - * power of two. Since this gives us an even number, not an odd number, - * we discard one case and compensate. That is, a variance of 1024 would - * give us offsets in [0..1023]. Instead, we take offsets in [1..1023]. - * This is symmetric about the point 512, or statvar/2, and thus averages - * to that value (assuming uniform random numbers). - */ -static const uint32_t statvar = 1024; -static uint32_t statint; /* number of clock ticks for stathz */ -static uint32_t statmin; /* minimum stat clock count in ticks */ -static uint32_t statprev;/* last value of we set statclock to */ -static u_int statcountperusec; /* number of ticks per usec at current stathz */ -#endif - void timerattach(device_t dev, const struct timerfns *fns) { @@ -98,16 +82,6 @@ void cpu_initclocks(void) { -#ifdef ENABLE_INT5_STATCLOCK - if (stathz == 0) - stathz = hz; - - if (profhz == 0) - profhz = hz * 5; - - setstatclockrate(stathz); -#endif - if (timerfns == NULL) panic("cpu_initclocks: no timer attached"); @@ -118,74 +92,15 @@ cpu_initclocks(void) /* init timecounter */ mips3_init_tc(); - -#ifdef ENABLE_INT5_STATCLOCK - /* enable interrupts including CPU INT 5 */ - _splnone(); -#endif } /* - * We assume newhz is either stathz or profhz, and that neither will - * change after being set up above. Could recalculate intervals here - * but that would be a drag. + * This does not need to do anything, as we don't use a timer for statclock + * and profhz == stathz == hz. */ void setstatclockrate(int newhz) { -#ifdef ENABLE_INT5_STATCLOCK - uint32_t countpersecond, statvarticks; - - statprev = mips3_cp0_count_read(); - - statint = ((curcpu()->ci_cpu_freq + newhz / 2) / newhz) / 2; - - /* Get the total ticks a second */ - countpersecond = statint * newhz; - - /* now work out how many ticks per usec */ - statcountperusec = countpersecond / 1000000; - - /* calculate a variance range of statvar */ - statvarticks = statcountperusec * statvar; - - /* minimum is statint - 50% of variant */ - statmin = statint - (statvarticks / 2); - - mips3_cp0_compare_write(statprev + statint); -#endif -} - -#ifdef ENABLE_INT5_STATCLOCK -void -statclockintr(struct clockframe *cfp) -{ - uint32_t curcount, statnext, delta, r; - int lost; - - lost = 0; - - do { - r = (uint32_t)random() & (statvar - 1); - } while (r == 0); - statnext = statprev + statmin + (r * statcountperusec); - - mips3_cp0_compare_write(statnext); - curcount = mips3_cp0_count_read(); - delta = statnext - curcount; - - while (__predict_false((int32_t)delta < 0)) { - lost++; - delta += statint; - } - if (__predict_false(lost > 0)) { - statnext = curcount + delta; - mips3_cp0_compare_write(statnext); - for (; lost > 0; lost--) - statclock(cfp); - } - statclock(cfp); - statprev = statnext; + /* nothing to do */ } -#endif Index: src/sys/arch/arc/arc/timervar.h diff -u src/sys/arch/arc/arc/timervar.h:1.7 src/sys/arch/arc/arc/timervar.h:1.8 --- src/sys/arch/arc/arc/timervar.h:1.7 Sat Oct 27 17:17:35 2012 +++ src/sys/arch/arc/arc/timervar.h Wed Aug 30 17:10:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: timervar.h,v 1.7 2012/10/27 17:17:35 chs Exp $ */ +/* $NetBSD: timervar.h,v 1.8 2023/08/30 17:10:17 tsutsui Exp $ */ /* NetBSD: clockvar.h,v 1.4 1997/06/22 08:02:18 jonathan Exp */ /* @@ -41,8 +41,3 @@ struct timerfns { extern uint32_t last_cp0_count; void timerattach(device_t, const struct timerfns *); - -#ifdef ENABLE_INT5_STATCLOCK -extern struct evcnt statclock_ev; -void statclockintr(struct clockframe *); -#endif