mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Kees Cook <keescook@chromium.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Alex Matveev <alxmtvv@gmail.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Yury Norov <ynorov@caviumnetworks.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] arm64: sysreg: make mrs_s and msr_s macros work with Clang and LTO
Date: Tue, 16 Apr 2019 18:18:30 +0100	[thread overview]
Message-ID: <20190416171829.GD54708@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <CAKwvOdk_jFQKW2C2=925So_dvZ6dm03AXMZ9Nk+O1J2xyhE2EA@mail.gmail.com>

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@arm.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.

  parent reply	other threads:[~2019-04-16 17:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 14:38 Kees Cook
2019-04-15 17:06 ` Mark Rutland
2019-04-15 17:22   ` Nick Desaulniers
2019-04-16 17:08     ` Mark Rutland
2019-04-16 17:34       ` Nick Desaulniers
2019-04-17  4:02       ` Kees Cook
2019-04-22 17:44         ` Nick Desaulniers
2019-04-23 14:12           ` Mark Rutland
2019-04-23 18:15             ` Nick Desaulniers
2019-04-23 18:24               ` Kees Cook
2019-04-23 18:39                 ` Arnd Bergmann
2019-04-16 17:18     ` Mark Rutland [this message]
2019-04-23 22:55 ` Kees Cook
2019-04-23 22:57   ` Ard Biesheuvel
2019-04-23 22:59     ` Nick Desaulniers
2019-04-23 23:09       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416171829.GD54708@lakrids.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=alxmtvv@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=ndesaulniers@google.com \
    --cc=samitolvanen@google.com \
    --cc=will.deacon@arm.com \
    --cc=ynorov@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®