From patchwork Mon Oct 2 15:03:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 147445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1656184vqb; Mon, 2 Oct 2023 12:53:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGprhlAE5+ryRj5JacbMyPGuh1lwhlxxCm4frLUjRaF9/2lE/58BunmSf2OMo5Wt/+OOxga X-Received: by 2002:a05:6a20:3d90:b0:15e:10e:12f3 with SMTP id s16-20020a056a203d9000b0015e010e12f3mr13529820pzi.0.1696276383349; Mon, 02 Oct 2023 12:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696276383; cv=none; d=google.com; s=arc-20160816; b=K93kwFoaXqIRRvCnq3s4Fg+uahP78N9mnevqCi0QTAm23jnIcIdd/Fk+ej1gdJAN9u QA5fGdIpxwg6IKoc3UsUmd0iaeHCg1fmoxdkwNSH+tVKmZnJ9e41Ro6k93HEVQOdghzS IKaLxuKlUe/14IaVzJQOpyEXUgkZTjIiEElJdReA9wkqKDMDdvHlik3NDBBhl5VZ2gMb nyXuhrEEho022ki2zVEk7cEmbpRiQ/Fwx+QXemq1tmu9v1MkJDisvVoheUZfTTLkkec+ 8dd/rvRDvv9RJFGka5cqtyUl4G/fl5FJrMog+/iMDG3BXnQBkEHT8OnPhnaj3logUBd4 YLgg== 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=mzRxMHkJTqwNrNEoMlTWDd2kYlj/JEd0XgYf1pDYXgA=; fh=XOkOKN9ZbC1Zh3rfeAvxUpgU00NM1ZcWi06LZ96oE2g=; b=fsxWj2brnRw6PzF5ICeQTFo5TpZJPbCX9m8Dxla/4VhvlI1oa8mL6ui20iucY2MHdF Xg4NXTHB4rXY9qKKd6mVMm7PeW25qd0rRcwLF+WFCFsPOK4DHr+14cBvkT6m9E5+JwkF RtfnFRsZBKI0/am2eB6GMfI9DtaLSEpn1cgP7cAKHKdIHgs4ARfeLNI6IyRhQ42vG81i Sg2gDH3Jo3bWVuXXG0xlN0f9LjHRO/fG7TlwNtPGUVgyiVietQDJKum2peDF46lusaDU MBv6xektmpZ3ZeH1bRyAE0XrzvDsiWgBbUT0V/UsRclMzIR1g0giv7dJPY2qN0z4rCc5 yeYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QBIQCiwQ; 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 j13-20020a63cf0d000000b0057821ea0674si17519130pgg.812.2023.10.02.12.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 12:53:03 -0700 (PDT) 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=QBIQCiwQ; 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 BCEE88025824; Mon, 2 Oct 2023 08:03:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237961AbjJBPDc (ORCPT + 18 others); Mon, 2 Oct 2023 11:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237862AbjJBPDZ (ORCPT ); Mon, 2 Oct 2023 11:03:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92376B7 for ; Mon, 2 Oct 2023 08:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696259003; x=1727795003; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nx7GNempp8UMyeQf3iZp0vdzB5eXlrq5zLmg/MI/cX8=; b=QBIQCiwQCo4cEd7CA6oybkbzbzBY0eBZRB8s2Br2WCIgGos/c5O8vqa1 pRj8exudUBDyUt6oPp0AP3lxqydDw9yg+g3mW3YUjKYBfC5cuJI7GowQy Ls0OYcClXnNlT8s3zo8WParQbKylVs3x2TtryIZhHim2IIRi6H93yXfad OlupFd66z60boK5STce6pKxznILAjvaLXy53UTYpi7O5e/4BKIONZiku2 IKabC6dyyEIXN1dRuD2bGPG/nk/3q0QhxMmQhmJB5/6miNFDsOudrQzK5 +Wux3dWB9879L3ZWM1eCUYbd2xbzGPNpzCbO++GCNu2w9/v8QV6jiz8AJ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362033052" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362033052" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 08:03:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="820904664" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="820904664" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga004.fm.intel.com with ESMTP; 02 Oct 2023 08:03:19 -0700 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 Subject: [PATCH 4/5] perf/x86/intel/uncore: Support IIO free-running counters on GNR Date: Mon, 2 Oct 2023 08:03:24 -0700 Message-Id: <20231002150325.2025749-4-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231002150325.2025749-1-kan.liang@linux.intel.com> References: <20231002150325.2025749-1-kan.liang@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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]); Mon, 02 Oct 2023 08:03:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778674705224464502 X-GMAIL-MSGID: 1778674705224464502 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. Signed-off-by: Kan Liang --- 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 e2ce97d73a31..60334026141a 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -6632,11 +6632,21 @@ static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = { &gnr_uncore_mdf_sbo, }; +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)