From patchwork Thu Oct 12 02:38:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 151652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp942713vqb; Wed, 11 Oct 2023 19:39:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPgW6DcEwlVECpUEyJZyurmy4AKQx1yYa9gtUychcNFI9JQxspKzmjkYc0ShXaxY8iV+OI X-Received: by 2002:a05:6808:3388:b0:3ab:8ae5:e7c6 with SMTP id ce8-20020a056808338800b003ab8ae5e7c6mr22072744oib.1.1697078373807; Wed, 11 Oct 2023 19:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697078373; cv=none; d=google.com; s=arc-20160816; b=W/PaLnriPDmSvbgO0U/Wghg5pJwZxCt9Vj5IoMbpSXSi7u2b7CEEyi6lTohDzXUzig 5g+/pub8L5QVoTfyf7b9r8SXMD+KElx65U6mODWpBbPzKMogVEUbeuZEsAJwhiOYuU7c l6qA43N0iuEDM+ECsoy7YJTiADB9joCknQNWITtDEfc9d8Tp4/5oEn0Vda+SY55u0SNS AeCYOg5Kd/uKQVDboe919ya9roH+7gmXrxe/NhDYf7JoJX4If+FEmv4XQ5uCgW048OOh IMqpGZlSDmKps/x/1SXs1iRo/f3JW0KqlbB6Pe6sx5DX9zg5SbsKDbFWumdo+oANFYSP f34Q== 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=5igJtFsutkmRQEwx1ypnmXXt1/Gn0R8UBV0I7i4d3SM=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=tmUtzH6SjtzAgdBDGlJiBVYGFUt2zfqKgOPeFmLJhyDpaj9mH0WOIJ/w+vZBT0KWno L32Jb4d4HPDXd42aF5G4Rmn0UxjlWi1VWt+gkkDaUCiO2zdk+8atQ7HEy6IVA9ah2Y8o +XeFrbx3CBsQtTRo46AXxsOpxlG9o8jXhmPDCOdoMitMXBixhUuXWoxD+kgWtToGg4LS 4Rrp+wrM9DiI4BKHFL8ccjyaJZr2wH04tn24QfPHbVB/YYaY8l4vRCxCCVkM20Lk1NIJ C4+AVauEHAzGE4r58LwFQzc5St328P0D5NH09I4cKguGa1QNMZ5MulCu5Uey2P5gfyzX zcfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=brkMSsvf; 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 n27-20020a634d5b000000b00578dfa34d95si1129336pgl.574.2023.10.11.19.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 19:39:33 -0700 (PDT) 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=brkMSsvf; 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 579B281E64BD; Wed, 11 Oct 2023 19:39:32 -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 S1376666AbjJLCj3 (ORCPT + 18 others); Wed, 11 Oct 2023 22:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376824AbjJLCiw (ORCPT ); Wed, 11 Oct 2023 22:38:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4629DD3; Wed, 11 Oct 2023 19:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697078329; x=1728614329; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=oAUveAvdtna8f06zEJwix8Mg346cwI/ZjTYXEiCeEBw=; b=brkMSsvfPC7g7UMklXlFC1d+QVTA/1UKguKP2dDGowLq0ApCMDi6eEwO B1L+P3mPRlepIhdZrIrDs38YkurZcsOi2aIkojAYVlWegAUuyTVQFmPwk ABF/RZWNXx8QA/tO2ydIWUwxWhfRMKWKtDhiMVxVbF6dqixz3S1VvyaE0 cBoude7xTylyTwB36YDNZW4+dzsIwjvn70PmeFMdQfHC76VvzQWPtV9Jd zQ7etwttgs14lJoYc0UnnJsdoJ7DT7jo+opc9GqNPBdPj3C7r6AhlxLzJ nhJEf4+yaeJqT3JRu75WqUmJCV7Omx8IhCFMv1+GXu8qg5qj4Mby5fQh4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="3402637" X-IronPort-AV: E=Sophos;i="6.03,217,1694761200"; d="scan'208";a="3402637" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 19:38:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="783507875" X-IronPort-AV: E=Sophos;i="6.03,217,1694761200"; d="scan'208";a="783507875" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 19:38:43 -0700 Received: from debox1-desk4.intel.com (unknown [10.209.105.238]) by linux.intel.com (Postfix) with ESMTP id 30186580D79; Wed, 11 Oct 2023 19:38:43 -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 V3 16/16] platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake Date: Wed, 11 Oct 2023 19:38:40 -0700 Message-Id: <20231012023840.3845703-17-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231012023840.3845703-1-david.e.box@linux.intel.com> References: <20231012023840.3845703-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, 11 Oct 2023 19:39:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779515652818256170 X-GMAIL-MSGID: 1779515652818256170 Expose the Die C6 counter on Meteor Lake. Signed-off-by: David E. Box --- 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.