From patchwork Wed Oct 18 23:16:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 155215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp51972vqb; Wed, 18 Oct 2023 16:17:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOG4aGj57XPCtKbJypoXCPBIjH+pntID6ivmv9+ttQHqVqbuyr9vnfrSMbE6M9esKOjPjA X-Received: by 2002:a05:6808:bd6:b0:3b2:d8cb:8e14 with SMTP id o22-20020a0568080bd600b003b2d8cb8e14mr758346oik.28.1697671065900; Wed, 18 Oct 2023 16:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697671065; cv=none; d=google.com; s=arc-20160816; b=h2Kf00x3xlSwM0+wQ9JYdYIdmUg6UPak4E7tQRbIBsZJvEEdK66gDCzDHUCJQr7H67 qHUCmppCmyOKISJOCbivgay4qaKN3R02r03PnWvA3Oy/rw06kednaTHAQ7CGCTtX+YpD SWRNB1io0WEq5Wtu2nZavFmmWiBb6C0AiioEEExmXlc+GRdc/4q3Ugax4Dr+cQIi0yYx J4UptN2OBdaLDjkc0aVRK0tSNv8l+pzM8x4n88SShrfcVMoF/j0lfQ/yurQuQMIvdn+N 9YqfCvONvNCIWSuzU2Uqkx7ohY9wNPts+gnCdM7b17czhYtfHWexFZzKwDa02oi8dW+t w2PA== 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:to:from :dkim-signature; bh=+vps5+aKlm3MUB/AB6aXEl6A1VQmAMaBFuuVNdVPYbQ=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=YiIaVKfs65BlxJVXTEZF3rDsKEzVv0EyacyDlireb94fzztHvtY2InMkaMuDnQ4BsG VrDr44mUlqd0yTEGzne8VMoWCeq+UaHajK/70np1MUZZOuylbqsJ+GFFiXSIYeGJJwah cAVpUfugdLD3+gUtNnA2RXq6C+e4yP6xQxI7ElaN0Y3NnlvliE2+/GuF1QNgNgQR1G91 UUaZQ73dif9/zNWovK1XS8F1gHQYhjRT+7CFz2erwMGLT+tBNg0mmfPbHsItJ2c4scc2 139wYsZRT6eNv4mMsNdMPDBNXG4vuBziF3yTYI1GJLXg6WnjIOxQVaqoSx68J4+4CdkG fRog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gv8yrTTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bw24-20020a056a02049800b00585a5e9a965si3373334pgb.161.2023.10.18.16.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 16:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gv8yrTTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 295D7820E528; Wed, 18 Oct 2023 16:17:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232678AbjJRXR1 (ORCPT + 24 others); Wed, 18 Oct 2023 19:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjJRXQj (ORCPT ); Wed, 18 Oct 2023 19:16:39 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F2DD137; Wed, 18 Oct 2023 16:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697670992; x=1729206992; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=tT6v07z/aEzJofzP9mclW5quS4WFjstuU/PBm1R8Ji0=; b=Gv8yrTTZ+SxAY6B32oUp0G2YTMPjh8BErssICi3WZI5UOJnceSKwBkSW XypJJ3XK50EjCIi+Ji/ulp5zMpS/vbLwrsSmNjyLEQK++NSxynjRtNavQ VVNj3jcwA8izoyoQ7I+4yz1cbj2c0SIKF/rvng/ctIm5LU62rI1taFatl eyQAU+ZNjPTqnJZAO+NOO9uMKYWaYocTaTw7seXOI8oeta9uHqtT3fOHj SDZjLawu+Xu27FXqYqb7pPXQqKE5Fb0wuNO4kgzX8UJExTN5U+FB0YBeu wLyH7+tVFFwYZ/Up1FmDL/XgNa8v9ofUaLMhKuPfaTeZqnYZIRzcAxuid Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="452605969" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="452605969" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 16:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="756782189" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="756782189" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 16:16:26 -0700 Received: from debox1-desk4.lan (unknown [10.209.71.91]) by linux.intel.com (Postfix) with ESMTP id BBCBE580E33; Wed, 18 Oct 2023 16:16:26 -0700 (PDT) From: "David E. Box" To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH V4 17/17] platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake Date: Wed, 18 Oct 2023 16:16:24 -0700 Message-Id: <20231018231624.1044633-18-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018231624.1044633-1-david.e.box@linux.intel.com> References: <20231018231624.1044633-1-david.e.box@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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]); Wed, 18 Oct 2023 16:17:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780137135606124594 X-GMAIL-MSGID: 1780137135606124594 Expose the Die C6 counter on Meteor Lake. Signed-off-by: David E. Box Reviewed-by: Ilpo Järvinen --- V4 - no change V3 - Split PATCH V2 13. Separates implementation (previous patch) from platform specific use (this patch) drivers/platform/x86/intel/pmc/mtl.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c index 7ceeae507f4c..38c2f946ec23 100644 --- a/drivers/platform/x86/intel/pmc/mtl.c +++ b/drivers/platform/x86/intel/pmc/mtl.c @@ -10,12 +10,17 @@ #include #include "core.h" +#include "../pmt/telemetry.h" /* PMC SSRAM PMT Telemetry GUIDS */ #define SOCP_LPM_REQ_GUID 0x2625030 #define IOEM_LPM_REQ_GUID 0x4357464 #define IOEP_LPM_REQ_GUID 0x5077612 +/* Die C6 from PUNIT telemetry */ +#define MTL_PMT_DMU_DIE_C6_OFFSET 15 +#define MTL_PMT_DMU_GUID 0x1A067102 + static const u8 MTL_LPM_REG_INDEX[] = {0, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20}; /* @@ -968,6 +973,32 @@ static struct pmc_info mtl_pmc_info_list[] = { {} }; +static void mtl_punit_pmt_init(struct pmc_dev *pmcdev) +{ + struct telem_endpoint *ep; + struct pci_dev *pcidev; + + pcidev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(10, 0)); + if (!pcidev) { + dev_err(&pmcdev->pdev->dev, "PUNIT PMT device not found.\n"); + return; + } + + ep = pmt_telem_find_and_register_endpoint(pcidev, MTL_PMT_DMU_GUID, 0); + if (IS_ERR(ep)) { + dev_err(&pmcdev->pdev->dev, + "pmc_core: couldn't get DMU telem endpoint, %ld\n", + PTR_ERR(ep)); + return; + } + + pci_dev_put(pcidev); + pmcdev->punit_ep = ep; + + pmcdev->has_die_c6 = true; + pmcdev->die_c6_offset = MTL_PMT_DMU_DIE_C6_OFFSET; +} + #define MTL_GNA_PCI_DEV 0x7e4c #define MTL_IPU_PCI_DEV 0x7d19 #define MTL_VPU_PCI_DEV 0x7d1d @@ -1032,6 +1063,7 @@ int mtl_core_init(struct pmc_dev *pmcdev) } pmc_core_get_low_power_modes(pmcdev); + mtl_punit_pmt_init(pmcdev); /* Due to a hardware limitation, the GBE LTR blocks PC10 * when a cable is attached. Tell the PMC to ignore it.