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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 D2756C433DB for ; Wed, 17 Feb 2021 01:32:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 59B5564E2F for ; Wed, 17 Feb 2021 01:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59B5564E2F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=uD7TvyQnFSE9Iw0ffcyw3Ulch5DWEKJE4yMPxjLejkM=; b=xcO/IzP+Pm5snvsx0rH9mUZnSB oXF1KsZ2RtZgDn0VhBiZeJkLt/cReU2AbGBiWKB9pKJqh70nSKBB0ME3FVb29cMyNetEgb1ge7hc3 /Pa2Ds+AD7IJaZH17nNkIP8rGM4oFl6i9FS6Y1+XalwZJjtImIWaHu3ibdnHLrWAzKEmAqwM8KFaO gwbT8QyeRASQK5jiz1V5k9bv3a+6eqI9HpulIHxfmn8OrXKEwtEmx3CIMjnUkTEduPPCbYexdJ2YU ApR8gjHfEzHL+lpKGyyFF0WPsZZFCu6SGeDCqsEinSAnKLCdUQYnYQMDuI5OlAt9jBG4WIjFH5QuX j7FHoIrw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCBga-0006JT-SI; Wed, 17 Feb 2021 01:31:24 +0000 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCBgY-0006Ix-FR for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 01:31:23 +0000 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 16 Feb 2021 17:31:15 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Feb 2021 01:31:12 +0000 Received: from rwileyLinux.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 17 Feb 2021 01:31:12 +0000 From: Rich Wiley To: , Subject: [PATCH] arm64: kernel: disable CNP on Carmel Date: Tue, 16 Feb 2021 17:31:51 -0800 Message-ID: <20210217013151.30351-1-rwiley@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1613525475; bh=vFumZehipkgsWxwPkxqL+hswhRWqU2xj5gjNEyJejOI=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Type; b=HPwEDZTwuvL1FUed+FHKg5VlJNDU/d6c+T6x83c9nYqTTqcePN7md2gfXJCyhjs8N w7qc7yHs4fdKc8WybwzSUV2P5YpCgeP1aUHZSrwgxZgvh+HNI1NWD6NFjoaxIGF0qD LAPS0nU+5nc+NNe3yH+TIp67ga4HVEe/sLpp75DaY48CSatZOcYENHHfEcoO+ei/RJ wbI5Y6AReKCKf+YWW7rhD8pzloMqSOdFk1WDnJBuse2N66MzAthwS2lCJ5RAVLPNR0 ke3bsxouhysRSRhdVTlFGQZfgYASyazcGOb4El2jNT53PZIA9Sa3XVe8sNO7eSJqnA SWuC9Wy+w/gHw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210216_203122_630347_921AC71B X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Wiley , linux-arm-kernel@lists.infradead.org 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 On NVIDIA Carmel cores, CNP behaves differently than it does on standard ARM cores. On Carmel, if two cores have CNP enabled and share an L2 TLB entry created by core0 for a specific ASID, a non-shareable TLBI from core1 may still see the shared entry. On standard ARM cores, that TLBI will invalidate the shared entry as well. This causes issues with patchsets that attempt to do local TLBIs based on cpumasks instead of broadcast TLBIs. Avoid these issues by disabling CNP support for NVIDIA Carmel cores. Signed-off-by: Rich Wiley --- arch/arm64/kernel/cpufeature.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 9fac745aa7bb..2aa38a430f6a 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -986,6 +986,12 @@ static bool has_cache_dic(const struct arm64_cpu_capabilities *entry, return ctr & BIT(CTR_DIC_SHIFT); } +static bool cpu_has_broken_cnp(void) +{ + const struct midr_range range = MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL); + return is_midr_in_range(read_cpuid_id(), &range); +} + static bool __maybe_unused has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) { @@ -994,7 +1000,10 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) * may share TLB entries with a CPU stuck in the crashed * kernel. */ - if (is_kdump_kernel()) + if (is_kdump_kernel()) + return false; + + if (cpu_has_broken_cnp()) return false; return has_cpuid_feature(entry, scope); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel