From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: kvmarm@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.org,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Raghavendra Rao Ananta <rananta@google.com>,
Andrew Jones <andrew.jones@linux.dev>
Subject: [PATCH] arm64: Fix sve_vl() for build errors
Date: Thu, 28 Nov 2024 15:00:02 +0000 [thread overview]
Message-ID: <20241128150002.2424523-1-suzuki.poulose@arm.com> (raw)
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
next reply other threads:[~2024-11-28 15:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 15:00 Suzuki K Poulose [this message]
2024-11-28 15:36 ` [PATCH] arm64: Fix sve_vl() for build errors Andrew Jones
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=20241128150002.2424523-1-suzuki.poulose@arm.com \
--to=suzuki.poulose@arm.com \
--cc=andrew.jones@linux.dev \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=rananta@google.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