From patchwork Sat Jun 29 08:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13716854 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 D9C3DC3065A for ; Sat, 29 Jun 2024 08:53:51 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XEAY0Ug0+dRAa518RaaHnMSmbKwuRZsDbXfZyPmGTIw=; b=BiwwcaBQLIBmTE IuSAGwRaxXLKvPaACqD+G+4SbYVmxOGilQUX3TcXgBDfiCvHOCS7Rg3DW0VnQQKAhn7/BZn98eo86 1lDooCyYWBxmrT6liIKJyRjUgRR1V6LfxasbAV2L7DogXHMwpwO2a6J5VFHyp5B3uHMDLw7yRFfeu DS+S6UzoMgsvOH8//E642kL3iXCMkPTA6cA1kvdAEloQO2sHDrjHt8uDNe0OVdKdI2t+wQEmUVukN AHMWYbx3IdNzgqfxPTvFtVRvaRje4JlQU5sadDm19u9cT4mHENXqCZ+nEBQr2ozl9916gXq++H4Kc WcpnKSUPU+TsNCKjaDZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNTpt-0000000G8k1-36Po; Sat, 29 Jun 2024 08:53:33 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNTpi-0000000G8gN-3Q6V for linux-arm-kernel@lists.infradead.org; Sat, 29 Jun 2024 08:53:24 +0000 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WB5g122w0znYVL; Sat, 29 Jun 2024 16:53:01 +0800 (CST) Received: from kwepemi100008.china.huawei.com (unknown [7.221.188.57]) by mail.maildlp.com (Postfix) with ESMTPS id E7ACC18006F; Sat, 29 Jun 2024 16:53:11 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi100008.china.huawei.com (7.221.188.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 29 Jun 2024 16:53:11 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , Subject: [PATCH v3 0/3] arm64: entry: Convert to generic entry Date: Sat, 29 Jun 2024 16:55:58 +0800 Message-ID: <20240629085601.470241-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi100008.china.huawei.com (7.221.188.57) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240629_015323_061524_2C7682F5 X-CRM114-Status: UNSURE ( 9.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, x86, Riscv, Loongarch use the generic entry. Convert arm64 to use the generic entry infrastructure from kernel/entry/*. The generic entry makes maintainers' work easier and codes more elegant, which aslo removed a lot of duplicate code. Changes in v3: - Test the MTE test cases. - Handle forget_syscall() in arch_post_report_syscall_entry() - Make the arch funcs not use __weak as Thomas suggested, so move the arch funcs to entry-common.h, and make arch_forget_syscall() folded in arch_post_report_syscall_entry() as suggested. - Move report_single_step() to thread_info.h for arm64 - Change __always_inline() to inline, add inline for the other arch funcs. - Remove unused signal.h for entry-common.h. - Add Suggested-by. - Update the commit message. Changes in v2: - Add tested-by. - Fix a bug that not call arch_post_report_syscall_entry() in syscall_trace_enter() if ptrace_report_syscall_entry() return not zero. - Refactor report_syscall(). - Add comment for arch_prepare_report_syscall_exit(). - Adjust entry-common.h header file inclusion to alphabetical order. - Update the commit message. Jinjie Ruan (3): entry: Add some arch funcs to support arm64 to use generic entry arm64: Prepare to switch to generic entry arm64: entry: Convert to generic entry arch/arm64/Kconfig | 1 + arch/arm64/include/asm/entry-common.h | 172 ++++++++++++ arch/arm64/include/asm/ptrace.h | 5 + arch/arm64/include/asm/stacktrace.h | 5 +- arch/arm64/include/asm/syscall.h | 6 +- arch/arm64/include/asm/thread_info.h | 23 +- arch/arm64/kernel/entry-common.c | 368 +++++--------------------- arch/arm64/kernel/ptrace.c | 90 ------- arch/arm64/kernel/signal.c | 3 +- arch/arm64/kernel/syscall.c | 18 +- include/linux/entry-common.h | 90 +++++++ include/linux/thread_info.h | 13 + kernel/entry/common.c | 37 +-- 13 files changed, 395 insertions(+), 436 deletions(-) create mode 100644 arch/arm64/include/asm/entry-common.h