From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1E4EC10F15 for ; Thu, 25 Apr 2024 09:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UOPfYqY4DlswoPGNf+oVjNrAUVvEBFXTigT0DBmD6zI=; b=U1PVhD8tCgU1ka 1aLLucHJj9A1u2ATSBOfU4evU2yGIka44FwX9XbkzIjNJDjp4VAln3YsEC7w//H946RYCyA6H+QSj 5ujD0xMe1D9OLjYFRQjRoAmriqkBoj24oj/LUbhpq48tCGVOGnMVlmT6EZTR6TeSoajAS1NvUwsyE pCJaKGtXKMxwdOTS7KmTZeny9qBjt6vKXpmnx85ZMRkc+ZBP/exMOlBdBX4xCDYfrodQLPXhSPBob iyOOUO4NaQG7et+qftxoVe9WguvPLN1T8fkZU8qTFjKRucKBTLGdmwkRiQ31eLbmZdJFhQ6fHHvwt D8e0+7JqOCVEXe0leGKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzvIy-00000007bXd-0pYV; Thu, 25 Apr 2024 09:22:12 +0000 Received: from out-183.mta1.migadu.com ([95.215.58.183]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzvIv-00000007bTc-0T85 for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2024 09:22:10 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714036921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DFTiIIshBt3nHGS/4A3nNNzLGmWXkp5ut7bbz0K7Lek=; b=L/tTBCQlgNyM6irTUBCMN/Y6PXJQjRQC9n0W0NtMa5LHG8Pb7sNC5gdYslPPrMV9B8hSLr CXs4h4OEagpy0KKe2NFnI48BIh9Q+G7CaZDjNkwO12RmU4ujfR6Ct7hiZsGa1rWSc3iLsi kJlISbN0kcONOTC1OgGyL3RaLBNsJFw= From: George Guo To: mark.rutland@arm.com Cc: ardb@kernel.org, catalin.marinas@arm.com, dongtai.guo@linux.dev, guodongtai@kylinos.cn, jbaron@akamai.com, jpoimboe@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, peterz@infradead.org, rostedt@goodmis.org, will@kernel.org Subject: [PATCH v2 1/1] arm64: simplify arch_static_branch/_jump function Date: Thu, 25 Apr 2024 17:21:18 +0800 Message-Id: <20240425092118.2924369-2-dongtai.guo@linux.dev> In-Reply-To: <20240425092118.2924369-1-dongtai.guo@linux.dev> References: <20240425092118.2924369-1-dongtai.guo@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240425_022209_334649_2474770C X-CRM114-Status: UNSURE ( 7.05 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: George Guo Extracted the jump table definition code from the arch_static_branch and arch_static_branch_jump functions into a macro JUMP_TABLE_ENTRY to reduce code duplication and improve readability. Signed-off-by: George Guo --- arch/arm64/include/asm/jump_label.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h index 6aafbb789991..69407b70821e 100644 --- a/arch/arm64/include/asm/jump_label.h +++ b/arch/arm64/include/asm/jump_label.h @@ -15,16 +15,19 @@ #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE +#define JUMP_TABLE_ENTRY \ + ".pushsection __jump_table, \"aw\" \n\t" \ + ".align 3 \n\t" \ + ".long 1b - ., %l[l_yes] - . \n\t" \ + ".quad %c0 - . \n\t" \ + ".popsection \n\t" + static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch) { asm goto( "1: nop \n\t" - " .pushsection __jump_table, \"aw\" \n\t" - " .align 3 \n\t" - " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" - " .popsection \n\t" + JUMP_TABLE_ENTRY : : "i"(&((char *)key)[branch]) : : l_yes); return false; @@ -37,11 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke { asm goto( "1: b %l[l_yes] \n\t" - " .pushsection __jump_table, \"aw\" \n\t" - " .align 3 \n\t" - " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" - " .popsection \n\t" + JUMP_TABLE_ENTRY : : "i"(&((char *)key)[branch]) : : l_yes); return false; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel