Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8815414rwb; Thu, 24 Nov 2022 04:48:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf51M0Mzc+xfx3O5UprShdghbf5gqe4DRRBoGJ5BbbkoNgAfPDz79QBHwioOuC0QGzQf4zVE X-Received: by 2002:a63:114b:0:b0:46a:e00b:ada0 with SMTP id 11-20020a63114b000000b0046ae00bada0mr15191220pgr.409.1669294110859; Thu, 24 Nov 2022 04:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294110; cv=none; d=google.com; s=arc-20160816; b=pSRMM3PLQtBEqyJGnJHqsg3YoA8/tflkNeuPnyGvF8IzPNOMuixPPK05Op6BbvuLdQ 0lvlPoTUlKiAL6hoptBd021KujfrQg/slK7cO/dgGVLk3JiPHOns/g983bsdhIT5sVcU NPfDCsDEgsc2E4LhDzi54syChoFTmqbkNqCb+zLPdadWe6ImMBzH74FthizCq+TBzR8i leDPjYeoTF1AA3FQAM+fzPqpuoavsNWViT+s7HgRY8+BW1qbTucQYTCyR6aXmfw3xXeS Ex+0CDDEajkC2+4qRvkkHf/i1mgrHorIYodh6eFVgIDENCut5vlUsy6mFXoINnL6JBT0 BATw== 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 header.s=2020e header.b="/MNCgWN9"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw5-20020a17090b4d0500b00218af09d1f4si1425760pjb.37.2022.11.24.04.48.18; Thu, 24 Nov 2022 04:48:30 -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 header.s=2020e header.b="/MNCgWN9"; 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 + 86 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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 **