From patchwork Wed May 17 21:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13245728 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 ED275C7EE23 for ; Wed, 17 May 2023 21:28:43 +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: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:In-Reply-To:References: List-Owner; bh=d9L4W8hF7MksJf8izUaob+7/PkhO/SZCkRJlEUWBg9g=; b=xBwXsgh/RrtZFn n/blFgZGUJhv/ngbaw4Km9yZ4s9mkc8U6ceXGkd+zgFkytV4gyevFkMt/OjayMhz4i08OEcKmPLYJ RshXvhfuGyPm8gYbZ19JqO1BjKkRzmBS/+2I/In8vMtHeuhHdF6ulrwPruvd4BgKZiN7euSb+DA1e BhBHjd0EUhHzeESqs5SdNBj3Eha1Y/f9pMNTO81glpWD6sK03TPjmyv0Art4/4MY8G0O3SzVo5oTv 2B5iffVONsLJiI6wRr/wSFY4zsFr24D7Mb7CNq2U88rfK7cVaYs6BScUGZ/MAwW5/wjDCeyVbVqyF 4iI9OTI3m1t/ItFMbHpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzOh1-00B6q6-17; Wed, 17 May 2023 21:28:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzOgy-00B6pL-38 for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 21:28:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 81B1F61538; Wed, 17 May 2023 21:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829A9C433EF; Wed, 17 May 2023 21:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684358895; bh=TNfpgbv+EcxVoAwd3sKYsrvlsAuQvO2qME1Uaj4BNfE=; h=From:To:Cc:Subject:Date:From; b=Q31zmZid1u+CiduEjFLwsNlHOqrWt75DZYC7ut+iNruhygW+5DVqrqHFKZGJGKc3f g6Gn8BBI4V6CEziQzK6VWltMSlyx76LQ//t779zXiudy+UF0nsNVJB+j11bhzRGkfx YAjyW2WG664ZXPAXVJGX9zLthfka2lursdTE5qedjzKvOFaxGb40Da2ozgzMLVhbwC hfzvii/FjawxouwmousCpLQMTWbmdpO8H8Tevl9d+Grz/8PtJPtkAX89s0Yjgi5T6+ 6b2tD2XpT8LPKFgd4X/pOZ1SfRX/qF5EucH/U+K3scWK3LG0DSQcMLd6+asb3lRHTD RKo3eTZgi/sFQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Linus Walleij , Arnd Bergmann , Russell King , Nicolas Pitre Subject: [PATCH v2 0/8] ARM: vfp: Reimplement dispatch and support logic in C Date: Wed, 17 May 2023 23:28:00 +0200 Message-Id: <20230517212808.3895190-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3197; i=ardb@kernel.org; h=from:subject; bh=TNfpgbv+EcxVoAwd3sKYsrvlsAuQvO2qME1Uaj4BNfE=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JISXV7d6x/jObfF9+k7BScGcNy1h2/+akBawhJypOPytmF 0tTlmvqKGVhEONgkBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABNZxszIcMDUn1vw6PNc43lP /Sco7TerDloltOvGbLc2jpDVLNb+hxkZziryTRZbuLwyfsuZzSy+gkmGhrPv6gQ8jH64Svq9fWE vJwA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230517_142817_091963_7385E0DB X-CRM114-Status: GOOD ( 21.11 ) 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 is a follow-up to [0] 'ARM: vfp: Switch to C API to en/disable softirqs', which fixed some issues introduced by a prior series of mine that relaxed the requirement for kernel mode NEON to only run in task context [1]. As it turns out, the VFP dispatch logic in the entry code as well as the VFP support code that triages the exceptions are good candidates for receiving the same treatment: we now have the undef_hook API for matching PSR values and opcodes, and the exceptions are all ultimately routed to C code anyway, now that we return via __local_bh_enable_ip() back to the caller. So most of this logic can be moved to C. So let's clean this up: reimplement the VFP handling in C code, so that we can get rid of most of the asm code that deals with this. Changes since v1: - rebase onto v6.4-rc2 - add Arnd's ack to #2 - fix issue in #7 regarding access to struct pt_regs to update the user PC - move residual FPE-only undef dispatch asm code to nwfpe/entry.S (#8) This v2 can be found at [2]. KernelCI test results for this version of the series can be found at [3]. Changes since [0]: - drop bogus patch 'fixing' the iWMMXT dispatch logic - add some acks from Nico and Linus - rip out even more asm code in patch #6 - there is no need to load the opcode from user space at all when entering in Thumb mode [0] https://lore.kernel.org/all/20230320131845.3138015-1-ardb@kernel.org/ [1] https://lore.kernel.org/all/20221207103936.2198407-1-ardb@kernel.org/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=arm-vfp-softirq-fixes [3] https://linux.kernelci.org/test/job/ardb/branch/for-kernelci/kernel/arm-vfp-refactor-for-rmk/ Cc: Linus Walleij Cc: Arnd Bergmann Cc: Russell King Cc: Nicolas Pitre Ard Biesheuvel (8): ARM: vfp: Record VFP bounces as perf emulation faults ARM: vfp: Remove workaround for Feroceon CPUs ARM: vfp: Reimplement VFP exception entry in C code ARM: kernel: Get rid of thread_info::used_cp[] array ARM: vfp: Use undef hook for handling VFP exceptions ARM: entry: Disregard Thumb undef exception in coproc dispatch ARM: iwmmxt: Use undef hook to enable coprocessor for task ARM: entry: Make asm coproc dispatch code NWFPE only arch/arm/include/asm/thread_info.h | 17 +- arch/arm/kernel/asm-offsets.c | 1 - arch/arm/kernel/entry-armv.S | 254 +------------------- arch/arm/kernel/iwmmxt.S | 18 +- arch/arm/kernel/pj4-cp0.c | 1 + arch/arm/kernel/process.c | 1 - arch/arm/kernel/ptrace.c | 2 - arch/arm/kernel/xscale-cp0.c | 1 + arch/arm/mm/proc-feroceon.S | 4 + arch/arm/nwfpe/entry.S | 77 ++++++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 31 --- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 208 ++-------------- arch/arm/vfp/vfpmodule.c | 208 +++++++++++----- 15 files changed, 286 insertions(+), 540 deletions(-) delete mode 100644 arch/arm/vfp/entry.S