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.4 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,USER_AGENT_GIT autolearn=ham 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 B9A23C433B4 for ; Tue, 18 May 2021 09:49:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B703613F2 for ; Tue, 18 May 2021 09:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348216AbhERJun (ORCPT ); Tue, 18 May 2021 05:50:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:50466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242266AbhERJt4 (ORCPT ); Tue, 18 May 2021 05:49:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADD1F613F6; Tue, 18 May 2021 09:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621331314; bh=Dh/Va0X09dy++LO+W/9hE+3xOUtyUgHSE0+ZKx7G1GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AD3ZY9USRC7qBSNI+UlwJXnlO/hP51HMdwLExYlkSvChWUqzEezJD+4JY1iVaG3fn 0ck3hG27/ib9mDAvXmOuRnlC/QinvFDCdlolRh5L/grcfifI5uIm3n3pZXFrQL5hgG pLxQYytpQIS2wXxEka1hruQPbIRjtzlbtcdrXk4C4Z9PdTv985Utk/PHwrv1s5r3za XoZ0+WvsoDD2k8Ak1Ug1m1HwsCrS5WnqogmKBgQK+w4lThzaQWmfxSz000knyS7msW 0OmfLkLhtvSdih0E6Q1zfjT4wTHBgtW7ZXDzYG+MG1M4Dw0LnSa548pKHVlGD5VJ+f +5LlMTJ7h9ZzQ== 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 , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , kernel-team@android.com Subject: [PATCH v6 16/21] arm64: Implement task_cpu_possible_mask() Date: Tue, 18 May 2021 10:47:20 +0100 Message-Id: <20210518094725.7701-17-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210518094725.7701-1-will@kernel.org> References: <20210518094725.7701-1-will@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arch@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, 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 d3cef9133539..bb9b7510f334 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.31.1.751.gd2f1c929bd-goog