From: Mark Rutland <mark.rutland@arm.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>, 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, 23 Apr 2019 15:12:40 +0100 [thread overview]
Message-ID: <20190423141240.GC56999@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <CAKwvOdn-MGokV0vsGq2GdRK-eGHdyC6+vVHYSfwOfpqNWwQzXw@mail.gmail.com>
On Mon, Apr 22, 2019 at 10:44:10AM -0700, Nick Desaulniers wrote:
> On Tue, Apr 16, 2019 at 9:03 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Tue, Apr 16, 2019 at 12:08 PM Mark Rutland <mark.rutland@arm.com> wrote:
> > >
> > > 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:
> > > > > It would be nice if we could simply rely on a more recent binutils these
> > > > > days, which supports the generic S<op0>_<op1>_<cn>_<Cm>_<op2> sysreg
> > > > > definition. That would mean we could get rid of the whole msr_s/mrs_s
> > > > > hack by turning that into a CPP macro which built that name.
>
> Mark, can you give me a test case for this? I'd like to check if
> clang's integrated assembler supports this or not, so we can file an
> issue and fix it if not.
The below is a smoke test. The entire op0:op1:cn:cm:op2 space is 14
bits, so it should be feasible to generate and run an exhautive test for
all encodings.
I've included SYS and SYSL here too, since I strongly suspect we'll need
those going forward.
Thanks
Mark.
---->8----
/*
* ${CC} -c test.c
*
* OLD_* encodings already exist, NEW_* encodings haven't yet be
* allocated (per ARM DDI 0487D.a), but should assemble. All encodings
* chosen arbitrarily.
*/
// OSDTRRX_EL1
#define OLD_DBG_REG "s2_0_c0_c0_2"
#define NEW_DBG_REG "s2_7_c0_c15_0"
// MIDR_EL1
#define OLD_SYS_REG "s3_0_c0_c0_0"
#define NEW_SYS_REG "s3_6_c1_c0_7"
#define REG(r) \
asm volatile("msr " r ", xzr\n"); \
asm volatile("mrs xzr, " r "\n")
// DC IVAC, XZR
#define OLD_SYS "#0, c7, c6, #1"
#define NEW_SYS "#7, c15, c15, #7"
#define NEW_SYSL_MIN "#0, c0, c0, #0"
#define NEW_SYSL_MAX "#7, c15, c15, #7"
#define SYS(s) asm volatile("sys " s ", xzr\n")
#define SYSL(s) asm volatile("sysl xzr, " s "\n")
void test(void)
{
REG(OLD_DBG_REG);
REG(NEW_DBG_REG);
REG(OLD_SYS_REG);
REG(NEW_SYS_REG);
SYS(OLD_SYS);
SYS(NEW_SYS);
SYSL(NEW_SYSL_MIN);
SYSL(NEW_SYSL_MAX);
}
next prev parent reply other threads:[~2019-04-23 14:12 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 [this message]
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
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=20190423141240.GC56999@lakrids.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=alxmtvv@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--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®