Date: Tue, 20 Apr 2021 15:18:29 -0400 From: Nathan Whitehorn <nwhitehorn@freebsd.org> To: freebsd-ppc@freebsd.org Subject: Re: mttb in sys/powerpc/include/cpufunc.h still does not handle/protect-against interrupts Message-ID: <e7eb2062-e2f1-cde3-a47d-269172e8e83d@freebsd.org> In-Reply-To: <3498B555-6C88-4DF4-8291-14E8B9120D4B@yahoo.com>
index | next in thread | previous in thread | raw e-mail
We don't call mttb() in any circumstance in which interrupts are enabled
(only in early-boot and suspend/resume contexts, and even then only on
some hardware), so there is no need to disable them.
-Nathan
On 4/20/21 3:07 PM, Mark Millard via freebsd-ppc wrote:
> Looking at sys/powerpc/include/cpufunc.h in main (and so older too):
>
> static __inline void
> mttb(u_quad_t time)
> {
>
> mtspr(TBR_TBWL, 0);
> mtspr(TBR_TBWU, (uint32_t)(time >> 32));
> mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff));
> }
>
> This code still does not protect against interrupts
> (only suggestive):
>
> mtspr(TBR_TBWL, 0);
> HERE?
> mtspr(TBR_TBWU, (uint32_t)(time >> 32));
> HERE?
> mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff));
>
>
> My code disabled interrupts around the update:
>
> static __inline void
> mttb(u_quad_t time)
> {
> const uint32_t high= time>>32;
> const uint32_t low= time&0xffffffffu;
>
> const register_t predisable_msr= intr_disable();
> mtspr(TBR_TBWL, 0);
> mtspr(TBR_TBWU, high);
> mtspr(TBR_TBWL, low);
> intr_restore(predisable_msr);
> }
>
> As I remember, I found powerpc documentation that indicated
> such was important to reliable settings.
>
>
> ===
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
>
> _______________________________________________
> freebsd-ppc@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
> To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@freebsd.org"
>
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e7eb2062-e2f1-cde3-a47d-269172e8e83d>
