From nobody Sat Apr 4 06:03:12 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1115E374730 for ; Fri, 3 Apr 2026 14:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775228024; cv=none; b=I/zntoiBDcr2/+JDpIkgZFHLjC0mUFBDGNU0iZ6mgFF74lIucC1llr6T8RGZdpb4VanwRIbeds8B34J6HLbob4U6qO9YRGINd9ZSf+i5qyzGOE1J35Q5aUV5G3XjSRUqv3mgRil9ou8fa/eiffEJnCGs7wiP4YN4y+hLDiz5kbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775228024; c=relaxed/simple; bh=8WQ7jEq8bJBsdnlHGUXrbWXnXrrr5Xxc2+zvN+1cF+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sdPVnlSL1DFte4C6JXuzzsLNHF/WDdc7+MPtNKuxosQbq82FZr7jTCl5scnGwpri/UoagNZqRucH05qmJjg7T+kev+k2AOSe+6CqXoccbE/7B0WrxrTSW6yCVn9HSic454l1CT0SHc++FOIRjX3u6GL+ToxZdBSC3zMo0OsglQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=q+Iy4yN1; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q+Iy4yN1" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-824c9da9928so1197121b3a.3 for ; Fri, 03 Apr 2026 07:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775228022; x=1775832822; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SIf376OZyXcpY0mdrIrP1nTWV/VE0v5g8114Fjjgl84=; b=q+Iy4yN17nA7Z90UqWxkrbrvCXUr0bZgVn0JykyfefcL+DijJlO1wrzBgjV+3MpzKb jASPIuwF7i+vExD0S1tRhCXxx4C3FJUbUhKxN2O30dY6PAVlRPY+0dOapR2VrhC8ZeK3 XNBmLfW9JNEYrLZtcLxpMvVOHXY2e5aCptnd9qgIvKrY77hWeNMYA7l4NKarJHYa2lfz ym7FeoPTBhZW+GbtsOwxemvKZnZWRPB+nd6wNw50wTLFVgsWDOCQVxZplXz6IjjjPkLf TKjFpYZ2NCsh8vYfd+Sg/3NGcQVd2ubfgEZ7XpXSHEq7B521WOHg9ruWDLfghjoUiJLx UiOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775228022; x=1775832822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SIf376OZyXcpY0mdrIrP1nTWV/VE0v5g8114Fjjgl84=; b=Xht/W3I7LbT1xwdxbSApHsSA8mA2coSvNSlSBZSPwZqRSlQASNhxIFg3uAnzxj4y0j sK1cTC4QbTMs502MSWvsL3x2GJTDcENYGVUDkx6aPUN5EWGzdASm6KpiWI1Hsu6yDTwR MTqbOz5gC8r6T40f/Eqs1DbYJHOz7mLVlWQ9da/M4aEcMGOzjx4nmSiS6NxKA5TcxzlH lBL5WTWSS5CPW67Wg+ZNf24Jcvx8AxHht7tcN66556EMjpGqEQQMimKk6a1xwMLJXv7J FKGbwpVGsJkV2BVc+gsgycFoGcDvk/TVr/2Vbkp/+icdOyb5dzoWUC7DAFgDVn37mtyO 2ZiQ== X-Forwarded-Encrypted: i=1; AJvYcCXI98kid9PrtUdUI1NQv5z9UaefL92nGwzp2CmuISOFf8cXXJZQ4LKP3qtbE6FgOfHFmiCvzFIXSr7uILI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4nJn8JGMsTe9OTcziIEC7WLZ3e+Bdq0K2ZRPRv/CeB7ffU56q L+T+i691f1JeWV0YglVwPbfLT4v9m+NrYbgQbizXCnbziJ2m9DEtEdT/ X-Gm-Gg: ATEYQzzHqCcTslr2U6m9HVcRJCdFyGgl0JcsHb8VgAfwBR9EV0Ihewt+XpRBtic7dMW +Gc52nSpPIWPuhvK0IyJuepLi3W9K9iAITNHEmmc0Y1IxcILu7XreMgnW2fY2jofpj5fdwB4MRy i5d9zwvwMgOl6aZJ7QFZhoYnVPrOjx/eBOemOE9gg4HfYjygWELeLuRlYD+4UkfWTybGx77gG67 4tCpcZF/ZJ2modLN+esu0MtQw1h/PhFhAAyPx36UuH9ApL9ZhTPF40dkhyfkD7XMSLsiUMr/0tm 8TQ9yOER9WmBr+4DF4Y4dxDPY4wXf1q3foYP7/4X0W/QAbQ8XN7MXVTSiZQrXQv6gXyxxP7VNc3 rfpP5NOMfSGoMNdQdqDj/UWgewZDFXVnXibtAoJGJ4vHiqKvixblLCLn8ZY8Ylag2njB4bIKoSa EsZK+veSzPbkxAoZvZx7JpFAdeWEfI5HA3MeLubPO8qDS3sIYNrJWOWYJiNA5C/MvKCAkP7rQXa nQ= X-Received: by 2002:a05:6a00:414c:b0:82c:fe17:5af5 with SMTP id d2e1a72fcca58-82d0db96d9emr2983355b3a.44.1775228022326; Fri, 03 Apr 2026 07:53:42 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.160.44]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82cf9ca4efesm6301682b3a.61.2026.04.03.07.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 07:53:41 -0700 (PDT) From: "Mukesh Kumar Chaurasiya (IBM)" To: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com, rostedt@goodmis.org, ardb@kernel.org, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: "Mukesh Kumar Chaurasiya (IBM)" Subject: [PATCH V8 2/4] powerpc/jump_label: adjust inline asm to be consistent Date: Fri, 3 Apr 2026 20:23:06 +0530 Message-ID: <20260403145308.1042622-3-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260403145308.1042622-1-mkchauras@gmail.com> References: <20260403145308.1042622-1-mkchauras@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Added support for a new macro ARCH_STATIC_BRANCH_ASM in powerpc to avoid duplication of inline asm between C and Rust. This is inline with 'commit aecaf181651c ("jump_label: adjust inline asm to be cons= istent")' Co-developed-by: Madhavan Srinivasan Signed-off-by: Madhavan Srinivasan Reviewed-by: Alice Ryhl Reviewed-by: Christophe Leroy (CS GROUP) Reviewed-by: Gary Guo Link: https://github.com/Rust-for-Linux/linux/issues/105 Link: https://github.com/linuxppc/issues/issues/451 Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/a= sm/jump_label.h index d4eaba459a0e..3016e9c8d6bc 100644 --- a/arch/powerpc/include/asm/jump_label.h +++ b/arch/powerpc/include/asm/jump_label.h @@ -15,14 +15,20 @@ #define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG) #define JUMP_LABEL_NOP_SIZE 4 =20 +#define JUMP_TABLE_ENTRY(key, label) \ + ".pushsection __jump_table, \"aw\" \n\t" \ + ".long 1b - ., " label " - . \n\t" \ + JUMP_ENTRY_TYPE key " - . \n\t" \ + ".popsection \n\t" + +#define ARCH_STATIC_BRANCH_ASM(key, label) \ + "1: nop \n\t" \ + JUMP_TABLE_ENTRY(key, label) + static __always_inline bool arch_static_branch(struct static_key *key, boo= l branch) { - asm goto("1:\n\t" - "nop # arch_static_branch\n\t" - ".pushsection __jump_table, \"aw\"\n\t" - ".long 1b - ., %l[l_yes] - .\n\t" - JUMP_ENTRY_TYPE "%c0 - .\n\t" - ".popsection \n\t" + asm goto( + ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]") : : "i" (&((char *)key)[branch]) : : l_yes); =20 return false; @@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(stru= ct static_key *key, bool { asm goto("1:\n\t" "b %l[l_yes] # arch_static_branch_jump\n\t" - ".pushsection __jump_table, \"aw\"\n\t" - ".long 1b - ., %l[l_yes] - .\n\t" - JUMP_ENTRY_TYPE "%c0 - .\n\t" - ".popsection \n\t" + JUMP_TABLE_ENTRY("%c0", "%l[l_yes]") : : "i" (&((char *)key)[branch]) : : l_yes); =20 return false; --=20 2.53.0