public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 Raghavendra Rao Ananta <rananta@google.com>,
	Andrew Jones <andrew.jones@linux.dev>
Subject: Re: [PATCH] arm64: Fix sve_vl() for build errors
Date: Thu, 28 Nov 2024 16:36:28 +0100	[thread overview]
Message-ID: <20241128-40f8c0b30bfe9455e1a7d982@orel> (raw)
In-Reply-To: <20241128150002.2424523-1-suzuki.poulose@arm.com>

On Thu, Nov 28, 2024 at 03:00:02PM +0000, Suzuki K Poulose wrote:
> commit 5b9895f8a5d9 ("arm: Fix clang error in sve_vl()") breaks the build
> with the following compiler version, as the "rdvl" expects a 64bit register.
> 
> /tmp/ccGJYtuC.s: Assembler messages:
> /tmp/ccGJYtuC.s:2165: Error: operand mismatch -- `rdvl w3,#8'
> /tmp/ccGJYtuC.s:2165: Info:    did you mean this?
> /tmp/ccGJYtuC.s:2165: Info:     rdvl x3, #8
> make: *** [<builtin>: arm/selftest.o] Error 1
> make: *** Waiting for unfinished jobs....
> 
> $ aarch64-none-elf-gcc --version
> aarch64-none-elf-gcc (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) 10.2.1 20201103
> 
> Fix this by switching to use "unsigned long" variable and restoring the 64bit
> register for the instruction
> 
> Fixes: 5b9895f8a5d9 ("arm: Fix clang error in sve_vl()")
> Cc: Raghavendra Rao Ananta <rananta@google.com>
> Cc: Andrew Jones <andrew.jones@linux.dev>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  lib/arm64/asm/processor.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/arm64/asm/processor.h b/lib/arm64/asm/processor.h
> index e261e74d..e5b0ad10 100644
> --- a/lib/arm64/asm/processor.h
> +++ b/lib/arm64/asm/processor.h
> @@ -154,12 +154,12 @@ static inline bool system_supports_sve(void)
>  	return ((get_id_aa64pfr0_el1() >> ID_AA64PFR0_EL1_SVE_SHIFT) & 0xf) != 0;
>  }
>  
> -static inline int sve_vl(void)
> +static inline unsigned long sve_vl(void)
>  {
> -	int vl;
> +	unsigned long vl;
>  
>  	asm volatile(".arch_extension sve\n"
> -		     "rdvl %w0, #8"
> +		     "rdvl %x0, #8"
>  		     : "=r" (vl));
>  
>  	return vl;
> -- 
> 2.34.1
>

Pushed to master.

Thanks,
drew


      reply	other threads:[~2024-11-28 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 15:00 [PATCH] arm64: Fix sve_vl() for build errors Suzuki K Poulose
2024-11-28 15:36 ` Andrew Jones [this message]

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=20241128-40f8c0b30bfe9455e1a7d982@orel \
    --to=ajones@ventanamicro.com \
    --cc=andrew.jones@linux.dev \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=rananta@google.com \
    --cc=suzuki.poulose@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
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