All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: arm64 -- psci tell the compiler in which registers we are expecting arguments
Date: Fri, 23 Jan 2015 17:56:22 +0000	[thread overview]
Message-ID: <20150123175622.GD13772@arm.com> (raw)
In-Reply-To: <20150123175445.GF26493@n2100.arm.linux.org.uk>

On Fri, Jan 23, 2015 at 05:54:45PM +0000, Russell King - ARM Linux wrote:
> On Fri, Jan 23, 2015 at 05:50:39PM +0000, Will Deacon wrote:
> > On Fri, Jan 23, 2015 at 05:31:54PM +0000, Andy Whitcroft wrote:
> > > diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
> > > index f1dbca7..425cf78 100644
> > > --- a/arch/arm64/kernel/psci.c
> > > +++ b/arch/arm64/kernel/psci.c
> > > @@ -113,9 +113,14 @@ static void psci_power_state_unpack(u32 power_state,
> > >   * The following two functions are invoked via the invoke_psci_fn pointer
> > >   * and will not be inlined, allowing us to piggyback on the AAPCS.
> > >   */
> > > -static noinline int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1,
> > > -					 u64 arg2)
> > > +static noinline int __invoke_psci_fn_hvc(u64 _function_id, u64 _arg0,
> > > +					 u64 _arg1, u64 _arg2)
> > >  {
> > > +	register u64 function_id asm("x0") = _function_id;
> > > +	register u64 arg0 asm("x1") = _arg0;
> > > +	register u64 arg1 asm("x2") = _arg1;
> > > +	register u64 arg2 asm("x3") = _arg2;
> > > +
> > 
> > Given that we've already been bitten by the compiler, I think we should
> > just bite the bullet and implement these two functions in assembly in a
> > separate file rather than rely on register variables doing what we want.
> 
> The alternative is a naked function.

I wondered about that, but the gcc docs say that you can't then provide
operands to the asm block, which would mean removing the __asmeq checks
altogether (which terrifies me!).

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Andy Whitcroft <apw@canonical.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: arm64 -- psci tell the compiler in which registers we are expecting arguments
Date: Fri, 23 Jan 2015 17:56:22 +0000	[thread overview]
Message-ID: <20150123175622.GD13772@arm.com> (raw)
In-Reply-To: <20150123175445.GF26493@n2100.arm.linux.org.uk>

On Fri, Jan 23, 2015 at 05:54:45PM +0000, Russell King - ARM Linux wrote:
> On Fri, Jan 23, 2015 at 05:50:39PM +0000, Will Deacon wrote:
> > On Fri, Jan 23, 2015 at 05:31:54PM +0000, Andy Whitcroft wrote:
> > > diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
> > > index f1dbca7..425cf78 100644
> > > --- a/arch/arm64/kernel/psci.c
> > > +++ b/arch/arm64/kernel/psci.c
> > > @@ -113,9 +113,14 @@ static void psci_power_state_unpack(u32 power_state,
> > >   * The following two functions are invoked via the invoke_psci_fn pointer
> > >   * and will not be inlined, allowing us to piggyback on the AAPCS.
> > >   */
> > > -static noinline int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1,
> > > -					 u64 arg2)
> > > +static noinline int __invoke_psci_fn_hvc(u64 _function_id, u64 _arg0,
> > > +					 u64 _arg1, u64 _arg2)
> > >  {
> > > +	register u64 function_id asm("x0") = _function_id;
> > > +	register u64 arg0 asm("x1") = _arg0;
> > > +	register u64 arg1 asm("x2") = _arg1;
> > > +	register u64 arg2 asm("x3") = _arg2;
> > > +
> > 
> > Given that we've already been bitten by the compiler, I think we should
> > just bite the bullet and implement these two functions in assembly in a
> > separate file rather than rely on register variables doing what we want.
> 
> The alternative is a naked function.

I wondered about that, but the gcc docs say that you can't then provide
operands to the asm block, which would mean removing the __asmeq checks
altogether (which terrifies me!).

Will

  reply	other threads:[~2015-01-23 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 17:31 arm64 -- psci tell the compiler in which registers we are expecting arguments Andy Whitcroft
2015-01-23 17:31 ` Andy Whitcroft
2015-01-23 17:50 ` Will Deacon
2015-01-23 17:50   ` Will Deacon
2015-01-23 17:54   ` Russell King - ARM Linux
2015-01-23 17:54     ` Russell King - ARM Linux
2015-01-23 17:56     ` Will Deacon [this message]
2015-01-23 17:56       ` Will Deacon

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=20150123175622.GD13772@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.