Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1866421rwb; Fri, 19 Aug 2022 10:41:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ieqfyQS2Tb/20oqG76i0HlbXgPe/xlZU+6nG9i30YI1ttqgxhTN3MpZhSVQ/fJoBb35er X-Received: by 2002:a17:902:dac4:b0:170:d34b:9100 with SMTP id q4-20020a170902dac400b00170d34b9100mr8535780plx.166.1660930893396; Fri, 19 Aug 2022 10:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930893; cv=none; d=google.com; s=arc-20160816; b=I6oWgXhyp2tvFNv4N4wCk6z6UON35b113M0YEdry81nTs16ln99yWSs+Gh6EvpTujZ VQrLKfClsHbWYBqyIgHHP/Fbu7F/a9jkneGTkeh8WyKLYqTdQIkxC4L+1Bm0EussGWW1 FLPGPN1uvA9nPQbRU+Hg1wTj97LbJi5T/2XjZfJRuXEzQNkhcUrziqJ5DwjgYBuJArsf RZH8nhKULcqZJyDS7ur18iClRLbADADMGbDbYZZ3dJB8G1XijFWrpK2kKUfzkr1e0Ctd KOixMX5X28zjpW4AeEsP1nYQ+syob7Uidjuc20n2EA15IWF/vCnnssy8OLbJFKrC1SOU otXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t9xDEo8bMaANghKURg7cdfWgOIutAKpfng21YQo7UkI=; b=GOUVjoY3AYY8YgaCdOVZh6SuLN/VN8cCEZNE4qe8qY4LCjSRYinFlXTTfmMW7LWW+w 1mOhVQYCtPXesvPuQjwQo+4xbLNUYpJklL0LzROW6fnc/HkBZB55DPcoaa1oO0r6hHi6 EiHR1I67cdL6/Djfsx7dGEOplfS107RQkdgGDv+CSeP0olQbNi15zfSCln4eInIV74Jp 3xGp6AtJiANo2OKMMqIsK6aW1gjBt89J5BvDMkeSQgJ0BBzlcbiz3fKGGra8MvBOnST9 OCAp5fSNp9qkevFaDV1VWts6awaEw3XSW5637ebzZZjGOPJFA3MX2AJsRw/R44WZyeSk SCEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a8iMhUpX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jm12-20020a17090304cc00b00158643c240asi4264802plb.87.2022.08.19.10.41.22; Fri, 19 Aug 2022 10:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a8iMhUpX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351290AbiHSQEs (ORCPT + 99 others); Fri, 19 Aug 2022 12:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351415AbiHSQBf (ORCPT ); Fri, 19 Aug 2022 12:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07C56647C8; Fri, 19 Aug 2022 08:53:22 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 12C4461767; Fri, 19 Aug 2022 15:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A5B1C433D6; Fri, 19 Aug 2022 15:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924382; bh=kFCMjgGG9L4dx69d+8a8KmsN8u+ngZyXC7hm+vH0Gk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a8iMhUpXnVY2wbcGaOw9BhkZEoue0gF3Z8riKIbQjPZs65jGxrgtgSZKL//n2P/kp VHhJSoKbstqHJnTdqJOq+cgYpULmCYaNDWqcxLsCU3wxJQr+rfVxsyjYAV6oZ9aqjO fFAPRVB43dZz0C0OTxCV21UHwJkhVOjmlQv9ZP8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Will Deacon , Sasha Levin Subject: [PATCH 5.10 122/545] arm64: cpufeature: Allow different PMU versions in ID_DFR0_EL1 Date: Fri, 19 Aug 2022 17:38:12 +0200 Message-Id: <20220819153834.755575719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandru Elisei [ Upstream commit 506506cad3947b942425b119ffa2b06715d5d804 ] Commit b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in PMU implementations") made it possible to run Linux on a machine with PMUs with different versions without tainting the kernel. The patch relaxed the restriction only for the ID_AA64DFR0_EL1.PMUVer field, and missed doing the same for ID_DFR0_EL1.PerfMon , which also reports the PMU version, but for the AArch32 state. For example, with Linux running on two clusters with different PMU versions, the kernel is tainted when bringing up secondaries with the following message: [ 0.097027] smp: Bringing up secondary CPUs ... [..] [ 0.142805] Detected PIPT I-cache on CPU4 [ 0.142805] CPU features: SANITY CHECK: Unexpected variation in SYS_ID_DFR0_EL1. Boot CPU: 0x00000004011088, CPU4: 0x00000005011088 [ 0.143555] CPU features: Unsupported CPU feature variation detected. [ 0.143702] GICv3: CPU4: found redistributor 10000 region 0:0x000000002f180000 [ 0.143702] GICv3: CPU4: using allocated LPI pending table @0x00000008800d0000 [ 0.144888] CPU4: Booted secondary processor 0x0000010000 [0x410fd0f0] The boot CPU implements FEAT_PMUv3p1 (ID_DFR0_EL1.PerfMon, bits 27:24, is 0b0100), but CPU4, part of the other cluster, implements FEAT_PMUv3p4 (ID_DFR0_EL1.PerfMon = 0b0101). Treat the PerfMon field as FTR_NONSTRICT and FTR_EXACT to pass the sanity check and to match how PMUVer is treated for the 64bit ID register. Fixes: b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in PMU implementations") Signed-off-by: Alexandru Elisei Link: https://lore.kernel.org/r/20220617111332.203061-1-alexandru.elisei@arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index c9108ed40645..4087e2d1f39e 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -508,7 +508,7 @@ static const struct arm64_ftr_bits ftr_id_pfr2[] = { static const struct arm64_ftr_bits ftr_id_dfr0[] = { /* [31:28] TraceFilt */ - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_PERFMON_SHIFT, 4, 0xf), + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_EXACT, ID_DFR0_PERFMON_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MPROFDBG_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MMAPTRC_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_COPTRC_SHIFT, 4, 0), -- 2.35.1