From: cheloha Date: Tue, 22 Aug 2023 17:13:22 +0000 (+0000) Subject: i386: i8254_initclocks: set IPL_MPSAFE for clock/rtc IRQs X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9cd62917ab6617d55cfc87af69b835e445674ccd;p=openbsd i386: i8254_initclocks: set IPL_MPSAFE for clock/rtc IRQs Setting IPL_MPSAFE for the i8254/mc146818 IRQs appeases a KASSERT in apic_intr_establish() and allows the system to boot via the i8254 path. This makes testing changes to the i8254/mc146818 code much easier on modern hardware without mucking with the GENERIC config. We already set IPL_MPSAFE for these IRQs in the equivalent amd64 code. Now, setting IPL_MPSAFE is a lie: the i8254 and mc146818 IRQs are not MP-safe. However, the lie is harmless because we only reach i8254_initclocks() if (a) there is no APIC at all, or (b) we fail to calibrate the local APIC timer. Thread: https://marc.info/?l=openbsd-tech&m=169258915227321&w=2 ok mlarkin@ --- diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 48d96756ab3..563feaabf99 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.65 2023/07/25 18:16:20 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.66 2023/08/22 17:13:22 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ /*- @@ -430,10 +430,16 @@ i8254_initclocks(void) clockintr_cpu_init(NULL); - /* When using i8254 for clock, we also use the rtc for profclock */ - (void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK, + /* + * When using i8254 for clock, we also use the rtc for profclock. + * + * These IRQs are not MP-safe, but it is harmless to lie about it + * because we cannot reach this point unless we are only booting + * a single CPU. + */ + (void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK | IPL_MPSAFE, clockintr, 0, "clock"); - (void)isa_intr_establish(NULL, 8, IST_PULSE, IPL_STATCLOCK, + (void)isa_intr_establish(NULL, 8, IST_PULSE, IPL_STATCLOCK | IPL_MPSAFE, rtcintr, 0, "rtc"); rtcstart(); /* start the mc146818 clock */