From patchwork Wed Nov 29 08:19:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 171164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp199726vqn; Wed, 29 Nov 2023 00:39:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5qAYxE2oIc3tIJGz3Jvzbp5Ch25u4qTD5bVjYi4K5dDXnkue+FXpP/o49qivC3kWyVAkn X-Received: by 2002:a05:6870:6245:b0:1e9:96c6:e04c with SMTP id r5-20020a056870624500b001e996c6e04cmr20271483oak.32.1701247140795; Wed, 29 Nov 2023 00:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701247140; cv=none; d=google.com; s=arc-20160816; b=FI1IYg3gzP5RNou2pneerTKU6cMtZS+O+oaeHQOtUqF5jT4jRGq1fDTtKo6XnDVInc XDhVo5iKJJSCncE4hEw0g1CtzDwTRQijh7k7yHaYCo5dv2jHhA/wH/jN6IzNHy0vlrHE R4A8yKUzLNPqgX2sBJg1TfHDWFjc6Q7g6WGHWPj0HrvrYhp/8XZX6IAF2gVy2vTdacKh al7NQgLG1ZtfcSkOZr1qNE5giwAnF4AEMZyeghFtaHYvExHGIDuWXn3QsRY1x3jxRZA/ voAY3MfJ4SusOlle55QrHdnB2wDAjq3LvVj9Co6fryjNFjCeGIWF4Rt8znv64u+grxdE d2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=mYdBB1y2w8imwSVNLrrn9soOECA16N3YfGk3g89M6vQ=; fh=guNTip1gghJyPTtuudVxgoWLqscAZe1uQmU0RTepgqw=; b=O3spTYanjYQPZHFnRGgkMj+SflL3TRfdKtDZDg3TeBnjH5ymhHPPYdKjVNbHW/nQ7u fFiyr454btKTnZGO+iRXtaNjjYn/Fa1zNir0+vXN/FwE1oxWjMZPG7f8+QcRhVAPwnGK 2TpAbYQC6TuT8ICmtMO9HA1APk3f3av7g50/rIe3gW6PPfOdgXjwNf5NokaJ2Bl0EpNi 3c9IaXJhsKhp0hjZoKvIP6r/LeQ6LvzDX5mOlUsvMcTL/h3/M66UqvNaFhZCSf8qiX82 2e5DpSo6dccXoNMHR73mstWjEXB77m+eqrTzY6Utk1hH7ORis6W9FrtUoqczC1IN8sQf Q/4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="UtcX/Hcf"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bm13-20020a656e8d000000b005be00224982si15548942pgb.381.2023.11.29.00.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 00:39:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="UtcX/Hcf"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 21A108042B76; Wed, 29 Nov 2023 00:38:54 -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 S231709AbjK2ITU (ORCPT + 99 others); Wed, 29 Nov 2023 03:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbjK2ITM (ORCPT ); Wed, 29 Nov 2023 03:19:12 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DB319B9; Wed, 29 Nov 2023 00:19:19 -0800 (PST) Date: Wed, 29 Nov 2023 08:19:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701245957; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mYdBB1y2w8imwSVNLrrn9soOECA16N3YfGk3g89M6vQ=; b=UtcX/Hcf7jPXWc141+40L2ZXuvKBhZWrO8QRoQ6/4ypymh44JbStMItEHZzQkj2/F7BH3p QTCZnPldwjw/LLiYdkvZfTpBvHWMJ6l00MDbtIjyeDvU5W0g2tRDmzEJLknrBmwXXj9not gw47QosVa8yN5G+fIP4ESL2rVB5hPdZUAZaDacgO22gIxSCiTR5SOeRDowAFGmAD0KjnJS G599Sh+LawMhSl1/umoLUaMEVjbXxX4gtdP1Lk2PHooX+OH31Zf2htdLQGU1CpXFGWgknL ScDHccvQMQlWGCbJ0VF3ZVOxQTb3VhVF97Zi4QckJtRU3RJleXFLjaTtFme9Qw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701245957; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mYdBB1y2w8imwSVNLrrn9soOECA16N3YfGk3g89M6vQ=; b=1+T2/IDX8RePLv3IE9GKwafkJZXMIoE5Ra3UPUVojvVAGG0Ua3tAJBw/goqMg7zq9U5YTh i1NUKXa7RsqD38DQ== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel/uncore: Generic uncore_get_uncores and MMIO format of SPR Cc: Kan Liang , "Peter Zijlstra (Intel)" , Ammy Yi , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231117163939.2468007-1-kan.liang@linux.intel.com> References: <20231117163939.2468007-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <170124595695.398.7379358629309121857.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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]); Wed, 29 Nov 2023 00:38:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782830094266582978 X-GMAIL-MSGID: 1783886921589424223 The following commit has been merged into the perf/core branch of tip: Commit-ID: cf35791476fcb3230b98a42241a56242d60ebdd3 Gitweb: https://git.kernel.org/tip/cf35791476fcb3230b98a42241a56242d60ebdd3 Author: Kan Liang AuthorDate: Fri, 17 Nov 2023 08:39:35 -08:00 Committer: Peter Zijlstra CommitterDate: Fri, 24 Nov 2023 20:25:00 +01:00 perf/x86/intel/uncore: Generic uncore_get_uncores and MMIO format of SPR 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. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Tested-by: Ammy Yi Link: https://lore.kernel.org/r/20231117163939.2468007-1-kan.liang@linux.intel.com --- 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 8250f0f..fc65870 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; }