From patchwork Fri Nov 17 16:39:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 166264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp659076vqn; Fri, 17 Nov 2023 08:40:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEZBwO+JjorffHlZohjaa2htbi8J3SzoAPIQmfuvOuULhuBYj4eXPK3tuJ+3SACJ8aRgoQ X-Received: by 2002:a9d:6741:0:b0:6d6:53f8:882 with SMTP id w1-20020a9d6741000000b006d653f80882mr13627352otm.20.1700239216276; Fri, 17 Nov 2023 08:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239216; cv=none; d=google.com; s=arc-20160816; b=r/al3GtTsVlH8EHpZPSsNX7ZtugxrO+SlKlnPP/eS7vXqUtFZyD2hyynp8mX+NZJX1 1PfPwiZTTSsrS4njPFyvr9DEYyIn45ptfP4Sj0OtYkmIIQ0lMxoH/MWi4yBFZTl4Zsb+ KrJ4USnaZ4dotbOYs33IKBrswt+4E4sanY2gQTQxmD4ZdoFo3nI7i2YopwpeL3lhd3fS SIJJ+NkdWM1np90Rft1kBcM3Rk1MrsEzHCq2sl2qhIi4+ZLNMvGLv+JH+JbrpLkNMlGU iJ1qlkTuKXw28R8UdCg/g4rBroUvz9pxgCB6Qw8NGuZIi8mce8y3LiVQvRud4Nnr9pGS 2XvQ== 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 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p24-20020a634f58000000b005a9e4c3d350si2202192pgl.743.2023.11.17.08.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; 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 23.128.96.37 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 574E08273317; Fri, 17 Nov 2023 08:40:15 -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 S1346146AbjKQQkF (ORCPT + 30 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 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:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830036574761866 X-GMAIL-MSGID: 1782830036574761866 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)