Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Apr 2021 12:07:01 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Brandon Bergren <bdragon@FreeBSD.org>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   mttb in sys/powerpc/include/cpufunc.h still does not handle/protect-against interrupts
Message-ID:  <3498B555-6C88-4DF4-8291-14E8B9120D4B@yahoo.com>
References:  <3498B555-6C88-4DF4-8291-14E8B9120D4B.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3498B555-6C88-4DF4-8291-14E8B9120D4B>