All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Behan Webster <behanw@converseincode.com>
Cc: bcm@fixthebug.org, f.fainelli@gmail.com,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	mporter@linaro.org, bcm-kernel-feedback-list@broadcom.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Alex Elder <elder@linaro.org>
Subject: Re: [PATCH] bcm: address clang inline asm incompatibility
Date: Wed, 28 Jan 2015 11:15:53 +0000	[thread overview]
Message-ID: <CAKv+Gu_NCgMmX_LQqi7vtjtP4ofrW+kx8FPgRd4-LWwK=73-xg@mail.gmail.com> (raw)
In-Reply-To: <1422422306-27473-1-git-send-email-behanw@converseincode.com>

On 28 January 2015 at 05:18, Behan Webster <behanw@converseincode.com> wrote:
> From: Alex Elder <elder@linaro.org>
>
> My GCC-based build environment likes to call register r12 by the
> name "ip" in inline asm.  Behan Webster informed me that his Clang-
> based build environment likes "r12" instead.
>
> Try to make them both happy.
>
> Signed-off-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> ---
>  arch/arm/mach-bcm/bcm_kona_smc.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
> index a55a7ec..3937bd5 100644
> --- a/arch/arm/mach-bcm/bcm_kona_smc.c
> +++ b/arch/arm/mach-bcm/bcm_kona_smc.c
> @@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void)
>   * request result appropriately.  This result value is found in r0
>   * when the "smc" request completes.
>   */
> +#ifdef __clang__
> +#define R12    "r12"
> +#else  /* !__clang__ */
> +#define R12    "ip"    /* gcc calls r12 "ip" */
> +#endif /* !__clang__ */

Why not just use r12 for both?

>  static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>  {
> -       register u32 ip asm("ip");      /* Also called r12 */
> +       register u32 ip asm(R12);       /* Also called r12 */
>         register u32 r0 asm("r0");
>         register u32 r4 asm("r4");
>         register u32 r5 asm("r5");
> @@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>
>         asm volatile (
>                 /* Make sure we got the registers we want */
> -               __asmeq("%0", "ip")
> +               __asmeq("%0", R12)
>                 __asmeq("%1", "r0")
>                 __asmeq("%2", "r4")
>                 __asmeq("%3", "r5")
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] bcm: address clang inline asm incompatibility
Date: Wed, 28 Jan 2015 11:15:53 +0000	[thread overview]
Message-ID: <CAKv+Gu_NCgMmX_LQqi7vtjtP4ofrW+kx8FPgRd4-LWwK=73-xg@mail.gmail.com> (raw)
In-Reply-To: <1422422306-27473-1-git-send-email-behanw@converseincode.com>

On 28 January 2015 at 05:18, Behan Webster <behanw@converseincode.com> wrote:
> From: Alex Elder <elder@linaro.org>
>
> My GCC-based build environment likes to call register r12 by the
> name "ip" in inline asm.  Behan Webster informed me that his Clang-
> based build environment likes "r12" instead.
>
> Try to make them both happy.
>
> Signed-off-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> ---
>  arch/arm/mach-bcm/bcm_kona_smc.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
> index a55a7ec..3937bd5 100644
> --- a/arch/arm/mach-bcm/bcm_kona_smc.c
> +++ b/arch/arm/mach-bcm/bcm_kona_smc.c
> @@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void)
>   * request result appropriately.  This result value is found in r0
>   * when the "smc" request completes.
>   */
> +#ifdef __clang__
> +#define R12    "r12"
> +#else  /* !__clang__ */
> +#define R12    "ip"    /* gcc calls r12 "ip" */
> +#endif /* !__clang__ */

Why not just use r12 for both?

>  static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>  {
> -       register u32 ip asm("ip");      /* Also called r12 */
> +       register u32 ip asm(R12);       /* Also called r12 */
>         register u32 r0 asm("r0");
>         register u32 r4 asm("r4");
>         register u32 r5 asm("r5");
> @@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>
>         asm volatile (
>                 /* Make sure we got the registers we want */
> -               __asmeq("%0", "ip")
> +               __asmeq("%0", R12)
>                 __asmeq("%1", "r0")
>                 __asmeq("%2", "r4")
>                 __asmeq("%3", "r5")
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2015-01-29  1:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  5:18 [PATCH] bcm: address clang inline asm incompatibility Behan Webster
2015-01-28  5:18 ` Behan Webster
2015-01-28 11:15 ` Ard Biesheuvel [this message]
2015-01-28 11:15   ` Ard Biesheuvel
2015-01-28 14:11   ` Alex Elder
2015-01-28 14:11     ` Alex Elder
2015-01-28 16:17     ` Ard Biesheuvel
2015-01-28 16:17       ` Ard Biesheuvel
2015-01-28 17:08       ` Alex Elder
2015-01-28 17:08         ` Alex Elder
2015-01-28 17:20         ` Ard Biesheuvel
2015-01-28 17:20           ` Ard Biesheuvel
2015-01-28 19:17           ` Ard Biesheuvel
2015-01-28 19:17             ` Ard Biesheuvel
2015-01-28 19:27             ` Alex Elder
2015-01-28 19:27               ` Alex Elder
2015-01-28 19:38               ` Ard Biesheuvel
2015-01-28 19:38                 ` Ard Biesheuvel
2015-01-28 20:11                 ` Ard Biesheuvel
2015-01-28 20:11                   ` Ard Biesheuvel
2015-01-28 20:15                   ` Alex Elder
2015-01-28 20:15                     ` Alex Elder
2015-01-28 21:18                   ` Behan Webster
2015-01-28 21:18                     ` Behan Webster
2015-01-28 21:07                 ` Behan Webster
2015-01-28 21:07                   ` Behan Webster
2015-01-28 19:30             ` Behan Webster
2015-01-28 19:30               ` Behan Webster

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='CAKv+Gu_NCgMmX_LQqi7vtjtP4ofrW+kx8FPgRd4-LWwK=73-xg@mail.gmail.com' \
    --to=ard.biesheuvel@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bcm@fixthebug.org \
    --cc=behanw@converseincode.com \
    --cc=elder@linaro.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mporter@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 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.