Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1587057rdb; Mon, 2 Oct 2023 14:31:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQKllh1iiVR/2Uy7BTJcg6vKt+PgwHl/pXgL9ABgihGyv9Vhm5JjRaqSo6L1RnJHtS5b9Y X-Received: by 2002:aca:2b17:0:b0:3a1:e85f:33ee with SMTP id i23-20020aca2b17000000b003a1e85f33eemr12897096oik.56.1696282285478; Mon, 02 Oct 2023 14:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696282285; cv=none; d=google.com; s=arc-20160816; b=GISejlzRvA0h9w/RtCZC1pGahZjDfJVT7v5e9V1eYQJprlLcPSHnQhCJQwRxNDuwi7 1KkjuUgTD+RQxHLUYreunaaXQsesUb1XIX7V1aIsfShW+ouS7r/ttkEf801KSt3swLKM 0Ld8IIjEOuv8e2UOBkB1rBjYSJnS4P03LCT2I9D8Lrtv0Hi3rfUgW3zsDYjHi+8r8OMi v94JqZs7DzAW+rXKf3KNk4s/evt7kkLtJqxoABipP5wmmbasqX7Ep1PLXGoH8KEfXd88 PhrXY0co5F8deR3Siwwt4b6Jyjap2sCOYopP9CgmV7pkfoeg0nSNCNFo7eNas7wrpPoR ULCg== 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.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id fd7-20020a056a002e8700b00690a7aefa50si15691606pfb.325.2023.10.02.14.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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.35 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 groat.vger.email (Postfix) with ESMTP id E3C278025444; Mon, 2 Oct 2023 08:03:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237960AbjJBPDc (ORCPT + 99 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:03:51 -0700 (PDT) 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) -- 2.35.1