mttb in sys/powerpc/include/cpufunc.h still does not handle/protect-against interrupts
Nathan Whitehorn
nwhitehorn at freebsd.org
Tue Apr 20 19:18:30 UTC 2021
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 at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
> To unsubscribe, send any mail to "freebsd-ppc-unsubscribe at freebsd.org"
>
More information about the freebsd-ppc
mailing list