From patchwork Thu Nov 24 12:02:52 2022 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: 25487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3356299wrr; Thu, 24 Nov 2022 04:08:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4PtBmK4eFVVuo+CQBdrCt7STQW2lNjVpLRn10zM+nMoLdNlugtSVN2K/or7kC+Nk8n88T6 X-Received: by 2002:a17:906:2bcb:b0:7b8:4d91:1bcd with SMTP id n11-20020a1709062bcb00b007b84d911bcdmr10658900ejg.239.1669291722655; Thu, 24 Nov 2022 04:08:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669291722; cv=none; d=google.com; s=arc-20160816; b=gdzMDcXVkX9Ie41J9Y+LYRzioZMAjA4zI2U24vWIbsCQApaic4Ws2pNgstYAyWkkGc mHUDvpj1fBhS8VZJitUEWVg582dwOgxMVUi4JWtLXstTALj5TdlRRNMtqx2eHwqfEXW0 mke2z36kInT2S4TFHOzFut8ltoFixzZ8Z5ZfXi2NsjXZMNUiPFReqY83RKF/7hYXUJv2 BodKHLnYlOgbdNni6NZCm08Sa7VhO+1F/kDXVGTT01D2UFCroL4FzGRjEAoqkA927XcU ZjSE6+70SVdvAAEzjb/SU2OgJl/IJtmULJj4ZhmsPVE14kjvIEFSQb62TBvJ91ZX/+EI yofQ== 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=dd1LmwmVBOjaFol/GblfD0929B3ZMFGVk5MHkiZ3ohU=; b=dHTBKVfSZVwAbH1PVPiIAwtI6Qe5eo78l2rFAE5CNEuWIaiULOzRwXrkpVjCiHUnuD 1q+6onhieRr4Xf/nc5Jx22HXBGBxYLSfwNxUdhhbd8FdT8hopYf0fnoYTuZEUqN8jwms WlcgztqRBNNNJ19v+Lq6orsSWsHyopkIORfjBV/tE7wO3L+TSLNpY1sD9AfOrtUn/U21 iE3NIenepZOMptylaO0xIVyYcdP+lF2PaucjEoWbsHVwUt2uH3jYCJETEdJsRIM08GbU WdgTBgaQ8QdGrcmxDqewnjY1fg6dEjh0o2IeJu9aQN+aODbo7jERxTLEL/FmiGK7UsVS FlSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TbLSLQNV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg42-20020a170907972a00b007a6ec03b13bsi776712ejc.799.2022.11.24.04.08.17; Thu, 24 Nov 2022 04:08:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TbLSLQNV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbiKXMDM (ORCPT + 99 others); Thu, 24 Nov 2022 07:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbiKXMC5 (ORCPT ); Thu, 24 Nov 2022 07:02:57 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DAC0429AF; Thu, 24 Nov 2022 04:02:56 -0800 (PST) Date: Thu, 24 Nov 2022 12:02:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669291374; 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=dd1LmwmVBOjaFol/GblfD0929B3ZMFGVk5MHkiZ3ohU=; b=TbLSLQNVbwfxWN9AvGz5Jdj8+OlVIvUjfdQtPueGEpta/tJSp1BEgJowZfdTosFa10fxe0 cv9ta3C9Y6e4Wx9dDTfEOirXb8S0O+o9qmU+Lpd4lIf7DFTzNIpKFgM+/ITW7oazR3Pq9i yUYvFBc+G9mBMP58rZ6cOLyVxGxz3Lfnkq1xoXrg5V7LQ8DdaTTVgZldBOKTlXzUCpdkXU asoWDrE6siDce03Y8XxMApccn2Ob86x3OpCCdRs1y1HboJIoSfT6NN14yDwEgjVneH4nnI ikv9JYbEjxk4jiHNMPP8VwTsb+D3jPBV3JaQwSGKflIw6R9Myj5eB1zFe681dw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669291374; 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=dd1LmwmVBOjaFol/GblfD0929B3ZMFGVk5MHkiZ3ohU=; b=/MNCgWN9yrKoZlUqKQ66M5+JlCzqS3TIOiREAWpQXQ9rZsvpO8bFi8EjgJCImDLHSVySc7 4vvx7LH0mG+yNsAQ== From: "tip-bot2 for Alexander Antonov" 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: Enable UPI topology discovery for Sapphire Rapids Cc: Alexander Antonov , "Peter Zijlstra (Intel)" , Kan Liang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221117122833.3103580-10-alexander.antonov@linux.intel.com> References: <20221117122833.3103580-10-alexander.antonov@linux.intel.com> MIME-Version: 1.0 Message-ID: <166929137262.4906.16113917831053227871.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749746676071751330?= X-GMAIL-MSGID: =?utf-8?q?1750379237146760728?= The following commit has been merged into the perf/core branch of tip: Commit-ID: 9a3b675cd393a4430d5e6cbf94c5de43414613cd Gitweb: https://git.kernel.org/tip/9a3b675cd393a4430d5e6cbf94c5de43414613cd Author: Alexander Antonov AuthorDate: Thu, 17 Nov 2022 12:28:31 Committer: Peter Zijlstra CommitterDate: Thu, 24 Nov 2022 11:09:23 +01:00 perf/x86/intel/uncore: Enable UPI topology discovery for Sapphire Rapids UPI topology discovery on SPR is same as in ICX but UBOX device has different Device ID 0x3250. This patch enables /sys/devices/uncore_upi_*/die* attributes on SPR. Signed-off-by: Alexander Antonov Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kan Liang Link: https://lore.kernel.org/r/20221117122833.3103580-10-alexander.antonov@linux.intel.com --- arch/x86/events/intel/uncore_snbep.c | 43 ++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index d45f584..4c2d5b5 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -458,6 +458,7 @@ /* SPR */ #define SPR_RAW_EVENT_MASK_EXT 0xffffff +#define SPR_UBOX_DID 0x3250 /* SPR CHA */ #define SPR_CHA_PMON_CTL_TID_EN (1 << 16) @@ -6112,9 +6113,43 @@ static struct intel_uncore_type spr_uncore_m2m = { .name = "m2m", }; +static struct attribute_group spr_upi_mapping_group = { + .is_visible = skx_upi_mapping_visible, +}; + +static const struct attribute_group *spr_upi_attr_update[] = { + &uncore_alias_group, + &spr_upi_mapping_group, + NULL +}; + +#define SPR_UPI_REGS_ADDR_DEVICE_LINK0 0x01 + +static int spr_upi_set_mapping(struct intel_uncore_type *type) +{ + return pmu_upi_set_mapping(type, &spr_upi_mapping_group); +} + +static void spr_upi_cleanup_mapping(struct intel_uncore_type *type) +{ + pmu_cleanup_mapping(type, &spr_upi_mapping_group); +} + +static int spr_upi_get_topology(struct intel_uncore_type *type) +{ + return discover_upi_topology(type, SPR_UBOX_DID, SPR_UPI_REGS_ADDR_DEVICE_LINK0); +} + static struct intel_uncore_type spr_uncore_upi = { - SPR_UNCORE_PCI_COMMON_FORMAT(), + .event_mask = SNBEP_PMON_RAW_EVENT_MASK, + .event_mask_ext = SPR_RAW_EVENT_MASK_EXT, + .format_group = &spr_uncore_raw_format_group, + .ops = &spr_uncore_pci_ops, .name = "upi", + .attr_update = spr_upi_attr_update, + .get_topology = spr_upi_get_topology, + .set_mapping = spr_upi_set_mapping, + .cleanup_mapping = spr_upi_cleanup_mapping, }; static struct intel_uncore_type spr_uncore_m3upi = { @@ -6318,6 +6353,12 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type, to_type->format_group = from_type->format_group; if (from_type->attr_update) to_type->attr_update = from_type->attr_update; + if (from_type->set_mapping) + to_type->set_mapping = from_type->set_mapping; + if (from_type->get_topology) + to_type->get_topology = from_type->get_topology; + if (from_type->cleanup_mapping) + to_type->cleanup_mapping = from_type->cleanup_mapping; } static struct intel_uncore_type **