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.2 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 709EBC47082 for ; Tue, 8 Jun 2021 18:04:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56EEA61377 for ; Tue, 8 Jun 2021 18:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234155AbhFHSGh (ORCPT ); Tue, 8 Jun 2021 14:06:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:46090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbhFHSGR (ORCPT ); Tue, 8 Jun 2021 14:06:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C735F613AD; Tue, 8 Jun 2021 18:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623175464; bh=lPiqbs5bNC1XfYw4dGVM5dcp8Q2l9mwJXLtvvoVPjzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcFi8tJUutu2sOKFQVYjW9TDRUXI/6EViDXQi702e0oFa7sApRuStLB8xf0+b6XFI SWif8+5Pl6+5zaUPyIX/0rlKmnRR2Yh5/YwcHnOfNI0cnYYiWYgOOZeXQ/s1tlj50z XNeW34/HxfaLA3ltavhnXlDD0i5/GUwZa6Af7zAyMA0wuUsWxXZceUY598h2vYWoZL ATtrKrghZ9fwYiNAHEuwBqGjddKugAryb4wDvmRTj6a83pPQcTZIUHhQ62EVxqMd8J SYFyNqr3dxytQps/M4rIuDrppJUpo0XW3uRCqvx+tTUwDQwBG4vN/BakD4FhLBgIOM 0QXbIn80az/DQ== 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 v9 14/20] arm64: Implement task_cpu_possible_mask() Date: Tue, 8 Jun 2021 19:03:07 +0100 Message-Id: <20210608180313.11502-15-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210608180313.11502-1-will@kernel.org> References: <20210608180313.11502-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 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.32.0.rc1.229.g3e70b5a671-goog 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 0B90CC47082 for ; Tue, 8 Jun 2021 18:17:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C84E461246 for ; Tue, 8 Jun 2021 18:17:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C84E461246 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=0k7OMs8gqk38x2oLmAZeSn/xjBWqIjKoHsU836gb/AM=; b=4YDS40vMURzBUh x15KFs+fMhrccj3v+XN+sTxpMdTGPrM77ouj3Gr2qET6DkW2h2rwuwyl9HGd3XqrNdkMdv3q/BaaG 6XVmz7aWiKa2f9Gi2Q7+NX3z79IGuYtTnDVGXNrcf60YbeH2mxyBslD8LrV1nN1tGywgoNWA83ofv w2F00veytXbl9/u/blpJ33ow5CeKAR145gpPB3t/CLnUUz3f25Gf6PTIJI5J4DvugklhzXhK5Ka+n 4neLgjtUBcjgwiCJx5afuQ4kzreUiDQcmeQCxaAucXVd7W+um5u/cBtETDrw1goFBXVQKtR6GUphz RKzVGiDofucghka9bqRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqgFZ-009vdK-L9; Tue, 08 Jun 2021 18:14:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqg5Q-009r6l-MU for linux-arm-kernel@lists.infradead.org; Tue, 08 Jun 2021 18:04:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C735F613AD; Tue, 8 Jun 2021 18:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623175464; bh=lPiqbs5bNC1XfYw4dGVM5dcp8Q2l9mwJXLtvvoVPjzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcFi8tJUutu2sOKFQVYjW9TDRUXI/6EViDXQi702e0oFa7sApRuStLB8xf0+b6XFI SWif8+5Pl6+5zaUPyIX/0rlKmnRR2Yh5/YwcHnOfNI0cnYYiWYgOOZeXQ/s1tlj50z XNeW34/HxfaLA3ltavhnXlDD0i5/GUwZa6Af7zAyMA0wuUsWxXZceUY598h2vYWoZL ATtrKrghZ9fwYiNAHEuwBqGjddKugAryb4wDvmRTj6a83pPQcTZIUHhQ62EVxqMd8J SYFyNqr3dxytQps/M4rIuDrppJUpo0XW3uRCqvx+tTUwDQwBG4vN/BakD4FhLBgIOM 0QXbIn80az/DQ== 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 v9 14/20] arm64: Implement task_cpu_possible_mask() Date: Tue, 8 Jun 2021 19:03:07 +0100 Message-Id: <20210608180313.11502-15-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210608180313.11502-1-will@kernel.org> References: <20210608180313.11502-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210608_110424_808487_2C847C03 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 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.32.0.rc1.229.g3e70b5a671-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel