From patchwork Fri Nov 17 16:39:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 166266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp659605vqn; Fri, 17 Nov 2023 08:41:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGF6lGmVN1lBs2zo6fqi0Tb+eml0nItE44IMZCkQMMA53F1X9krGllmNKPzLEoYNWb9OWDS X-Received: by 2002:a17:90b:4c0f:b0:27d:1df4:26f3 with SMTP id na15-20020a17090b4c0f00b0027d1df426f3mr19458202pjb.15.1700239271016; Fri, 17 Nov 2023 08:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239271; cv=none; d=google.com; s=arc-20160816; b=aFjLRYjuKfmWxIehMsjUg1eTAst9T1zY/0S0jG2AYLUQI5h1ztZ9/l/C2UE9pQ9nWd nPpQ7FpSEqANct8TENp/NPpxiuuh9VK6IJccOLMJdDnNaoGuw1faU91DDYIYXCiQ1XKo W2JrwuN3a6VTbyNgtCss/6YwhWYDZo0CIYXs9+TowRAwem2Mx2Z7b9w84vKh/oH5rAbG HJPYlBZvl43ytf29MqmADReiOdQt0oOskZbrHMi/qwJfLDLLZSDFGCMZCkdpcjSpyJgR fBemsOLdMK4sGMZjr827QdkirwfyGLp70xkMh3SHfJCZiyv1rZkW0IT+PVFPBawfFR7p smIQ== 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=SuJ8ldy3S1nBDoqUEc74ygyRK/275zhVt1zpRZP4xdE=; fh=YWpyLXfdRGAJiuvXavk0et/t8St88Eq5hJrEDig/S6s=; b=swBjGxrkaLuEtWFcyxhMRsTTEPFcvwb+r6spbfEIBik8t0hdxb5JewHudbsddVK24w PVv1o2uqb4jUmxGueM9MQavarmABNUCgM9CuYQUamjuJd67uxeJBbG2yIBfOTisXMzAV oKGPeX7hEfAAHtzCo7IoTLxFJVPZzti3QQEb/de0G2Few84FaB8tykYAXflOAfWt8NMG UyU8Fp6yof7BcoCHlMSxRoVya+O2IZLHxbssYVfJriEotkh0yiu2Sj/lsPKXTUaRhrnl pP56YEXmqTboO6Nsg+qmWJkZwP0CW6ybpips+G2H/Y8QIjkftp5bZoz8Z5FmxsLJsFrQ 4Lkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=W0YS32EH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id na18-20020a17090b4c1200b00273e2f407casi4937926pjb.76.2023.11.17.08.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:41:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=W0YS32EH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 1854E808003C; Fri, 17 Nov 2023 08:40:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346102AbjKQQjz (ORCPT + 30 others); Fri, 17 Nov 2023 11:39:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231589AbjKQQjy (ORCPT ); Fri, 17 Nov 2023 11:39:54 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E359DA4 for ; Fri, 17 Nov 2023 08:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700239190; x=1731775190; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/0Udwl92A8XLCPRNOLdJd6f4FOmxfC3B2MzsdWYYuXI=; b=W0YS32EHiPKV5XJXlGVSDo0p7/7PlOzmDsWYcomi0M+p5spoVshp2MBG 5Rt2bID/91b+15BEh5ILmKKfeamPkRfcqEWZZF6s5uVwhskAn6KUX/QCk WwpfI9prAGq8JJNPM26lHX1DEaO5Fp4DrkuZ/xUTfRMR9wBU+YeoPs0sD ElV5myKyQuC2DGVhNb0YWv1JC7dt5WUNtH7GtAzmhuuqLz9vs1cbnuaBh ZaCfKXutoUq1bJ1wnUscArampQcBpPBMTtuV6zjcs9aXz35XwkwgO4IC3 UWk9u6ODTjVvD0GZ+osiZWJxmN1gws4odX1yi0Y06+qvhuGSL9Z7gb51H w==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="390185871" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="390185871" 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:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="1097146187" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="1097146187" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga005.fm.intel.com with ESMTP; 17 Nov 2023 08:39:49 -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 1/5] perf/x86/intel/uncore: Generic uncore_get_uncores and MMIO format of SPR Date: Fri, 17 Nov 2023 08:39:35 -0800 Message-Id: <20231117163939.2468007-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 08:40:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830094266582978 X-GMAIL-MSGID: 1782830094266582978 From: Kan Liang Factor out SPR_UNCORE_MMIO_COMMON_FORMAT which can be reused by Granite Rapids in the following patch. Granite Rapids have more uncore units than Sapphire Rapids. Add new parameters to support adjustable uncore units. No functional change. Tested-by: Ammy Yi Signed-off-by: Kan Liang --- Changes since V1: - Add Tested-by tag arch/x86/events/intel/uncore_snbep.c | 34 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 8250f0f59c2b..fc6587016af7 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -6079,13 +6079,16 @@ static struct uncore_event_desc spr_uncore_imc_events[] = { { /* end: all zeroes */ }, }; +#define SPR_UNCORE_MMIO_COMMON_FORMAT() \ + SPR_UNCORE_COMMON_FORMAT(), \ + .ops = &spr_uncore_mmio_ops + static struct intel_uncore_type spr_uncore_imc = { - SPR_UNCORE_COMMON_FORMAT(), + SPR_UNCORE_MMIO_COMMON_FORMAT(), .name = "imc", .fixed_ctr_bits = 48, .fixed_ctr = SNR_IMC_MMIO_PMON_FIXED_CTR, .fixed_ctl = SNR_IMC_MMIO_PMON_FIXED_CTL, - .ops = &spr_uncore_mmio_ops, .event_descs = spr_uncore_imc_events, }; @@ -6412,7 +6415,8 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type, static struct intel_uncore_type ** uncore_get_uncores(enum uncore_access_type type_id, int num_extra, - struct intel_uncore_type **extra) + struct intel_uncore_type **extra, int max_num_types, + struct intel_uncore_type **uncores) { struct intel_uncore_type **types, **start_types; int i; @@ -6421,9 +6425,9 @@ uncore_get_uncores(enum uncore_access_type type_id, int num_extra, /* Only copy the customized features */ for (; *types; types++) { - if ((*types)->type_id >= UNCORE_SPR_NUM_UNCORE_TYPES) + if ((*types)->type_id >= max_num_types) continue; - uncore_type_customized_copy(*types, spr_uncores[(*types)->type_id]); + uncore_type_customized_copy(*types, uncores[(*types)->type_id]); } for (i = 0; i < num_extra; i++, types++) @@ -6470,7 +6474,9 @@ void spr_uncore_cpu_init(void) uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, UNCORE_SPR_MSR_EXTRA_UNCORES, - spr_msr_uncores); + spr_msr_uncores, + UNCORE_SPR_NUM_UNCORE_TYPES, + spr_uncores); type = uncore_find_type_by_id(uncore_msr_uncores, UNCORE_SPR_CHA); if (type) { @@ -6552,7 +6558,9 @@ int spr_uncore_pci_init(void) spr_update_device_location(UNCORE_SPR_M3UPI); uncore_pci_uncores = uncore_get_uncores(UNCORE_ACCESS_PCI, UNCORE_SPR_PCI_EXTRA_UNCORES, - spr_pci_uncores); + spr_pci_uncores, + UNCORE_SPR_NUM_UNCORE_TYPES, + spr_uncores); return 0; } @@ -6560,12 +6568,16 @@ void spr_uncore_mmio_init(void) { int ret = snbep_pci2phy_map_init(0x3250, SKX_CPUNODEID, SKX_GIDNIDMAP, true); - if (ret) - uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL); - else { + if (ret) { + uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL, + UNCORE_SPR_NUM_UNCORE_TYPES, + spr_uncores); + } else { uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, UNCORE_SPR_MMIO_EXTRA_UNCORES, - spr_mmio_uncores); + spr_mmio_uncores, + UNCORE_SPR_NUM_UNCORE_TYPES, + spr_uncores); spr_uncore_imc_free_running.num_boxes = uncore_type_max_boxes(uncore_mmio_uncores, UNCORE_SPR_IMC) / 2; } From patchwork Fri Nov 17 16:39:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 166267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp659753vqn; Fri, 17 Nov 2023 08:41:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZ8jT7TKjXMb72cNAu/UCDe1vuDIjpx9QTHxenK3zpQwPScic5czFX/qaFpD4IuWkvadym X-Received: by 2002:a05:6a00:198a:b0:6c3:4d7f:6f06 with SMTP id d10-20020a056a00198a00b006c34d7f6f06mr18017883pfl.17.1700239282567; Fri, 17 Nov 2023 08:41:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239282; cv=none; d=google.com; s=arc-20160816; b=Hnppdd07XoDKOEfvaH1jc5Vr+8Owhn5RmhsycqpnpaTbreAZ9irBrKPf6vLUUVwxwC IuKM/uGY64BwbxY0kJXJEa0tE6JJz6mGn2IqLJnytGYERDcMpnhLa21bFfTUeVUaPwVt rDpd3KTVtXxuTOT+t926wBdzlbVD+NdA6eei6sdO/DNylH+KJeFcIcvUcIKB0nWA0Rlx Sp2BO8KGo4uKypIPU2FG16JTYR9waF6mCqZVkbC7R8dX18Qdp6kiu5t+4SLC8bKoD0KY DwMIQJFnD8EQoQS+6M/gKht4IVZkXHsRzBtJeVROGz7CTROxvSOvIl3FIhURD08r6IX+ EjPg== 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=w4tyrTfY/7H1I4fzSr+uiKuAtNi/9Nn3tB8Tmro25wc=; fh=YWpyLXfdRGAJiuvXavk0et/t8St88Eq5hJrEDig/S6s=; b=sCQfxPaNE/rKrybn3UX0mkDuRADle0yX3L9zqqLTzmJ59O517LXCHDeU4+uv8BOeDW VVKIMsl7DmLmO6+avZHA/nRl0DcZXlpLF3dqCq4H93QfDfSDHL2okywPc/P5LY28pd0i UIRdm46Ra67n9TaZyyGNqkLrgPpBfox2XvJPq0AyaKDSX/Hud5hvsc7p9SZsNdZqw/Qd u1xQunrAuueYPNbIPRSj1363GDg/etRixfp2+AIxyJlQ4BQl9FMPwL4OYt+ymIWiLapB d33o7cjWWuUc/nSAAvD8wQ/RGvxba+ejH/+1R3eop+67UvT7q+zb9i4IuuyAlRau7hyd aHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ibVTt/ci"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fd16-20020a056a002e9000b006bc3f09ea09si2300865pfb.26.2023.11.17.08.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:41:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ibVTt/ci"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id BD29C82696FB; Fri, 17 Nov 2023 08:40:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346116AbjKQQj7 (ORCPT + 30 others); Fri, 17 Nov 2023 11:39:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346117AbjKQQjz (ORCPT ); Fri, 17 Nov 2023 11:39:55 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00678D4B for ; Fri, 17 Nov 2023 08:39:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700239192; x=1731775192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=luUpQwdOFY2sOihm+F4UzO30tVZ0bcq8Vqnr7JY27Wc=; b=ibVTt/ciTM1Rbx5u0zjQQVlWZt4dy1FfppF6iur2BWIC8e8ufl4zkE3+ QwL2pkhzwYVoHuR06fCKCsLRxMs8QZ9CEv3m2bWlKXqGJL1On0RBiVRxm MY5cEVcR8//RCpzL3HLtOKgCWuE+4wlGRH1OUQsSrDd0UkIM8f7DGEGFW 7iVowYMfc7+NqQbZu6vzLD93aE3ZIAOcS1wCPuMS1wzbClGktk9VgsfSa CeW7CLX1VOZhK0sVDhUdF+OhlBs6sfOJzFxVh5fBg7FPijUvzk9DCwcv2 X1pzxnT72BDdEqjcG6MFaFH4Wv/6+j2tDP3P5Cs1BfNgAaq8iRCNJeQqd Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="390185877" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="390185877" 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="1097146196" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="1097146196" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by fmsmga005.fm.intel.com with ESMTP; 17 Nov 2023 08:39:49 -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 2/5] perf/x86/uncore: Use u64 to replace unsigned for the uncore offsets array Date: Fri, 17 Nov 2023 08:39:36 -0800 Message-Id: <20231117163939.2468007-2-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=-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 08:40:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830105693174218 X-GMAIL-MSGID: 1782830105693174218 From: Kan Liang The current perf doesn't save the complete address of an uncore unit. The complete address of each unit is calculated by the base address + offset. The type of the base address is u64, while the type of offset is unsigned. In the old platforms (without the discovery table method), the base address and offset are hard coded in the driver. Perf can always use the lowest address as the base address. Everything works well. In the new platforms (starting from SPR), the discovery table provides a complete address for all uncore units. To follow the current framework/codes, when parsing the discovery table, the complete address of the first box is stored as a base address. The offset of the following units is calculated by the complete address of the unit minus the base address (the address of the first unit). On GNR, the latter units may have a lower address compared to the first unit. So the offset is a negative value. The upper 32 bits are lost when casting a negative u64 to an unsigned type. Use u64 to replace unsigned for the uncore offsets array to correct the above case. There is no functional change. Tested-by: Ammy Yi Signed-off-by: Kan Liang --- Changes since V1: - Add Tested-by tag arch/x86/events/intel/uncore.h | 6 +++--- arch/x86/events/intel/uncore_discovery.c | 5 +++-- arch/x86/events/intel/uncore_discovery.h | 2 +- arch/x86/events/intel/uncore_nhmex.c | 2 +- arch/x86/events/intel/uncore_snbep.c | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index c30fb5bb1222..7428ecaddf72 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -72,9 +72,9 @@ struct intel_uncore_type { unsigned single_fixed:1; unsigned pair_ctr_ctl:1; union { - unsigned *msr_offsets; - unsigned *pci_offsets; - unsigned *mmio_offsets; + u64 *msr_offsets; + u64 *pci_offsets; + u64 *mmio_offsets; }; unsigned *box_ids; struct event_constraint unconstrainted; diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c index cb488e41807c..9a698a92962a 100644 --- a/arch/x86/events/intel/uncore_discovery.c +++ b/arch/x86/events/intel/uncore_discovery.c @@ -125,7 +125,8 @@ uncore_insert_box_info(struct uncore_unit_discovery *unit, int die, bool parsed) { struct intel_uncore_discovery_type *type; - unsigned int *box_offset, *ids; + unsigned int *ids; + u64 *box_offset; int i; if (!unit->ctl || !unit->ctl_offset || !unit->ctr_offset) { @@ -153,7 +154,7 @@ uncore_insert_box_info(struct uncore_unit_discovery *unit, if (!type) return; - box_offset = kcalloc(type->num_boxes + 1, sizeof(unsigned int), GFP_KERNEL); + box_offset = kcalloc(type->num_boxes + 1, sizeof(u64), GFP_KERNEL); if (!box_offset) return; diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h index 6ee80ad3423e..22e769a81103 100644 --- a/arch/x86/events/intel/uncore_discovery.h +++ b/arch/x86/events/intel/uncore_discovery.h @@ -125,7 +125,7 @@ struct intel_uncore_discovery_type { u8 ctr_offset; /* Counter 0 offset */ u16 num_boxes; /* number of boxes for the uncore block */ unsigned int *ids; /* Box IDs */ - unsigned int *box_offset; /* Box offset */ + u64 *box_offset; /* Box offset */ }; bool intel_uncore_has_discovery_tables(int *ignore); diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c index 173e2674be6e..56eea2c66cfb 100644 --- a/arch/x86/events/intel/uncore_nhmex.c +++ b/arch/x86/events/intel/uncore_nhmex.c @@ -306,7 +306,7 @@ static const struct attribute_group nhmex_uncore_cbox_format_group = { }; /* msr offset for each instance of cbox */ -static unsigned nhmex_cbox_msr_offsets[] = { +static u64 nhmex_cbox_msr_offsets[] = { 0x0, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x240, 0x2c0, }; diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index fc6587016af7..344319ab6dd5 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -5278,7 +5278,7 @@ void snr_uncore_mmio_init(void) /* ICX uncore support */ -static unsigned icx_cha_msr_offsets[] = { +static u64 icx_cha_msr_offsets[] = { 0x2a0, 0x2ae, 0x2bc, 0x2ca, 0x2d8, 0x2e6, 0x2f4, 0x302, 0x310, 0x31e, 0x32c, 0x33a, 0x348, 0x356, 0x364, 0x372, 0x380, 0x38e, 0x3aa, 0x3b8, 0x3c6, 0x3d4, 0x3e2, 0x3f0, 0x3fe, 0x40c, 0x41a, @@ -5326,7 +5326,7 @@ static struct intel_uncore_type icx_uncore_chabox = { .format_group = &snr_uncore_chabox_format_group, }; -static unsigned icx_msr_offsets[] = { +static u64 icx_msr_offsets[] = { 0x0, 0x20, 0x40, 0x90, 0xb0, 0xd0, }; @@ -6184,7 +6184,7 @@ static struct intel_uncore_type *spr_uncores[UNCORE_SPR_NUM_UNCORE_TYPES] = { */ #define SPR_UNCORE_UPI_NUM_BOXES 4 -static unsigned int spr_upi_pci_offsets[SPR_UNCORE_UPI_NUM_BOXES] = { +static u64 spr_upi_pci_offsets[SPR_UNCORE_UPI_NUM_BOXES] = { 0, 0x8000, 0x10000, 0x18000 }; From patchwork Fri Nov 17 16:39:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 166265 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp659170vqn; Fri, 17 Nov 2023 08:40:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcJMOIq7ncG9PlQjibR0sJ4N0xNeDpWeqbsgv3aBt09PnqNifDJdkFAvz6z+jNA6rSnoGv X-Received: by 2002:a05:6808:1585:b0:3b6:dd92:737e with SMTP id t5-20020a056808158500b003b6dd92737emr22133433oiw.58.1700239224427; Fri, 17 Nov 2023 08:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239224; cv=none; d=google.com; s=arc-20160816; b=XSM1CMw8+RhpNshdRg+33PLyRLIWf2Ycw8diBwrXZBRoI33yHIbDeUgb8hDrPieDBU v3POyAlp1frCdnnb6sdLBhujYEb5rLYre/19Z7TSbT7rZuw53AYZpQaPgNIEHVUUXk+u 2PpJpO9lOd1u6URaQWtuKXo1zWfx5G40KfzKvbeVNG7FQsk9gNHI5ymx7b01w/P9a1kI IGxT/KjpTgydkBY/ERyx7hQkIIr4AE9geA99pt+0k5fjA0laSGyaf065SrSqKUg6oZUi FuRKsOdFtMrbhalk52zWQIn5gjHVg6zbT77pZTHBqpt/DyYE3y6yHTVr6aCqBZHj8C6A dPLA== 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=tju42T7DfL+sbQ+d1xHWAF1MwlhFT+h62+rXdp5xiv4=; fh=YWpyLXfdRGAJiuvXavk0et/t8St88Eq5hJrEDig/S6s=; b=ednyOuD8OBkYI4UotpWigheGVw4nzk+Gwir5Q1fUZFj2530cyNazqEMl3fWX4aKi9G c+dUcIldb3+NfnQhQv7Jr9OBVKH+mdcIW08rkN2WWm5Ypc6/39he0Y+rhKVmGqr/9Dma 9rGUDEmU3ru+VY6ceb97xWjoSEyavk8o9YReFtEaOaN/DUp65Ui5qB5dQaUHpQkG8kfa WbB1GE2vSp9BXgmq8uyjtWkYABWakT6XrmCNlhVdTIf1nSe7dt/4BZKPuMg0rOzjQ0np +f4qfzqOFHyWybOejbNcJdWg/dM9lES5/CLP6v0die0GgKfIF5B8efininVmpbU6lXIE UiEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h/cFgGeQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 6-20020a630806000000b005b7dd20f8c1si2146374pgi.20.2023.11.17.08.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:40:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h/cFgGeQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 275D2824C4CC; Fri, 17 Nov 2023 08:40:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346124AbjKQQj5 (ORCPT + 30 others); Fri, 17 Nov 2023 11:39:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346116AbjKQQjz (ORCPT ); Fri, 17 Nov 2023 11:39:55 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82112A4 for ; Fri, 17 Nov 2023 08:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700239192; x=1731775192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nrT94rQ1VfldNMg/ixDrj+FJcmTBCZVc5P0JGbLwBsA=; b=h/cFgGeQYzxdWFTY5SEwSxI8B7UKb2oS2Dy5vDWqBviuDma+a8Z1lPee JWfC7jCra23AHlje2ts1JY5YtTRSxTRZ7hFPHtiaStnx4RttU4vd91U1C 6CO3GCtCeEWG7bPCXZKuHidsxyWi+c40OV5nTlNsb9nkN32ofZQFpZFQp ivi2eQMmO1+KGmOMpd641qyAKQJ7PISonO4GY7bhoqHQ/3p5XtsEQizmF xfH+TyJ0BWWghsxl6DMIexA+rY1PcAw51g+C3WEtg2ai8dGX2En9pwzSf qqgpXBYydA1NdBU8iY4zPESd6aZvD6m+TqFmKu14OyDtLFku9nKNwxGgH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="390185885" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="390185885" 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="1097146200" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="1097146200" 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 3/5] perf/x86/intel/uncore: Support Granite Rapids Date: Fri, 17 Nov 2023 08:39:37 -0800 Message-Id: <20231117163939.2468007-3-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=-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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 17 Nov 2023 08:40:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830044997712318 X-GMAIL-MSGID: 1782830044997712318 From: Kan Liang The same as Sapphire Rapids, Granite Rapids also supports the discovery table feature. All the basic uncore PMON information can be retrieved from the discovery table which resides in the BIOS. There are 4 new units are added on Granite Rapids, b2cmi, b2cxl, ubox, and mdf_sbo. The layout of the counters is exactly the same as the generic uncore counters. Only add a name for the new units. All the details can be retrieved from the discovery table. The description of the new units can be found at https://www.intel.com/content/www/us/en/secure/content-details/772943/content-details.html The other units, e.g., cha, iio, irp, pcu, and imc, are the same as Sapphire Rapids. Ignore the upi and b2upi units in the discovery table, which are broken for now. Tested-by: Ammy Yi Signed-off-by: Kan Liang --- Changes since V1: - Add Tested-by tag - Ignore type 21 and 22 which are broken. arch/x86/events/intel/uncore.c | 10 ++++ arch/x86/events/intel/uncore.h | 4 ++ arch/x86/events/intel/uncore_snbep.c | 87 ++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 01023aa5125b..7fb1c54c9879 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -1814,6 +1814,14 @@ static const struct intel_uncore_init_fun spr_uncore_init __initconst = { .uncore_units_ignore = spr_uncore_units_ignore, }; +static const struct intel_uncore_init_fun gnr_uncore_init __initconst = { + .cpu_init = gnr_uncore_cpu_init, + .pci_init = gnr_uncore_pci_init, + .mmio_init = gnr_uncore_mmio_init, + .use_discovery = true, + .uncore_units_ignore = gnr_uncore_units_ignore, +}; + static const struct intel_uncore_init_fun generic_uncore_init __initconst = { .cpu_init = intel_uncore_generic_uncore_cpu_init, .pci_init = intel_uncore_generic_uncore_pci_init, @@ -1865,6 +1873,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &mtl_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &spr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &spr_uncore_init), + X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X, &gnr_uncore_init), + X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D, &gnr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_GRACEMONT, &adl_uncore_init), {}, diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index 7428ecaddf72..4838502d89ae 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -593,6 +593,7 @@ extern struct list_head pci2phy_map_head; extern struct pci_extra_dev *uncore_extra_pci_dev; extern struct event_constraint uncore_constraint_empty; extern int spr_uncore_units_ignore[]; +extern int gnr_uncore_units_ignore[]; /* uncore_snb.c */ int snb_uncore_pci_init(void); @@ -634,6 +635,9 @@ void icx_uncore_mmio_init(void); int spr_uncore_pci_init(void); void spr_uncore_cpu_init(void); void spr_uncore_mmio_init(void); +int gnr_uncore_pci_init(void); +void gnr_uncore_cpu_init(void); +void gnr_uncore_mmio_init(void); /* uncore_nhmex.c */ void nhmex_uncore_cpu_init(void); diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 344319ab6dd5..ab31cda797df 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -6584,3 +6584,90 @@ void spr_uncore_mmio_init(void) } /* end of SPR uncore support */ + +/* GNR uncore support */ + +#define UNCORE_GNR_NUM_UNCORE_TYPES 23 +#define UNCORE_GNR_TYPE_15 15 +#define UNCORE_GNR_B2UPI 18 +#define UNCORE_GNR_TYPE_21 21 +#define UNCORE_GNR_TYPE_22 22 + +int gnr_uncore_units_ignore[] = { + UNCORE_SPR_UPI, + UNCORE_GNR_TYPE_15, + UNCORE_GNR_B2UPI, + UNCORE_GNR_TYPE_21, + UNCORE_GNR_TYPE_22, + UNCORE_IGNORE_END +}; + +static struct intel_uncore_type gnr_uncore_ubox = { + .name = "ubox", + .attr_update = uncore_alias_groups, +}; + +static struct intel_uncore_type gnr_uncore_b2cmi = { + SPR_UNCORE_PCI_COMMON_FORMAT(), + .name = "b2cmi", +}; + +static struct intel_uncore_type gnr_uncore_b2cxl = { + SPR_UNCORE_MMIO_COMMON_FORMAT(), + .name = "b2cxl", +}; + +static struct intel_uncore_type gnr_uncore_mdf_sbo = { + .name = "mdf_sbo", + .attr_update = uncore_alias_groups, +}; + +static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = { + &spr_uncore_chabox, + &spr_uncore_iio, + &spr_uncore_irp, + NULL, + &spr_uncore_pcu, + &gnr_uncore_ubox, + &spr_uncore_imc, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &gnr_uncore_b2cmi, + &gnr_uncore_b2cxl, + NULL, + NULL, + &gnr_uncore_mdf_sbo, + NULL, + NULL, +}; + +void gnr_uncore_cpu_init(void) +{ + uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, 0, NULL, + UNCORE_GNR_NUM_UNCORE_TYPES, + gnr_uncores); +} + +int gnr_uncore_pci_init(void) +{ + uncore_pci_uncores = uncore_get_uncores(UNCORE_ACCESS_PCI, 0, NULL, + UNCORE_GNR_NUM_UNCORE_TYPES, + gnr_uncores); + return 0; +} + +void gnr_uncore_mmio_init(void) +{ + uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL, + UNCORE_GNR_NUM_UNCORE_TYPES, + gnr_uncores); +} + +/* end of GNR uncore support */ 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) From patchwork Fri Nov 17 16:39:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 166263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp659003vqn; Fri, 17 Nov 2023 08:40:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1plaGzO12QhpmDB5o6rP2nto9SmWwpQZQwUjoAECd3TdKxhLS4WpdxRVdfORMyGtOADRf X-Received: by 2002:a05:6a00:1b57:b0:692:b429:390 with SMTP id o23-20020a056a001b5700b00692b4290390mr19711809pfv.29.1700239209735; Fri, 17 Nov 2023 08:40:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700239209; cv=none; d=google.com; s=arc-20160816; b=QNSkrwEQvi5PV+dsnK2mSOthpfW1K2XaBG9EJb9WHOYh+T+kCO99JCJvs589muQX2O fKMNmF4RX8zITk75Y0O5DBvFWUG2s9KSZ04OeFI5NFSCn5XGWCGshdR4B6nmKXd3Hfq9 jGrQEiyPQlhGyYxgFLE7zHKSAq9FxF6567ifDc2MNx9QLX4SNmCUhbS99gp75icGRL14 NnfWCI+HiWLVMoO7xW4Ppx27JCb/+eefxLsB3BTfDqWEx3ZEFA5XNtqjHjNNhPqcdTSj e/n4Ox/7Q1IilEGnmaOshNi2gOgFeNJwUPScoinXnRA6riYtqEYgVCdVbvM20x2kJSS2 wvTQ== 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=DonSi3WiPYR0KjzGtKg8i5oPYfZMFddizHiIczJaaJ0=; fh=YWpyLXfdRGAJiuvXavk0et/t8St88Eq5hJrEDig/S6s=; b=BVH4GEkvawtK4bIXwnXTK67kHBSa3BztJMD2cOsJOFlzIcW0qSpAns+uODVDVR0WRQ nCtEUEwp45VbmwMBONFkbsCKZHrra/j/OLj6y/BSB6ABZwD0kKm/m3N9IOnvz7gJOM2Y KGH74IO/cXmp8PDh/zbhsp5mfHQZyhJR8NsJMjrReGtwY0KwanpFQLvz77bLLgXXjagr bEmYgvesMW0baBzDO2ZGsthAlBdmb2sjcnzfxfQjH4XeKu+VTIHbDoGbT5QjnapqtYLv zPFijQ93fT794VMlcvg6Kur2dazjbQ0S6bGgob9Rd76lURV0maeOUIBlNWEE60s50Zhp IY5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bGRx4AXO; 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 q17-20020a056a00089100b006b69f056508si2307731pfj.149.2023.11.17.08.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:40:09 -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=bGRx4AXO; 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 858478288C87; Fri, 17 Nov 2023 08:40:08 -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 S1346156AbjKQQkD (ORCPT + 30 others); Fri, 17 Nov 2023 11:40:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346122AbjKQQj4 (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 5E341D50 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=JasvbIs1uMFFus2bJjh62TF9c26P45idXBsuIb9qiJY=; b=bGRx4AXO3yurptGcWbqxI6/S60zpPTemPmG62YiWMV4J+HOD7ssZGcJz a4TQGQIffCcuDvNZByhDxh3VwD5KrQFtQmYPmsQNO6wz54AQySYv8pPcs Dd1AKWJu6ZWKgOeiOFQ3XkGBpmOwub51/ZDzRnwLE8+pT4yVhKlMtUN1x 96t9ZTtj7MNYnDPySQKRCmFAj2P+FqBYgNsXlUASunYhZ0Q3wEPvH7Pz3 SQj62S0D439kwVCfYb84mGN3RMl94Nt0vohQBSeX+7xdGW98sRUthWzna GshhfgYIPVgbnpykTmI2FoMocrujWJLaaR9aLOmrOQPWXAN4kafbprm/t A==; X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="390185897" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="390185897" 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:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10897"; a="1097146214" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="1097146214" 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 5/5] perf/x86/intel/uncore: Support Sierra Forest and Grand Ridge Date: Fri, 17 Nov 2023 08:39:39 -0800 Message-Id: <20231117163939.2468007-5-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:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830029543443953 X-GMAIL-MSGID: 1782830029543443953 From: Kan Liang The same as Granite Rapids, the Sierra Forest and Grand Ridge also supports the discovery table feature and the same type of the uncore units. The difference of the available units and counters can be retrieved from the discovery table automatically. Just add the CPU model ID. Tested-by: Ammy Yi Signed-off-by: Kan Liang --- Changes since V1: - Add Tested-by tag arch/x86/events/intel/uncore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 7fb1c54c9879..7927c0b832fa 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -1877,6 +1877,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = { X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D, &gnr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_GRACEMONT, &adl_uncore_init), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_CRESTMONT_X, &gnr_uncore_init), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_CRESTMONT, &gnr_uncore_init), {}, }; MODULE_DEVICE_TABLE(x86cpu, intel_uncore_match);