Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4405256rwr; Mon, 8 May 2023 07:16:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UCNDzS+epFNGg4DJo3tuNVSEldes1DJScnQfkceUw4Oui6BLwIoSCGbAxLGw6xqg+X9zi X-Received: by 2002:a05:6a20:94cf:b0:f2:6eeb:211b with SMTP id ht15-20020a056a2094cf00b000f26eeb211bmr12002120pzb.37.1683555395552; Mon, 08 May 2023 07:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683555395; cv=none; d=google.com; s=arc-20160816; b=eRCD0OkhGadONe0cBH+eiUc1WJSEQaiT2Zm93Q3zmBuy4g1rerUSPdLZ+YRKBxWyw5 wALNhIYYrnVO6T/gaZvGTHBA2n2g8fZmUJGYDhnonCqmtJzrVWSN4DS+pJiz/ZBSU/F3 9Hi8X3GWkPOpuLiZKNSPZLyqTLSwumBy6gfPKNP3HYXEfoSjIDA3pYnfE4R8ZcL4jg9Y Z8J9Ybkz77V5XaNw29ljYvcYVvcoebN8EtrHF185FZ+BiYOGUeGAYnCZD7kcZgDbdb7O QGq/qbOIXlATCKJb/oRhGrME0UDn5BpkRPws82y6VNlPNowdKlIgsUk4r4ySS6I+1PK5 xJ5w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h186-20020a636cc3000000b0052c76af96d2si8016595pgc.832.2023.05.08.07.16.19; Mon, 08 May 2023 07:16:35 -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 S234395AbjEHOFP (ORCPT + 99 others); Mon, 8 May 2023 10:05:15 -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 Content-Transfer-Encoding: 8bit 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 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 --- 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); } -- 2.35.1