[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190416171829.GD54708@lakrids.cambridge.arm.com>
Date: Tue, 16 Apr 2019 18:18:30 +0100
From: Mark Rutland <mark.rutland@....com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Alex Matveev <alxmtvv@...il.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Yury Norov <ynorov@...iumnetworks.com>,
Matthias Kaehlcke <mka@...omium.org>,
Sami Tolvanen <samitolvanen@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] arm64: sysreg: make mrs_s and msr_s macros work with
Clang and LTO
On Mon, Apr 15, 2019 at 10:22:27AM -0700, Nick Desaulniers wrote:
> On Mon, Apr 15, 2019 at 10:06 AM Mark Rutland <mark.rutland@....com> wrote:
> > On Mon, Apr 15, 2019 at 07:38:21AM -0700, Kees Cook wrote:
> > > diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
> > > index 43d8366c1e87..06d3987d1546 100644
> > > --- a/arch/arm64/include/asm/irqflags.h
> > > +++ b/arch/arm64/include/asm/irqflags.h
> > > @@ -43,7 +43,9 @@ static inline void arch_local_irq_enable(void)
> > > asm volatile(ALTERNATIVE(
> > > "msr daifclr, #2 // arch_local_irq_enable\n"
> > > "nop",
> > > + DEFINE_MSR_S
> > > "msr_s " __stringify(SYS_ICC_PMR_EL1) ",%0\n"
> > > + UNDEFINE_MSR_S
> >
> > If we do need this, can we wrap this in a larger CPP macro that does the
> > whole sequence of defining, using, and undefining the asm macros?
>
> I agree that would be cleaner. For example, __mrs_s/__msr_s can
> ALMOST do this (be used in arch/arm64/include/asm/irqflags.h) except
> for the input/output constraints. Maybe the constraints can be
> removed from the cpp macro definition, then the constraints be left to
> the macro expansion sites? That way the DEFINE_MXX_S/UNDEFINE_MXX_S
> can be hidden in the cpp macro itself.
If those took the register template explicitly, i.e. something like:
__mrs_s(SYS_ICC_PMR_EL1, "%x0")
__msr_s("%[whatever]", SYS_FOO)
... that would be more generally useful and clear, as they could be used
in larger asm sequences.
Thanks,
Mark.
Powered by blists - more mailing lists