From patchwork Tue Oct 29 10:52:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13854763 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 7480CD2AB20 for ; Tue, 29 Oct 2024 11:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JNSBA39L+uD3IEP0aKHjk6mvKlXPMhygyF+Shfug/O4=; b=bLpH9pr79CJV+nRW1r3C5wNYEk ulQZ89htmB0oP5vfDo/hguT16K1Gq/kszwwWULAHYuj2L0My7nY0T0GH8iWVGuARHievPs808LVkX tcl0wP9MZsXnxnlv/XsP/dMDt9reDjKGQrSKq5aa/V/b5qvd/JraKZrs5hTz+xEpBdOlR7CdLuhVc oW8JKvk9Vx1Ad0cFNtgnAfZQugG91zYr35CoaoAgoxfu+8ULUQkIB28XaroehpByVwGQlnK/et0dW SLMM1K7udTG7X1dna2rVChO21FkVR4VInZqIMfDIj9DzA0443SOKOt1aXz8VGj8+E6qI5kqDtGMMK ZVb4rdiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5kTs-0000000EFPg-10e3; Tue, 29 Oct 2024 11:33:48 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5jqf-0000000E7OY-0mx9 for linux-arm-kernel@lists.infradead.org; Tue, 29 Oct 2024 10:53:18 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-539f58c68c5so8765134e87.3 for ; Tue, 29 Oct 2024 03:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730199196; x=1730803996; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JNSBA39L+uD3IEP0aKHjk6mvKlXPMhygyF+Shfug/O4=; b=gjnaDZPTlh2tCWwHiOUaphyDTbERFYhOAc9cGbdOX5Fvw0cQMoo3DcilTgtwgv5x1m pomRuk+soVt5qQbBApNxoNBfujh+g9pzTKvV4lOcEHCwNEwkRvYXt53upMOdgoFzdjS8 wXF0N3BMZTqYiTOHcIBZfqej4naiaGj/jIwXKia02Ed2rkFN6fM3ps4zgXfbmfJ5o3WX h0CdtVHEck2aQEdoH9/K2y2QDdasyFCnwz1Sj68iDzGGVUG5AzrUF3a+GLCaVWstE/G4 aHhY4i6hz4qDffpqNmwuMrJMkpfyst7m9s81UvWTfOf632mDC4XDlag8s8MblE4hJ6VJ NXJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730199196; x=1730803996; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JNSBA39L+uD3IEP0aKHjk6mvKlXPMhygyF+Shfug/O4=; b=m1bW8rM7ooJdkHaeO+1J14/xtUmVcBOcLFfYYTjCInrAZDkZVcoIs82VTJQ9VKpnRU dHqgT3zLvgH26QPSHIzbsH2gMWBqc+pBS5jPED7bD5LLmRrP2/6ibMaNxUbs9UAynhpE SzU11nKk19f/zU3OvLzsfODTWeLSXU1ip3BgaVb6HfPdaHT5Va9hD7eTckpVnCjJDAW/ xDfgWrxid45KzvHV4BjHdZ9kjOUmdUTre4nfeAdEjvH1T/HzDhTJy+ZGR52tStPF6MRY iAcvGljUOWJvAsWXMmUVWwax6arH143pXU7uMtYybixbvx0P/c7Yen3ETdmm8s5/Sn7e Ur3w== X-Gm-Message-State: AOJu0Yw7mqlkqmigF4rzGFrgtBLLzGsY0Li9mZVkaroL9p8EZuWn//Ip ajCdzq7siJOVn+10i3tZ/+z8tsJ0tlG0pAXFntBFXhyCJ+TP0cHRwe89piS0Mqo= X-Google-Smtp-Source: AGHT+IHwhUbueHKfzusT1MGnoFMhY8X4pCN3hYae0P/kspX02WumWJCSxZicZBMwsoQhFKVcgb73SQ== X-Received: by 2002:a05:6512:3c9f:b0:539:93b2:1380 with SMTP id 2adb3069b0e04-53b34921b15mr9499847e87.48.1730199195613; Tue, 29 Oct 2024 03:53:15 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53b2e12452fsm1351307e87.73.2024.10.29.03.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:53:13 -0700 (PDT) From: Linus Walleij Date: Tue, 29 Oct 2024 11:52:56 +0100 Subject: [PATCH RFC v2 16/28] ARM: entry: Drop argument to asm_irqentry macros MIME-Version: 1.0 Message-Id: <20241029-arm-generic-entry-v2-16-573519abef38@linaro.org> References: <20241029-arm-generic-entry-v2-0-573519abef38@linaro.org> In-Reply-To: <20241029-arm-generic-entry-v2-0-573519abef38@linaro.org> To: Oleg Nesterov , Russell King , Kees Cook , Andy Lutomirski , Will Drewry , Frederic Weisbecker , "Paul E. McKenney" , Jinjie Ruan , Arnd Bergmann , Ard Biesheuvel , Al Viro Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241029_035317_383322_7A067127 X-CRM114-Status: GOOD ( 13.34 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org asm_irqentry_enter_from_user_mode and asm_irqentry_exit_to_user_mode have a "save" argument that will save and restore registers before the call to the C function. Now all invocations set this argument to 0 so drop the surplus code. Signed-off-by: Linus Walleij --- arch/arm/kernel/entry-armv.S | 8 ++++---- arch/arm/kernel/entry-common.S | 2 +- arch/arm/kernel/entry-header.S | 18 ++---------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 0328860475e1..09ce1be1f677 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -421,7 +421,7 @@ ENDPROC(__fiq_abt) .align 5 __dabt_usr: usr_entry uaccess=0 - asm_irqentry_enter_from_user_mode save = 0 + asm_irqentry_enter_from_user_mode kuser_cmpxchg_check mov r2, sp dabt_helper @@ -432,7 +432,7 @@ ENDPROC(__dabt_usr) .align 5 __irq_usr: usr_entry - asm_irqentry_enter_from_user_mode save = 0 + asm_irqentry_enter_from_user_mode kuser_cmpxchg_check irq_handler from_user=1 get_thread_info tsk @@ -446,7 +446,7 @@ ENDPROC(__irq_usr) .align 5 __und_usr: usr_entry uaccess=0 - asm_irqentry_enter_from_user_mode save = 0 + asm_irqentry_enter_from_user_mode @ IRQs must be enabled before attempting to read the instruction from @ user space since that could cause a page/translation fault if the @@ -471,7 +471,7 @@ ENDPROC(__und_usr) .align 5 __pabt_usr: usr_entry - asm_irqentry_enter_from_user_mode save = 0 + asm_irqentry_enter_from_user_mode mov r2, sp @ regs pabt_helper UNWIND(.fnend ) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 14b2495cae3c..df564388905e 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -109,7 +109,7 @@ ENTRY(ret_to_user_from_irq) movs r1, r1, lsl #16 bne slow_work_pending no_work_pending: - asm_irqentry_exit_to_user_mode save = 0 + asm_irqentry_exit_to_user_mode #ifdef CONFIG_GCC_PLUGIN_STACKLEAK bl stackleak_erase_on_task_stack diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index fb5bb019199b..50c0b55adc74 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S @@ -365,28 +365,14 @@ ALT_UP_B(.L1_\@) * Context tracking and other mode transitions. Used to instrument transitions * between user and kernel mode. */ - .macro asm_irqentry_enter_from_user_mode, save = 1 - .if \save - stmdb sp!, {r0-r3, ip, lr} + .macro asm_irqentry_enter_from_user_mode mov r0, sp @ regs bl irqentry_enter_from_user_mode - ldmia sp!, {r0-r3, ip, lr} - .else - mov r0, sp @ regs - bl irqentry_enter_from_user_mode - .endif .endm - .macro asm_irqentry_exit_to_user_mode, save = 1 - .if \save - stmdb sp!, {r0-r3, ip, lr} + .macro asm_irqentry_exit_to_user_mode mov r0, sp @ regs bl irqentry_exit_to_user_mode - ldmia sp!, {r0-r3, ip, lr} - .else - mov r0, sp @ regs - bl irqentry_exit_to_user_mode - .endif .endm /*