linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@kernel.org>
Subject: [PATCH 2/2] arm64: Restore UL() use in alternative macros after binutils bump
Date: Sat,  7 Jun 2025 11:40:41 +0100	[thread overview]
Message-ID: <20250607104041.1406771-3-maz@kernel.org> (raw)
In-Reply-To: <20250607104041.1406771-1-maz@kernel.org>

Binutils versions up to (and including) 2.27 are not handling L/UL
suffixes on constants, making it impossible to use the BIT() macro
in some of the alternative macros.

Now that binutils 2.30 is the base version, revert ba00c2a04fa54
("arm64: fix the build with binutils 2.27") and allow the use of the
BIT() macro in inline assembly, such as the alternative code.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/include/asm/alternative-macros.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/alternative-macros.h b/arch/arm64/include/asm/alternative-macros.h
index 61c2cbe618b9f..7d80d488c7faf 100644
--- a/arch/arm64/include/asm/alternative-macros.h
+++ b/arch/arm64/include/asm/alternative-macros.h
@@ -8,12 +8,7 @@
 #include <asm/cpucaps.h>
 #include <asm/insn-def.h>
 
-/*
- * Binutils 2.27.0 can't handle a 'UL' suffix on constants, so for the assembly
- * macros below we must use we must use `(1 << ARM64_CB_SHIFT)`.
- */
-#define ARM64_CB_SHIFT	15
-#define ARM64_CB_BIT	BIT(ARM64_CB_SHIFT)
+#define ARM64_CB_BIT	BIT(15)
 
 #if ARM64_NCAPS >= ARM64_CB_BIT
 #error "cpucaps have overflown ARM64_CB_BIT"
@@ -76,7 +71,7 @@
 	__ALTERNATIVE_CFG(oldinstr, newinstr, cpucap, IS_ENABLED(cfg))
 
 #define ALTERNATIVE_CB(oldinstr, cpucap, cb) \
-	__ALTERNATIVE_CFG_CB(oldinstr, (1 << ARM64_CB_SHIFT) | (cpucap), 1, cb)
+	__ALTERNATIVE_CFG_CB(oldinstr, ARM64_CB_BIT | (cpucap), 1, cb)
 #else
 
 #include <asm/assembler.h>
@@ -151,7 +146,7 @@
 .macro alternative_cb cap, cb
 	.set .Lasm_alt_mode, 0
 	.pushsection .altinstructions, "a"
-	altinstruction_entry 661f, \cb, (1 << ARM64_CB_SHIFT) | \cap, 662f-661f, 0
+	altinstruction_entry 661f, \cb, ARM64_CB_BIT | \cap, 662f-661f, 0
 	.popsection
 661:
 .endm
-- 
2.39.2



      parent reply	other threads:[~2025-06-07 10:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-07 10:40 [PATCH 0/2] arm64: Drop more workarounds after binutils bump Marc Zyngier
2025-06-07 10:40 ` [PATCH 1/2] arm64: Remove .inst " Marc Zyngier
2025-06-09 16:45   ` Marc Zyngier
2025-06-07 10:40 ` Marc Zyngier [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=20250607104041.1406771-3-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ardb@kernel.org \
    --cc=arnd@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).