linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Olof Johansson <olof@lixom.net>
Cc: "behanw@converseincode.com" <behanw@converseincode.com>,
	"anderson@redhat.com" <anderson@redhat.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"cl@linux.com" <cl@linux.com>,
	"cov@codeaurora.org" <cov@codeaurora.org>,
	"jays.lee@samsung.com" <jays.lee@samsung.com>,
	"msalter@redhat.com" <msalter@redhat.com>,
	"sandeepa.prabhu@linaro.org" <sandeepa.prabhu@linaro.org>,
	"srivatsa.bhat@linux.vnet.ibm.com"
	<srivatsa.bhat@linux.vnet.ibm.com>,
	"steve.capper@linaro.org" <steve.capper@linaro.org>,
	Sudeep Holla <Sudeep.Holla@arm.com>,
	"takahiro.akashi@linaro.org" <takahiro.akashi@linaro.org>,
	"Vijaya.Kumar@caviumnetworks.com"
	<Vijaya.Kumar@caviumnetworks.com>,
	"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
	"acme@kernel.org" <acme@kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	Matthew Leach <Matthew.Leach@arm.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"paulus@samba.org" <paulus@samba.org>,
	Mark Charlebois <charlebm@gmail.com>
Subject: Re: [PATCH] arm64: LLVMLinux: Fix inline arm64 assembly for use with clang
Date: Wed, 10 Sep 2014 18:38:29 +0100	[thread overview]
Message-ID: <20140910173829.GI1710@arm.com> (raw)
In-Reply-To: <20140908093051.GA12657@localhost>

On Mon, Sep 08, 2014 at 10:30:51AM +0100, Olof Johansson wrote:
> On Fri, Sep 05, 2014 at 04:24:20PM -0700, behanw@converseincode.com wrote:
> > From: Mark Charlebois <charlebm@gmail.com>
> > 
> > Fix variable types for 64-bit inline assembly.
> > 
> > This patch now works with both gcc and clang.
> > 
> > Signed-off-by: Mark Charlebois <charlebm@gmail.com>
> > Signed-off-by: Behan Webster <behanw@converseincode.com>
> > ---
> >  arch/arm64/include/asm/arch_timer.h | 26 +++++++++++++++-----------
> >  arch/arm64/include/asm/uaccess.h    |  2 +-
> >  arch/arm64/kernel/debug-monitors.c  |  8 ++++----
> >  arch/arm64/kernel/perf_event.c      | 34 +++++++++++++++++-----------------
> >  arch/arm64/mm/mmu.c                 |  2 +-
> >  5 files changed, 38 insertions(+), 34 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
> > index 9400596..c1f87e0 100644
> > --- a/arch/arm64/include/asm/arch_timer.h
> > +++ b/arch/arm64/include/asm/arch_timer.h
> > @@ -37,19 +37,23 @@ void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u32 val)
> >  	if (access == ARCH_TIMER_PHYS_ACCESS) {
> >  		switch (reg) {
> >  		case ARCH_TIMER_REG_CTRL:
> > -			asm volatile("msr cntp_ctl_el0,  %0" : : "r" (val));
> > +			asm volatile("msr cntp_ctl_el0,  %0"
> > +				: : "r" ((u64)val));
> 
> Ick. Care to elaborate in the patch description why this is needed with
> LLVM? It's really messy and very annoying having to cast register values
> every time they're passed in, instead of the compiler handling it for you.
> 
> Is there a way to catch this with GCC? If not, I expect you to get broken
> all the time on this by people who don't notice.

Question to the clang people (Clangers?): what happens if the %0 above is
rewritten as %x0 and the cast on val is dropped? I could stomach a change
adding that, but it's still likely to regress without regular build testing.

Will

  reply	other threads:[~2014-09-10 17:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 23:24 [PATCH] arm64: LLVMLinux: Fix inline arm64 assembly for use with clang behanw
2014-09-08  9:30 ` Olof Johansson
2014-09-10 17:38   ` Will Deacon [this message]
2014-09-10 17:49     ` Ard Biesheuvel
2014-09-08 10:53 ` Will Deacon
2014-09-08 18:35   ` Mark Charlebois
2014-09-09 10:15     ` Will Deacon
2014-09-15  5:30       ` behanw
2014-09-15 16:02         ` Will Deacon
2014-09-15 16:26           ` Catalin Marinas

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=20140910173829.GI1710@arm.com \
    --to=will.deacon@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=Matthew.Leach@arm.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anderson@redhat.com \
    --cc=behanw@converseincode.com \
    --cc=charlebm@gmail.com \
    --cc=cl@linux.com \
    --cc=cov@codeaurora.org \
    --cc=jays.lee@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=msalter@redhat.com \
    --cc=olof@lixom.net \
    --cc=paulus@samba.org \
    --cc=sandeepa.prabhu@linaro.org \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=steve.capper@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).