From patchwork Wed Oct 18 23:16:20 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: 155219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp52269vqb; Wed, 18 Oct 2023 16:18:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9xTdjqT5acsaY7b6/URmOkjRKibIMBnmI9Tf5lJOwIqeBytPSmaG1OheKv0bVBxkclevG X-Received: by 2002:a05:6a20:3c8a:b0:13d:8876:4c97 with SMTP id b10-20020a056a203c8a00b0013d88764c97mr817028pzj.16.1697671109175; Wed, 18 Oct 2023 16:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697671109; cv=none; d=google.com; s=arc-20160816; b=msdTL2tgPRwPsHwzD+Hh5pLbDL8QwYzB/r1tQLlnqq5ZEY5jABBCcXIG26OSjdkQ5O Tdrp4Q+4ChVf3C1TTZpJokENEpUvQ0tVQ/z+u98SLvlCc4+Pmr8l6wjtqBbCOEM4GpV/ nroSC3I4Vg5JdrTkWT+prAMBIQxdv1zS7Z4Bpv8c/L8Or5gcsuhX44xzrWvcZeTAc4Fb RW6I1P6AOtUjJsdalZvwtDnu5HqNFZCmzHaCVzJ0OkaahVlv3Yazh5oDab24eUrxKgsM aKoqh+49zhVkHicRo5vLYf7z0S4spoTuEtqfmr6iWPgz4Nf6NuwslBmzSMxsO8kFFlYK bYkQ== 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=L40fY4ovMukQOhBLBMU+jcJGkdBoESfL3nlmEXAcyME=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=sIGFYbvNjBknB/14PP0kWunEQEe2IZQq3yWOrgsYPqtmPQE/LgumOq7qmKIL4cKlFj o6apQeagWcC0lqBQOi34hZs/KREp+PB/old86q4/rI33KvAZQzF1WnVTId/l9SbcBO1H UvdGmWf1ZOWp0bZ/KkS6Ukc892uhs8aAd3PlnD/1HP3a4ihNUHBu4CICj9XF3WP1as2b fdjvA9gwf8X4fpez9rIb0PbxhpvDVk0NzkYnjSzYwhFk+8bMn4ogYY7ApT83IPAWoJ9A AbH+oWo3RyiFx6/1E3qR5u4WTOXEig+C5oL9dPzHjs3JM96RS0nU8UIPd2ZFKotroNn7 v0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iTYgBMkQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id r21-20020a6560d5000000b005ad8009e301si3154009pgv.250.2023.10.18.16.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 16:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iTYgBMkQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 6267F80EE723; Wed, 18 Oct 2023 16:18:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232153AbjJRXRR (ORCPT + 24 others); Wed, 18 Oct 2023 19:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232267AbjJRXQi (ORCPT ); Wed, 18 Oct 2023 19:16:38 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F813128; Wed, 18 Oct 2023 16:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697670990; x=1729206990; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=nIA54VODlA6cuxaaUaFCvZc22EZAk/2olF7xyeJddrs=; b=iTYgBMkQiRheIyOCgWeTeogtIWJoOalyKYlxrKnedGRjme292XoHILnd Sciywimc4Tx+8PvIU47WW1s48tlWiCbIKz7QKurc64EIK9R+5OZASolPW syXtblkXdy+o797pwMXE1x6NiWimo9eXR7ag8FXFGFhrtA/ZoLs3vtMal e33NqH1Wqj7s07ZrtrE2QDHD0AcXqA2Z8yNR/kPoc586r1G6ib0f+I0tO LLlzDKajSMHHG8vvG7AcuvVHmEW4VKV9qh9XShmT5YVvqSS7IHAsLqYB+ q6nexuVOeY2kVm7aZA9LMRQNhoF5RP37lGnlFpMIX17Xhe6fbTmp6IkKA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="452605966" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="452605966" 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="756782186" X-IronPort-AV: E=Sophos;i="6.03,236,1694761200"; d="scan'208";a="756782186" 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 4586C580DAE; 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 13/17] platform/x86/intel/pmc: Display LPM requirements for multiple PMCs Date: Wed, 18 Oct 2023 16:16:20 -0700 Message-Id: <20231018231624.1044633-14-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=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 16:18:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780137181392957326 X-GMAIL-MSGID: 1780137181392957326 From: Rajvi Jingar Update the substate_requirements attribute to display the requirements for all the PMCs on a package. Signed-off-by: Rajvi Jingar Signed-off-by: David E. Box --- V4 - No change V3 - Add missing submitter signoff V2 - no change drivers/platform/x86/intel/pmc/core.c | 129 ++++++++++++++------------ 1 file changed, 71 insertions(+), 58 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 3894119d61b0..fcb0dc702aea 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -728,7 +728,7 @@ static int pmc_core_substate_l_sts_regs_show(struct seq_file *s, void *unused) } DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_l_sts_regs); -static void pmc_core_substate_req_header_show(struct seq_file *s) +static void pmc_core_substate_req_header_show(struct seq_file *s, int pmc_index) { struct pmc_dev *pmcdev = s->private; int i, mode; @@ -743,68 +743,81 @@ static void pmc_core_substate_req_header_show(struct seq_file *s) static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused) { struct pmc_dev *pmcdev = s->private; - struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; - const struct pmc_bit_map **maps = pmc->map->lpm_sts; - const struct pmc_bit_map *map; - const int num_maps = pmc->map->lpm_num_maps; - u32 sts_offset = pmc->map->lpm_status_offset; - u32 *lpm_req_regs = pmc->lpm_req_regs; - int mp; - - /* Display the header */ - pmc_core_substate_req_header_show(s); - - /* Loop over maps */ - for (mp = 0; mp < num_maps; mp++) { - u32 req_mask = 0; - u32 lpm_status; - int mode, idx, i, len = 32; - - /* - * Capture the requirements and create a mask so that we only - * show an element if it's required for at least one of the - * enabled low power modes - */ - pmc_for_each_mode(idx, mode, pmcdev) - req_mask |= lpm_req_regs[mp + (mode * num_maps)]; - - /* Get the last latched status for this map */ - lpm_status = pmc_core_reg_read(pmc, sts_offset + (mp * 4)); - - /* Loop over elements in this map */ - map = maps[mp]; - for (i = 0; map[i].name && i < len; i++) { - u32 bit_mask = map[i].bit_mask; - - if (!(bit_mask & req_mask)) - /* - * Not required for any enabled states - * so don't display - */ - continue; - - /* Display the element name in the first column */ - seq_printf(s, "%30s |", map[i].name); - - /* Loop over the enabled states and display if required */ - pmc_for_each_mode(idx, mode, pmcdev) { - if (lpm_req_regs[mp + (mode * num_maps)] & bit_mask) - seq_printf(s, " %9s |", - "Required"); + u32 sts_offset; + u32 *lpm_req_regs; + int num_maps, mp, pmc_index; + + for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs); ++pmc_index) { + struct pmc *pmc = pmcdev->pmcs[pmc_index]; + const struct pmc_bit_map **maps; + + if (!pmc) + continue; + + maps = pmc->map->lpm_sts; + num_maps = pmc->map->lpm_num_maps; + sts_offset = pmc->map->lpm_status_offset; + lpm_req_regs = pmc->lpm_req_regs; + + if (!lpm_req_regs) + continue; + + /* Display the header */ + pmc_core_substate_req_header_show(s, pmc_index); + + /* Loop over maps */ + for (mp = 0; mp < num_maps; mp++) { + u32 req_mask = 0; + u32 lpm_status; + const struct pmc_bit_map *map; + int mode, idx, i, len = 32; + + /* + * Capture the requirements and create a mask so that we only + * show an element if it's required for at least one of the + * enabled low power modes + */ + pmc_for_each_mode(idx, mode, pmcdev) + req_mask |= lpm_req_regs[mp + (mode * num_maps)]; + + /* Get the last latched status for this map */ + lpm_status = pmc_core_reg_read(pmc, sts_offset + (mp * 4)); + + /* Loop over elements in this map */ + map = maps[mp]; + for (i = 0; map[i].name && i < len; i++) { + u32 bit_mask = map[i].bit_mask; + + if (!(bit_mask & req_mask)) { + /* + * Not required for any enabled states + * so don't display + */ + continue; + } + + /* Display the element name in the first column */ + seq_printf(s, "pmc%d: %26s |", pmc_index, map[i].name); + + /* Loop over the enabled states and display if required */ + pmc_for_each_mode(idx, mode, pmcdev) { + if (lpm_req_regs[mp + (mode * num_maps)] & bit_mask) + seq_printf(s, " %9s |", + "Required"); + else + seq_printf(s, " %9s |", " "); + } + + /* In Status column, show the last captured state of this agent */ + if (lpm_status & bit_mask) + seq_printf(s, " %9s |", "Yes"); else seq_printf(s, " %9s |", " "); + + seq_puts(s, "\n"); } - - /* In Status column, show the last captured state of this agent */ - if (lpm_status & bit_mask) - seq_printf(s, " %9s |", "Yes"); - else - seq_printf(s, " %9s |", " "); - - seq_puts(s, "\n"); } } - return 0; } DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_req_regs);