[PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console
Segher Boessenkool
segher at kernel.crashing.org
Fri Aug 13 02:09:44 AEST 2021
On Thu, Aug 12, 2021 at 03:14:44PM +0200, Christophe Leroy wrote:
> Le 18/06/2021 à 05:46, Paul Mackerras a écrit :
> >+static u8 udbg_uart_in_isa300_rm(unsigned int reg)
> >+{
> >+ uint64_t msr = mfmsr();
> >+ uint8_t c;
> >+
> >+ mtmsr(msr & ~(MSR_EE|MSR_DR));
> >+ isync();
> >+ eieio();
> >+ c = __raw_rm_readb(UDBG_UART_MW_ADDR + (reg << 2));
> >+ mtmsr(msr);
> >+ isync();
> >+ return c;
> >+}
>
> How do you make sure that GCC won't emit any access to the stack between
> the two mtmsr() ?
The mtmsr are asm with a memory clobber so nothing will be moved between
these, and it is very unlikely anything will sprout up here out of
nothing. But yes, this whole thing should be written as real asm (or as
one huge inline asm, but ugh).
Segher
More information about the Linuxppc-dev
mailing list