From patchwork Thu Oct 10 11:33:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13830007 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 0AE4FCF11D3 for ; Thu, 10 Oct 2024 11:58:54 +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=QiCmSIGHUZECgnJQfgeIr1Zf7B vAbWgrd21irHMJz/m6pU9E3WaDdL0MGUHHPSTSgdH+W6p6XcoNPNWznbJggoXjuOqwK9ZutsKbtO6 Gw00MlgaYsU639yakVPKfZ3MEerhasSPG6ixV4HUWK94pBGnWqk+Rurpv2nLLAvhkadAOdtVYMvaG u3EtDt9t0pLeRuRiT1iotrePNNvVAjxwhaHVTi0vI9GXeTY1yV28kBloozev8WnMCgw/hxsjvB/zB PHI4Qnh0ditEL0TOgwqve68YYoEq/ZFafEjgnLhiqK0UjCDANd/ykZ9wwQ5egYkWizfjHZ/zxtEgw cCBADTXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syroX-0000000Ccui-02rP; Thu, 10 Oct 2024 11:58:41 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syrQr-0000000CYKM-2o0X for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 11:34:18 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a995f56ea2dso132029366b.1 for ; Thu, 10 Oct 2024 04:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728560051; x=1729164851; 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=NAZy9cUj92LcGIGngqzv7De26JmfnYm7m5DNmyKhSzxNO2AvBKkhoyCMbMvwqd2Ak3 heRwapvHcWOmAMSlCVAvAW+W2/9O4c9zH/u9fL6ELBBdqsp3H0obs/r3Sg4HALQa6SI+ nR9S7dO+tZf3OhFhYFbMUv9jQTkJbdZzChDr5rS4z1UuQImfUwki4B2qAeKY2OeNpjS2 S0XuM1QxRFDwboG8hdtE9KMkCtUrn4PfNh3ZfVkfoDZ29n0ig8ffA/7gwkomVseiYEE9 tQxxouhWQBFj0X3HYDULWgxbRkqtHyKxDfAuOis8WrOaQ59Do9H/9J8jbO06O6UuKwNS Q0fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728560051; x=1729164851; 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=Kgz6u2aAxHQdIchlLGkBqCUivTTuZsQElzdsQISm47B+hXow62SSkG2PLtU3LjNO6l LRw+UOhvcOkjhLCchS/MpKF1UQeY9kD4stwtOns1frAX81xFoEtf1CbhqILAxvTVHVXF acZtjdSdrULJMSfM+GEOcfj0R+DTsquucXnHyytZF8Jde/jQTaMD36C9KVlhQoQcSI9J 976leHHSS0upr1Ob91g739i7lIfzSei6vfkdHa0BQvFFWYzWgyHHYoEF4/NB+PzJuSCx o8KzoDWUogLdgJ7L4rhnVF5sWuFTz+rC/F0tymNGlX8/nYVEOFNXzcycpL49Wp0yDhtl pu5A== X-Gm-Message-State: AOJu0YwvY1rpDcuCOLDwjiL4QeygsI01A6Ipozxm+xEM5AI25QT8l3Yb m4vJa10OOxZeQytUS2CNWJxcXCT+HU/IeEN/mwTAQSS4mX93yXIMEFCL9fSDHms= X-Google-Smtp-Source: AGHT+IE5VMKxvHaqB8TM4UQMzMj1+qpZY8SgS8d9OXFElPL9iiC2IKmw/Xc8WMoNH9f/aynvyMEWdg== X-Received: by 2002:a17:907:e65c:b0:a99:5773:3612 with SMTP id a640c23a62f3a-a998d202140mr531002866b.36.1728560049978; Thu, 10 Oct 2024 04:34:09 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a7f25406sm77619066b.69.2024.10.10.04.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 04:34:08 -0700 (PDT) From: Linus Walleij Date: Thu, 10 Oct 2024 13:33:54 +0200 Subject: [PATCH RFC 16/28] ARM: entry: Drop argument to asm_irqentry macros MIME-Version: 1.0 Message-Id: <20241010-arm-generic-entry-v1-16-b94f451d087b@linaro.org> References: <20241010-arm-generic-entry-v1-0-b94f451d087b@linaro.org> In-Reply-To: <20241010-arm-generic-entry-v1-0-b94f451d087b@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-20241010_043413_763909_9FDFA8ED X-CRM114-Status: GOOD ( 13.38 ) 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 /*