From patchwork Mon May 8 14:02:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 91166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2186101vqo; Mon, 8 May 2023 07:10:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6uTD//rYNYzzV6USG+vinV1lsY6s0hiuB8rpOSi57w5qS9f9TjadnX9B760+syYVNSY2vv X-Received: by 2002:a17:90a:5e45:b0:24b:af7d:201d with SMTP id u5-20020a17090a5e4500b0024baf7d201dmr11021164pji.24.1683555048698; Mon, 08 May 2023 07:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683555048; cv=none; d=google.com; s=arc-20160816; b=AjXnnZKZ2hnOka9gecji+RJa9vSPJhvGDRqZdE6xG7SZVPiPiAqOw3C59cGaSk16G7 A1QmkYWFbLkeJoDbDFAKqmfITdvoEb5fT9LRk9CCHNYsapS7SvIhSQTKgNH+hvgLBSga TdZ0N1Sex4fkJlUtM2VQF4o5M1487UehC9nimEr/WbyD9mIP+/hlbKfsmnrXMboL3SOB +2ip2QJbSLhNGaHlgNzcs9K1AMzL5VQ81R+fffvhyOK3/TD+ldO2mnw22DuG5r5V2E+G oQvhVGQi1SIdIURfwqVIJL/Qtg1x+uDW4VitANRsBGS7SACrLgkiSt5s1ZXJVQboVVQp F7Sg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qJQOBxcz33khfM/wZ7bdTEFMrlbiVqBaGY9/zqdt6O4=; b=rOA1eh4T5CTG0ovr0FA4xIFZPsGBZVafgrj6UhBi9EEqnN9oVG6HCmeczIP6OwakZ2 hdZQEGkf0pyXWjiiX6mb4g0w4lZAwJeVpPMccEqu6B8BdTtx+mdg1GutA3d/H+4qIztZ r0omEp4vO2/kta+GXjchCkVPu1/mueYxkak9LzZWXrQPCtCNzl6geswW870OktWRroSy I3gHAR9kuNMoVN/GgGMQB5TAoTF0pQjQev9ASE0UB1DUU/lgvgpJeI3iGtcwjnH+Kkle iDowLVRWq1bdaD2DRKppjpdc9DPFxcwNjh2haGNBU3QTJxNhfjPK/U6EesXVLza4tzD6 j2XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ffXIdpk1; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb9-20020a17090b4a4900b00240ad93edfesi27120011pjb.5.2023.05.08.07.10.32; Mon, 08 May 2023 07:10:48 -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=@intel.com header.s=Intel header.b=ffXIdpk1; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234281AbjEHOFQ (ORCPT + 99 others); Mon, 8 May 2023 10:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234391AbjEHOFM (ORCPT ); Mon, 8 May 2023 10:05:12 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C943F37614; Mon, 8 May 2023 07:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683554708; x=1715090708; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qlDZfq7uid8IZb7yp4+EwtFKj9HOPvC6s9A1HOrf+9U=; b=ffXIdpk1Zsk3MxarVE6DSmW1Dlk3foNTsXq6AU4ThnAJmh4oW+n5U9s8 osyaBokICcmfjLUbAKw/VQzdcqrUvAmt6jsIbPfyWnzcpWFLlEP2UfVX+ 5CfHZeZLdbQK2hvW2pFSRMgJnTO/PfIoJmR7jHE95a9H1SQMNOXq7ft3l cDqr/JFXRc2th+xEOe/MMPE8TsGCow36lFwH2mzAUTShJZ5hmQV3iRPhG et07PqQXauq/bkZl7SSZ81zBI9uvgSrKnm1FhuJKelUjsa2AS3gye5McF XKC53Jg0woia/vCkygeNKmQd5hQinuTmqYq4BBJdDmb1fHfHKMGqdGmvE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10703"; a="338877301" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="338877301" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 07:02:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10703"; a="763407449" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="763407449" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga008.fm.intel.com with ESMTP; 08 May 2023 07:02:55 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, Kan Liang , Stephane Eranian , stable@vger.kernel.org Subject: [PATCH] perf/x86/uncore: Correct the number of CHAs on SPR Date: Mon, 8 May 2023 07:02:06 -0700 Message-Id: <20230508140206.283708-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765335418525827167?= X-GMAIL-MSGID: =?utf-8?q?1765335418525827167?= From: Kan Liang The number of CHAs from the discovery table on some SPR variants is incorrect, because of a firmware issue. An accurate number can be read from the MSR UNC_CBO_CONFIG. Fixes: 949b11381f81 ("perf/x86/intel/uncore: Add Sapphire Rapids server CHA support") Reported-by: Stephane Eranian Signed-off-by: Kan Liang Cc: stable@vger.kernel.org Tested-by: Stephane Eranian --- arch/x86/events/intel/uncore_snbep.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 7d1199554fe3..54abd93828bf 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -6138,6 +6138,7 @@ static struct intel_uncore_type spr_uncore_mdf = { }; #define UNCORE_SPR_NUM_UNCORE_TYPES 12 +#define UNCORE_SPR_CHA 0 #define UNCORE_SPR_IIO 1 #define UNCORE_SPR_IMC 6 #define UNCORE_SPR_UPI 8 @@ -6448,12 +6449,22 @@ static int uncore_type_max_boxes(struct intel_uncore_type **types, return max + 1; } +#define SPR_MSR_UNC_CBO_CONFIG 0x2FFE + void spr_uncore_cpu_init(void) { + struct intel_uncore_type *type; + u64 num_cbo; + uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, UNCORE_SPR_MSR_EXTRA_UNCORES, spr_msr_uncores); + type = uncore_find_type_by_id(uncore_msr_uncores, UNCORE_SPR_CHA); + if (type) { + rdmsrl(SPR_MSR_UNC_CBO_CONFIG, num_cbo); + type->num_boxes = num_cbo; + } spr_uncore_iio_free_running.num_boxes = uncore_type_max_boxes(uncore_msr_uncores, UNCORE_SPR_IIO); }