Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2865714rwb; Mon, 15 Aug 2022 12:55:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5XL1A7g1iGv0SOl7iB+7xn/cMErZAv45vmL16QZXtj9Bq/W5t8O7Q1cZilhQoBoMr/nfUm X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr16246559eda.134.1660593306460; Mon, 15 Aug 2022 12:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593306; cv=none; d=google.com; s=arc-20160816; b=F7tpgvKd/AluJeXxGtlHU/TnmvFXbVNBzbzI13Ho/YexswXYvGttPMS2a63H4ONl9e fY+euk0CgecGgPQzOWHLY6KQvO5MTNf6cZWo67Lg/cu/gGppM/ZkiK2kWWXCAY+nIDel oQ3sbjaOrELcJ8fBXLKfrY4y4kHkuYwHB9rGqtgRdokopsts4t/OjqKtawK1BH09GQhE 7AYslf2b8/C1KUM2kDrggmS4YXd0K7TMoONVEU2PaS5DwLLakccyQYafzxO2WvwMf/iR FOuCDyKtIb/bnImOjfNfpS1sgmtfaDoD3ItV7QG2o8Nvmb9QRWBVK+Cn/oija0nE93du 5uUA== 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=qJU0kJ4iqRDJogE7jMricg2ygpUrBH9x5tzpfvbA9DE=; b=PaPv9y7GKf5VN+S65bbUwWjt9Sf95vNe2QVxe+O6xpxMCEFCsKieUEltLy10gmFVxC YTAhY8+j9LXYG1trqZFTc/IVmdZgIUfqHXPVMY6v37OYr+GUZCZSt3ZS7ZosOSRzJLT5 vMbiqXSKnpftU57gmuR27rgY6RANIxuDMHdTECg6feAYPuK71kQtZUNQjBHmyg+WgmKX HAy7d66aKaBD3VcCdqiUwvmj6Wcw3TbxORTnk/mBQlDCN/A6S5g+H60JUTfFCqMtzsUN gdQnUiFTjz4Nr5l9u9S+HjQjq/Lo5jCoQc/nxUVobLBBLFq1SWYdwj+Xm+HbhfAm9VLe Ts3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZlLbJGjh; 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 o22-20020a170906975600b007384c1db86fsi3322419ejy.60.2022.08.15.12.54.40; Mon, 15 Aug 2022 12:55:06 -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=ZlLbJGjh; 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 S243643AbiHOSed (ORCPT + 99 others); Mon, 15 Aug 2022 14:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243645AbiHOSeD (ORCPT ); Mon, 15 Aug 2022 14:34:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4C9137FB7; Mon, 15 Aug 2022 11:22:05 -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 68B9A60BE9; Mon, 15 Aug 2022 18:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD18C433C1; Mon, 15 Aug 2022 18:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587723; bh=xkDeGgrBP1lMuy0ZuJSezWTUfVMP7+8pc66PNFfSDzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlLbJGjh2+3AHsEfDFQtkLkEqZNVTG5UfFnleNjrFTTdloXxxDqo8rMjWzyjQpSNL Dq4XGKsMTHNOqFPCyfLdPlt6JbIcb4ggNb6Rmy2kRcrZ6xchrbc51zJkefUhiTsMPv zhfGlknewTwM10aOIUoc9nU4LE6rTTSjXPUtnKG4= 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.15 174/779] arm64: cpufeature: Allow different PMU versions in ID_DFR0_EL1 Date: Mon, 15 Aug 2022 19:56:58 +0200 Message-Id: <20220815180344.722563582@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 e71c9cfb46e8..474aa55c2f68 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -536,7 +536,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