From patchwork Thu Oct 10 11:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13830024 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 BEAEDCF11DA for ; Thu, 10 Oct 2024 12:11:27 +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=e/3IXPLtEzkdPxakYsKtSl6x7P98QonT1kDDJ6tUink=; b=C0YBxYAEPsMvUo+G0C3Utctlsb V8f9MYVy3dxgqi7+PcDCnCyN96omXyXmFxlosN764niD41yu2zHt9CHjlA6LR0brUNvvTcFd3J+dN DccejgkOqRd4G5OUUTMoXeoYCnRiSXMkopJA+ZgKJQBxSTSxGCnNDUAMMh1cJ0ZVOLbt9frKZwyPQ RLWjpkR9JfHjhsM9n7fDu07bQLF4vfMaHkMvGewowe6zHDVGn4M5iYNPfxQPQnsYQoZQnngVuukfc rO8OKF3g8Ib0MclD0oht/6jTcDTbUZIwbwrnzxUSLML1isGUJfGVmKGoDw0LOGE5qOR6TnmjtQjYD fY3RDfAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sys0f-0000000Cf8h-1aBs; Thu, 10 Oct 2024 12:11:13 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syrR4-0000000CYQO-0Rsz for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 11:34:31 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a7aa086b077so115808866b.0 for ; Thu, 10 Oct 2024 04:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728560064; x=1729164864; 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=e/3IXPLtEzkdPxakYsKtSl6x7P98QonT1kDDJ6tUink=; b=pTTfvs4S8e+Dc/QUGZ9vy9ljNLHUt+snkKtHeA+R6iibA6eLs+3th67DOA+UdxF4HU UNxSzBHWW4cHP9QJcJVJcfdYKn3PaMmSYAJgYfzEPKJsL9n80khDsuaAE5ejbFegWfoW ykhWdo+4xXKDnmiadlAx9GKKRa/xuG9rwcEaEIvqt8KbXwMKhtBv1Rh42B/spnN7IKUl +MMU4ivymv0SprYkp15I7HF0gAxRtF0EmbVTYA9C+oziddl+ks6lUBAu3cHq82xPRX5W jHNb7JjRHITdaWJcvUo0qAEyfWYxqAKMVernfe46xwUBpj0tS4dnNfCKJFmF9VDQS7Hc E29A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728560064; x=1729164864; 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=e/3IXPLtEzkdPxakYsKtSl6x7P98QonT1kDDJ6tUink=; b=rbR7+DFvb+eYm9RqP8jSivVhspBWVyULgs39mocSI/mRHf9d4dmGVn4zg15CrC3P8g YZXrI54ZUgzu+91sRVv2eazcXTDSBhnjIohUFXNXmof4bbNjzrAEmBkRuSnsUZ6KhYaQ 6fXH91+mLGa8hZINs02u5ekrhgYhF7RaU5MRutzCOgYXevbfLVEnAEcFQTz7pZBLm67q xlcKBp0rKf1wWoRntNG8s9Tzm1HlNczKxuGSUY0EXvdrQKkMltAqtDMs68LmUHCcX2Ln mckIP7sm6AeSA0iCnh8Mm5Uz2551ZPZ45b0QfUHg80Pvz19fdk3YfPnf5cmsCXzM3aQH TKlw== X-Gm-Message-State: AOJu0YxMoNL59rc0vRkHz79x9HpRlzzmtvg1aJefbC3StuYXScbnd+fC Ymy1AnFs75VZn3wtJnbfRN8eM1h5vRZXX3vNqDYakGQwDbREySby/WkLTFEfP1w= X-Google-Smtp-Source: AGHT+IGSkGuyhdw8AmjZaYSG3AbwkYxBJPVivMy155PvJBG22/KVJmiGE/T4Z0mI0+yJzLqzOiUsfg== X-Received: by 2002:a17:906:c109:b0:a99:403e:2578 with SMTP id a640c23a62f3a-a999e628eb0mr313283366b.5.1728560064365; Thu, 10 Oct 2024 04:34:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 04:34:23 -0700 (PDT) From: Linus Walleij Date: Thu, 10 Oct 2024 13:34:03 +0200 Subject: [PATCH RFC 25/28] ARM: entry: Create irqentry calls from kernel mode MIME-Version: 1.0 Message-Id: <20241010-arm-generic-entry-v1-25-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_043426_186599_B502646F X-CRM114-Status: GOOD ( 14.21 ) 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 This adds a few calls to C when exceptions enter/exit from the kernel itself, so these can be used for generic entry. Signed-off-by: Linus Walleij --- arch/arm/include/asm/entry.h | 2 ++ arch/arm/kernel/entry-armv.S | 3 +++ arch/arm/kernel/entry-header.S | 5 +++++ arch/arm/kernel/entry.c | 8 ++++++++ 4 files changed, 18 insertions(+) diff --git a/arch/arm/include/asm/entry.h b/arch/arm/include/asm/entry.h index 8b8cc9a1eefb..a78bc5054b09 100644 --- a/arch/arm/include/asm/entry.h +++ b/arch/arm/include/asm/entry.h @@ -12,5 +12,7 @@ long syscall_enter_from_user_mode(struct pt_regs *regs, long); void syscall_exit_to_user_mode(struct pt_regs *regs); void irqentry_enter_from_user_mode(struct pt_regs *regs); void irqentry_exit_to_user_mode(struct pt_regs *regs); +void irqentry_enter_from_kernel_mode(struct pt_regs *regs); +void irqentry_exit_to_kernel_mode(struct pt_regs *regs); #endif /* __ASM_ENTRY_H__ */ diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index bd468d58dc02..21b11fe199cb 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -204,6 +204,9 @@ ENDPROC(__und_invalid) get_thread_info tsk uaccess_entry tsk, r0, r1, r2, \uaccess + mov r0, sp @ 'regs' + bl irqentry_enter_from_kernel_mode + .if \trace #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 51c7f93c1ded..49a9c5cf6fd5 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S @@ -210,6 +210,7 @@ .else @ IRQs off again before pulling preserved data off the stack disable_irq_notrace + #ifdef CONFIG_TRACE_IRQFLAGS tst \rpsr, #PSR_I_BIT bleq trace_hardirqs_on @@ -217,6 +218,10 @@ blne trace_hardirqs_off #endif .endif + + mov r0, sp @ 'regs' + bl irqentry_exit_to_kernel_mode + uaccess_exit tsk, r0, r1 #ifndef CONFIG_THUMB2_KERNEL diff --git a/arch/arm/kernel/entry.c b/arch/arm/kernel/entry.c index d7fdb9df3331..674b5adcec00 100644 --- a/arch/arm/kernel/entry.c +++ b/arch/arm/kernel/entry.c @@ -56,3 +56,11 @@ noinstr void irqentry_exit_to_user_mode(struct pt_regs *regs) /* This context tracking call has inverse naming */ user_enter_callable(); } + +noinstr void irqentry_enter_from_kernel_mode(struct pt_regs *regs) +{ +} + +noinstr void irqentry_exit_to_kernel_mode(struct pt_regs *regs) +{ +}