Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp644177rdb; Fri, 17 Nov 2023 08:40:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG53M1g6rWayX046U0pFrTANq7k9mgGHZAotXxX2M7KiO7EljAcWzQQIOYIUmKrjkEVcyUd X-Received: by 2002:a05:6a20:1609:b0:174:7f7:d049 with SMTP id l9-20020a056a20160900b0017407f7d049mr18475617pzj.9.1700239214071; Fri, 17 Nov 2023 08:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239214; cv=none; d=google.com; s=arc-20160816; b=c8xlvz1jtM1A/Q+50HnA0SFbO4F6TaoPIpN3sb6cCm+Wp6z6VBI0kuVIt8Ec3f9fTi PM+TSHJZjyDPp82W64iNCponXr87piW6isvPG0o/ZMpDexSPV3iIbAr3KxuwSKpPcawN vGio4jvlMCvinCBcvi8LzVD1zRgNC2g9xYzLDWWgiD4RRVbiWVUPbYF3VcQ4ZBcvAmZ2 L2OkbWM6d6N8KxAQjv6mxV6aGM4VE4SLqnMzhAtDwiMQXMvVx20fhxdB9WVuCYqNOVSl lQu8Q/FueNc5RvJQU7JiwziQO/DbmijeE16Z8K91+Jowgv2SLj1qi8PsQ3iR+H8mYUl3 cpjQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C9ARdw2t6pj4XeWYqbyL1xZxa5eJlj9JlZDic0rsxrs=; fh=YWpyLXfdRGAJiuvXavk0et/t8St88Eq5hJrEDig/S6s=; b=PgBUd80qcBI5xvkN8L/Pk/ke0vZrkQ6ktRz5RiehbtohqoBlj0YR1mDOcOt2cXYQZ+ YcTL22Xq5m+fj4/0DKRHnoBv/1XhXQtd5QbY648/1JQ4DKW7cqW7Eg/DO2Ie0m1TkZlM kki9QRyGufekgF4FpVgzRZKD26QlDMLXqhTt3QbDjbb6UANuZ610mZulIAh8mtbAtWm1 4E/glV265U2+bnCQmPUkAMBXD0wp2y9idixXm67TFox1++1qwtajpdILvZs5HYqCm4NH cqtM++mLeHf02AIHZR6/xYbDpSqLlY5cFfyxCSC6PckJGcPA0cQ78EcrnPipM8YueJuz H2yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TVNGTle8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x2-20020a056a00188200b006b8b194005fsi2282991pfh.256.2023.11.17.08.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:40:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TVNGTle8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 003E1828612B; Fri, 17 Nov 2023 08:40:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346145AbjKQQkF (ORCPT + 99 others); Fri, 17 Nov 2023 11:40:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346121AbjKQQj4 (ORCPT ); Fri, 17 Nov 2023 11:39:56 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530A4D4F for ; Fri, 17 Nov 2023 08:39:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700239193; x=1731775193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ChsYotRgZWrgxZBj399NXM536QOR/xp1weCcE08gaRg=; b=TVNGTle8ml/1JuzBwz6qckpCiYx+ofih9mp0KfvIdbmQlNs8mQJdQq9R jCZ/zOUjVVac7m/Fqlhj4dvaOjA/WI6VIoipq+OXkAXsBIe3WSDSHPQtp BPAjsKoHVcoNebrdOoIUg8uRbs+5R1+NxQaYi+LYAZCW+Kn8WiHL9bkgT oLaOJL1QorqXBxqvvkEcUL/H2EXlzZ9vj+P6k+iGqkup3e6UTGdzj4+gN NaEaEMtgnHEucVciGY6L3m7Ivg5GgKtyMq/f8H21h40OqJ3Xgo5tfwYw3 jfUVamc2fkV6AKf+RTimJXFaZIInD2emEWYcDErVMHjFHt7RTZyFMNhK1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="390185892" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="390185892" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2023 08:39:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="1097146208" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="1097146208" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga005.fm.intel.com with ESMTP; 17 Nov 2023 08:39:50 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: eranian@google.com, ak@linux.intel.com, Kan Liang , Ammy Yi Subject: [PATCH V2 4/5] perf/x86/intel/uncore: Support IIO free-running counters on GNR Date: Fri, 17 Nov 2023 08:39:38 -0800 Message-Id: <20231117163939.2468007-4-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231117163939.2468007-1-kan.liang@linux.intel.com> References: <20231117163939.2468007-1-kan.liang@linux.intel.com> 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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 08:40:13 -0800 (PST) From: Kan Liang The free-running counters for IIO uncore blocks on Granite Rapids are similar to Sapphire Rapids. The key difference is the offset of the registers. The number of the IIO uncore blocks can also be retrieved from the discovery table. Tested-by: Ammy Yi Signed-off-by: Kan Liang --- Changes since V1: - Add Tested-by tag arch/x86/events/intel/uncore_snbep.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index ab31cda797df..aeaa8efe3c62 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -6648,11 +6648,21 @@ static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = { NULL, }; +static struct freerunning_counters gnr_iio_freerunning[] = { + [SPR_IIO_MSR_IOCLK] = { 0x290e, 0x01, 0x10, 1, 48 }, + [SPR_IIO_MSR_BW_IN] = { 0x360e, 0x10, 0x80, 8, 48 }, + [SPR_IIO_MSR_BW_OUT] = { 0x2e0e, 0x10, 0x80, 8, 48 }, +}; + void gnr_uncore_cpu_init(void) { - uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, 0, NULL, + uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, + UNCORE_SPR_MSR_EXTRA_UNCORES, + spr_msr_uncores, UNCORE_GNR_NUM_UNCORE_TYPES, gnr_uncores); + spr_uncore_iio_free_running.num_boxes = uncore_type_max_boxes(uncore_msr_uncores, UNCORE_SPR_IIO); + spr_uncore_iio_free_running.freerunning = gnr_iio_freerunning; } int gnr_uncore_pci_init(void) -- 2.35.1