From patchwork Mon Mar 20 13:18:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13181223 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 61DFFC7618A for ; Mon, 20 Mar 2023 13:20:02 +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:References:In-Reply-To: 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: List-Owner; bh=UbcArv01dMNyziROop+WehQtsSnBXE9bPU5JcBdoE/k=; b=BGbcoHjDfgQtN/ phggsQPy9nFvupH1eRTtLdi7Y+KgPrZnGR9/x54EBEpKjBebbghMFKP5U+fhYW/wJqWKhqsRKjmVL arbHUReqCi88rQXVANV9hAZAb6xAyN44fesXoXw0sC0G/84Ovk1+1kl2jaiBWtBAuZbSSYSvteeOS Th8UtZS401qpmfZy2aYilYEZCjDl7gWQkz987Ieo7gr8+Lgym8QvcNr5N3W76ILtsdQi6ccxQic7W QF3K6HlPy5NbUKDjH6KsVnyizIM95V/l5AvkGfTf1cE9f/OMnyTslHY98dSLJQUVY9wlBBCnCgH2H gHezYGVxDKZq2LUB7wQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peFPl-0095rS-13; Mon, 20 Mar 2023 13:19:05 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peFPd-0095mT-1h for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 13:18:59 +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 ams.source.kernel.org (Postfix) with ESMTPS id 106E8B80E78; Mon, 20 Mar 2023 13:18:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28948C4339B; Mon, 20 Mar 2023 13:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679318334; bh=ApwpSuQ/0LynuxzoaJbNQOuNWmQBjXXMoHzayRWE/TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2FUm9lLeEoj0kTuQ4WJXHrWSc8tjpl2bXlNc44Yf0qDPeump+BBIc59bchlg8O4v Ce2RsiPYA0WjWZRDsMy0lqGNFKlx1TzpAXKdk9Z+G3l+nkZIUTSnAFP9JVIPi1i5U6 yzkMmEmzKLLhLif2pXtL+6RRu9w7OWSYrksv5vDsQkPXRtNl5SW06vdjDtRdq2MvVn GW/TFdjSMOdnfnvwMMb6NEVFUyKRHMrEPT3B3dpfzh12ydZIm5u208x6s4U7xV1+PP nCpHzh0GMyrCklM/USxuXl5OEHRDFvBelY0ubDB8I2X+M1JkmG8Rz/eEwytTsE/0pg +gAQm+b5JQa4w== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Frederic Weisbecker , Guenter Roeck , Peter Zijlstra , Linus Walleij , Arnd Bergmann Subject: [PATCH v4 01/12] ARM: vfp: Pass thread_info pointer to vfp_support_entry Date: Mon, 20 Mar 2023 14:18:34 +0100 Message-Id: <20230320131845.3138015-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230320131845.3138015-1-ardb@kernel.org> References: <20230320131845.3138015-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2469; i=ardb@kernel.org; h=from:subject; bh=ApwpSuQ/0LynuxzoaJbNQOuNWmQBjXXMoHzayRWE/TI=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUUiVvXtEjHF9Rn6KiFZ6/ksJI2nRDDckbK1cLM2WRz8s X/7bbGOUhYGMQ4GWTFFFoHZf9/tPD1RqtZ5lizMHFYmkCEMXJwCMJE2EUaGE2KPrnE+aFzz3NKw 7vHF6ZWnXhzXvi69tVblx4GamdMb6hkZXm2rVeO0yyyz5lP2j5K90Kn2Skt4ptM63ikXePf+TT7 MDgA= 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-20230320_061857_850430_FF27E366 X-CRM114-Status: GOOD ( 15.17 ) 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 Instead of dereferencing thread_info in do_vfp, pass the thread_info pointer to vfp_support_entry via R1. That way, we only use a single caller save register, which makes it easier to convert do_vfp to C code in a subsequent patch. Note that, unlike the CPU number, which can change due to preemption, passing the thread_info pointer can safely be done with preemption enabled. Signed-off-by: Ard Biesheuvel Reviewed-by: Linus Walleij Tested-by: Guenter Roeck --- arch/arm/vfp/entry.S | 5 +---- arch/arm/vfp/vfphw.S | 10 +++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S index 9a89264cdcc0b46e..cfedc2a3dbd68f1c 100644 --- a/arch/arm/vfp/entry.S +++ b/arch/arm/vfp/entry.S @@ -22,15 +22,12 @@ @ IRQs enabled. @ ENTRY(do_vfp) - local_bh_disable r10, r4 + mov r1, r10 ldr r4, .LCvfp - ldr r11, [r10, #TI_CPU] @ CPU number - add r10, r10, #TI_VFPSTATE @ r10 = workspace ldr pc, [r4] @ call VFP entry point ENDPROC(do_vfp) ENTRY(vfp_null_entry) - local_bh_enable_ti r10, r4 ret lr ENDPROC(vfp_null_entry) diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S index 26c4f61ecfa39638..6d056d810e4868c2 100644 --- a/arch/arm/vfp/vfphw.S +++ b/arch/arm/vfp/vfphw.S @@ -6,9 +6,9 @@ * Written by Deep Blue Solutions Limited. * * This code is called from the kernel's undefined instruction trap. + * r1 holds the thread_info pointer * r9 holds the return address for successful handling. * lr holds the return address for unrecognised instructions. - * r10 points at the start of the private FP workspace in the thread structure * sp points to a struct pt_regs (as defined in include/asm/proc/ptrace.h) */ #include @@ -69,13 +69,17 @@ @ VFP hardware support entry point. @ @ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) +@ r1 = thread_info pointer @ r2 = PC value to resume execution after successful emulation @ r9 = normal "successful" return address -@ r10 = vfp_state union -@ r11 = CPU number @ lr = unrecognised instruction return address @ IRQs enabled. ENTRY(vfp_support_entry) + local_bh_disable r1, r4 + + ldr r11, [r1, #TI_CPU] @ CPU number + add r10, r1, #TI_VFPSTATE @ r10 = workspace + DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10 .fpu vfpv2