From patchwork Mon Mar 20 13:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13181228 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 1C4A8C7618A for ; Mon, 20 Mar 2023 13:20:42 +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=xdsWL/dXmGQEBKoDpjIi9pHXnklzQMNiTQ/mQjuZkio=; b=MsEUTOEdsMatXT MUZ4SRJ4eAgmPr8A3eiilnpdKKIAIiw+b5T86hvLlS6DGZN9162/aleqUAmb+RR/YySG+ycuLDa/g JjdvLxsv4+SH9sZnVRy+VaYmcm5ryIsjFo0D7S5iQrq/g0MmNyreRdv5dX2/ViW8WEyytZTBxyrku C+Qu8WTbXHhhUQIHrkRWmqkzXWTx+82RRzRG6WqwMTUV2pGM4Ypt2b88ATC17DZcYWJZkGO9zE+OC lX7Npg7926UHnkYwKaucqGRi7fdKyFI15/O3bmDOcdck6GPBMil2oX9DORPoU8Pme6Fuqsr/+Jj2i i/L4rpvl7oI0iwcNMLjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peFQM-0096Do-1m; Mon, 20 Mar 2023 13:19:42 +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 1peFPr-0095vX-2I for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 13:19:13 +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 74483B80E6D; Mon, 20 Mar 2023 13:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DFD2C4339C; Mon, 20 Mar 2023 13:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679318349; bh=8qUup/kWaWCYkXvRr9alWQulFfukffOliz5upfTrqYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lR5HmehDllb6B/Gg0ExIXqhbb9lMuchfvkWl0F6e4B865RHE8zLUPu9ZaHw8+U203 HQg9BShJBrOW6kFdIEMVpBNH/0Z5QBympFbx5u2lxEvW8oi/0D8Zvaltu8mNg19QwL kiQJa62/rreGA24jTVTQvqR4/Oox90UOruSB266yM7/JULVrEFuJiGgpu82gZGFJS7 X5CV8D3Edmh6sVNM9yNu5M+fd1z03jwQ2Gx48tQA+LcfIONv86kHBS7FZJW1YUsFSw TH/GT6LP+UZp3CvFs44+3GN7UImd6f4Bn0awVlH6cZhfM84hG2qv6lPQQN2p2tvV6J YAzXN5Co++kWw== 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 08/12] ARM: kernel: Get rid of thread_info::used_cp[] array Date: Mon, 20 Mar 2023 14:18:41 +0100 Message-Id: <20230320131845.3138015-9-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=3540; i=ardb@kernel.org; h=from:subject; bh=8qUup/kWaWCYkXvRr9alWQulFfukffOliz5upfTrqYc=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUUiVv/JpBkPLXa8eWq926iT//6Lv02ndCW36k4L7Z3Wx THdexVXRykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZiIyQZGhv1S6z72Mu54/2WW iGqqb1/OlJ5o9fm+lWfnr0rvOhZ+aDHDP90PxVPPfUlNeCd43D1u9V+RDkcp3eNOzEmyDz5uVFi vxAgA 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_061912_060838_E82CD031 X-CRM114-Status: GOOD ( 15.97 ) 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 We keep track of which coprocessor triggered a fault in the used_cp[] array in thread_info, but this data is never used anywhere. So let's remove it. Signed-off-by: Ard Biesheuvel Reviewed-by: Linus Walleij --- arch/arm/include/asm/thread_info.h | 1 - arch/arm/kernel/asm-offsets.c | 1 - arch/arm/kernel/entry-armv.S | 6 ------ arch/arm/kernel/process.c | 1 - arch/arm/kernel/ptrace.c | 2 -- 5 files changed, 11 deletions(-) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 7f092cb55a417154..85c5f1e02ebf83ca 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -66,7 +66,6 @@ struct thread_info { __u32 cpu_domain; /* cpu domain */ struct cpu_context_save cpu_context; /* cpu context */ __u32 abi_syscall; /* ABI type and syscall nr */ - __u8 used_cp[16]; /* thread used copro */ unsigned long tp_value[2]; /* TLS registers */ union fp_state fpstate __attribute__((aligned(8))); union vfp_state vfpstate; diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 38121c59cbc26cdd..f9c7111c1d65ffda 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -47,7 +47,6 @@ int main(void) DEFINE(TI_CPU_DOMAIN, offsetof(struct thread_info, cpu_domain)); DEFINE(TI_CPU_SAVE, offsetof(struct thread_info, cpu_context)); DEFINE(TI_ABI_SYSCALL, offsetof(struct thread_info, abi_syscall)); - DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp)); DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value)); DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate)); #ifdef CONFIG_VFP diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index c5d2f07994fb0d87..cae8e31ce2cbde41 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -591,9 +591,6 @@ call_fpe: and r8, r0, r5 cmp r8, r7 @ NEON instruction? bne 2b - mov r7, #1 - strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used - strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used b do_vfp @ let VFP handler handle this 1: #endif @@ -601,9 +598,6 @@ call_fpe: tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 reteq lr and r8, r0, #0x00000f00 @ mask out CP number - mov r7, #1 - add r6, r10, r8, lsr #8 @ add used_cp[] array offset first - strb r7, [r6, #TI_USED_CP] @ set appropriate used_cp[] #ifdef CONFIG_IWMMXT @ Test if we need to give access to iWMMXt coprocessors tst r8, #0xe << 8 @ CP 0 or 1? diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index f811733a8fc574b4..343451cab8c4f5df 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -223,7 +223,6 @@ void flush_thread(void) flush_ptrace_hw_breakpoint(tsk); - memset(thread->used_cp, 0, sizeof(thread->used_cp)); memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); memset(&thread->fpstate, 0, sizeof(union fp_state)); diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 2d8e2516906b6b4a..2b945b9bd36624a9 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -584,8 +584,6 @@ static int fpa_set(struct task_struct *target, { struct thread_info *thread = task_thread_info(target); - thread->used_cp[1] = thread->used_cp[2] = 1; - return user_regset_copyin(&pos, &count, &kbuf, &ubuf, &thread->fpstate, 0, sizeof(struct user_fp));