Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Stefan Agner <stefan@agner.ch>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	julien.thierry@arm.com, Will Deacon <will.deacon@arm.com>,
	Russell King <linux@armlinux.org.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/5] ARM: use unified assembler in c files
Date: Mon, 11 Feb 2019 10:17:21 -0800
Message-ID: <CAKwvOdnqOkdD9fFoXmSKZNmceaXcWtdaZ2iwKej3=X-LL0DS9Q@mail.gmail.com> (raw)
In-Reply-To: <db0e6b8f034f832c7e52fe3dd47073ad@agner.ch>

On Sat, Feb 9, 2019 at 9:28 AM Stefan Agner <stefan@agner.ch> wrote:
>
> Thanks for the reviews so far.
>
> During some more testing I stumbled upon another issue:
>
> On 07.02.2019 10:48, Stefan Agner wrote:
> > Use unified assembler syntax (UAL) in inline assembler. Divided
> > syntax is considered depricated. This will also allow to build
> > the kernel using LLVM's integrated assembler.
> >
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
> > ---
> >  arch/arm/mm/copypage-v4mc.c | 2 +-
> >  arch/arm/mm/copypage-v4wb.c | 2 +-
> >  arch/arm/mm/copypage-v4wt.c | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
> > index b03202cddddb..b19c7ad1a6de 100644
> > --- a/arch/arm/mm/copypage-v4mc.c
> > +++ b/arch/arm/mm/copypage-v4mc.c
> > @@ -56,7 +56,7 @@ static void mc_copy_user_page(void *from, void *to)
> >       ldmia   %0!, {r2, r3, ip, lr}           @ 4\n\
> >       subs    %2, %2, #1                      @ 1\n\
> >       stmia   %1!, {r2, r3, ip, lr}           @ 4\n\
> > -     ldmneia %0!, {r2, r3, ip, lr}           @ 4\n\
> > +     ldmiane %0!, {r2, r3, ip, lr}           @ 4\n\
> >       bne     1b                              @ "
> >       : "+&r" (from), "+&r" (to), "=&r" (tmp)
> >       : "2" (PAGE_SIZE / 64)
> > diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c
> > index cd3e165afeed..6e3c9b69dd25 100644
> > --- a/arch/arm/mm/copypage-v4wb.c
> > +++ b/arch/arm/mm/copypage-v4wb.c
> > @@ -38,7 +38,7 @@ static void v4wb_copy_user_page(void *kto, const void *kfrom)
> >       ldmia   %1!, {r3, r4, ip, lr}           @ 4\n\
> >       subs    %2, %2, #1                      @ 1\n\
> >       stmia   %0!, {r3, r4, ip, lr}           @ 4\n\
> > -     ldmneia %1!, {r3, r4, ip, lr}           @ 4\n\
> > +     ldmiane %1!, {r3, r4, ip, lr}           @ 4\n\
> >       bne     1b                              @ 1\n\
> >       mcr     p15, 0, %1, c7, c10, 4          @ 1   drain WB"
> >       : "+&r" (kto), "+&r" (kfrom), "=&r" (tmp)
> > diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c
> > index 8614572e1296..4a40fa1cbc2a 100644
> > --- a/arch/arm/mm/copypage-v4wt.c
> > +++ b/arch/arm/mm/copypage-v4wt.c
> > @@ -34,7 +34,7 @@ static void v4wt_copy_user_page(void *kto, const void *kfrom)
> >       ldmia   %1!, {r3, r4, ip, lr}           @ 4\n\
> >       subs    %2, %2, #1                      @ 1\n\
> >       stmia   %0!, {r3, r4, ip, lr}           @ 4\n\
> > -     ldmneia %1!, {r3, r4, ip, lr}           @ 4\n\
> > +     ldmiane %1!, {r3, r4, ip, lr}           @ 4\n\
> >       bne     1b                              @ 1\n\
> >       mcr     p15, 0, %2, c7, c7, 0           @ flush ID cache"
> >       : "+&r" (kto), "+&r" (kfrom), "=&r" (tmp)
>
> When compiling with gcc, this leads to:
>
> /tmp/ccrvA1wy.s: Assembler messages:
> /tmp/ccrvA1wy.s:180: Error: bad instruction `ldmiane r0!,{r3,r4,ip,lr}'
> make[1]: *** [scripts/Makefile.build:277: arch/arm/mm/copypage-v4wb.o]
> Error 1
> make: *** [Makefile:1042: arch/arm/mm] Error 2
>
> Unfortunately, the gcc option -masm-syntax-unified which allows unified
> syntax in inline assembly is broken (see also
> https://lkml.org/lkml/2019/1/7/1320).
>
> So this requires to sprinkle those inline assembly with ".syntax
> unified" strings, similar to how I've done it in uaccess.h.

Not sure if this is purely a bug in GCC; Clang treats inline asm
statements as unique, so asm directives do not carry over from one
inline asm statement to another.  This has caused issues in other
arch's inline assembly, where we need to repeat asm directives
repeatedly for each inline asm statement.
https://bugs.llvm.org/show_bug.cgi?id=19749

-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07  9:48 [PATCH 0/5] ARM: convert to unified syntax Stefan Agner
2019-02-07  9:48 ` [PATCH 1/5] ARM: use unified assembler in macros Stefan Agner
2019-02-07 13:34   ` Ard Biesheuvel
2019-02-07 15:52   ` Nicolas Pitre
2019-02-07  9:48 ` [PATCH 2/5] ARM: use unified assembler in headers Stefan Agner
2019-02-07 16:10   ` Nicolas Pitre
2019-02-09 22:54     ` Stefan Agner
2019-02-07  9:48 ` [PATCH 3/5] ARM: use unified assembler in assembly files Stefan Agner
2019-02-07  9:48 ` [PATCH 4/5] ARM: use unified assembler in c files Stefan Agner
2019-02-09 17:28   ` Stefan Agner
2019-02-11 18:17     ` Nick Desaulniers [this message]
2019-02-12 19:26       ` Stefan Agner
2019-02-07  9:48 ` [PATCH 5/5] ARM: warn if divided syntax assembler is used Stefan Agner
2019-02-07 20:52   ` Nick Desaulniers

Reply instructions:

You may reply publically 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='CAKwvOdnqOkdD9fFoXmSKZNmceaXcWtdaZ2iwKej3=X-LL0DS9Q@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=julien.thierry@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=natechancellor@gmail.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=stefan@agner.ch \
    --cc=thierry.reding@gmail.com \
    --cc=will.deacon@arm.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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git