Re: mttb in sys/powerpc/include/cpufunc.h still does not handle/protect-against interrupts

Nathan Whitehorn <[email protected]>
Newsgroups gmane.os.freebsd.devel.ppc
Message-ID <[email protected]>
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)
>
> _______________________________________________
> [email protected] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
> To unsubscribe, send any mail to "[email protected]"
>

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.