* [PATCH] arm64: Fix sve_vl() for build errors
@ 2024-11-28 15:00 Suzuki K Poulose
2024-11-28 15:36 ` Andrew Jones
0 siblings, 1 reply; 2+ messages in thread
From: Suzuki K Poulose @ 2024-11-28 15:00 UTC (permalink / raw)
To: kvmarm
Cc: linux-arm-kernel, Suzuki K Poulose, Raghavendra Rao Ananta,
Andrew Jones
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] arm64: Fix sve_vl() for build errors
2024-11-28 15:00 [PATCH] arm64: Fix sve_vl() for build errors Suzuki K Poulose
@ 2024-11-28 15:36 ` Andrew Jones
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jones @ 2024-11-28 15:36 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: kvmarm, linux-arm-kernel, Raghavendra Rao Ananta, Andrew Jones
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-28 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 15:00 [PATCH] arm64: Fix sve_vl() for build errors Suzuki K Poulose
2024-11-28 15:36 ` Andrew Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox