From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EEB3C4320A for ; Fri, 30 Jul 2021 11:25:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C0A961050 for ; Fri, 30 Jul 2021 11:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238762AbhG3LZo (ORCPT ); Fri, 30 Jul 2021 07:25:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:36914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238745AbhG3LZg (ORCPT ); Fri, 30 Jul 2021 07:25:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 42F9C61042; Fri, 30 Jul 2021 11:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627644331; bh=41tFYtagGI1Lhiz3zWu2NlhWV1lTY0kbWv/RrqQ/NNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=txOI8EoYqTcyfYriEygEnpS9AUmzRS/hTVAMDDtPpJAOyk+pBnKsszcKdnWVETGKH RGxgHIhsmbHsRm/HBH3DtIZSKP90plIeYjtDiDFHw2FC6H0XQGNZUNC7F3RKsNBokF znlajlq4J94PvqVbJ1hJStn8e+7G5o5DpvBZAzJlsrWyw37a/ufBc7fGtTAogXuYTR AP4UAjopdDNR3KfKC7y1013aTpz2/QbALkTsI334N5DY3r4179mjP33AKFZEkKHEV4 w0TWsT82jr3z6oLc/lZaJPjWiSPuyntp28F2pzPlXvm8C9qq2Z3aNoZU3D22JVIG65 wP/YciuWaYtWw== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon , Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Daniel Bristot de Oliveira , Valentin Schneider , Mark Rutland , kernel-team@android.com Subject: [PATCH v11 10/16] arm64: Implement task_cpu_possible_mask() Date: Fri, 30 Jul 2021 12:24:37 +0100 Message-Id: <20210730112443.23245-11-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210730112443.23245-1-will@kernel.org> References: <20210730112443.23245-1-will@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide an implementation of task_cpu_possible_mask() so that we can prevent 64-bit-only cores being added to the 'cpus_mask' for compat tasks on systems with mismatched 32-bit support at EL0, Reviewed-by: Catalin Marinas Signed-off-by: Will Deacon --- arch/arm64/include/asm/mmu_context.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index eeb210997149..f4ba93d4ffeb 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -231,6 +231,19 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, update_saved_ttbr0(tsk, next); } +static inline const struct cpumask * +task_cpu_possible_mask(struct task_struct *p) +{ + if (!static_branch_unlikely(&arm64_mismatched_32bit_el0)) + return cpu_possible_mask; + + if (!is_compat_thread(task_thread_info(p))) + return cpu_possible_mask; + + return system_32bit_el0_cpumask(); +} +#define task_cpu_possible_mask task_cpu_possible_mask + void verify_cpu_asid_bits(void); void post_ttbr_update_workaround(void); -- 2.32.0.402.g57bb445576-goog