From patchwork Wed Oct 4 02:02:19 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: 148140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2469454vqb; Tue, 3 Oct 2023 19:04:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWZVb5VgJo89TDMeFW8mEZkb1o5jEL7C6L5VAkK21WtJbgymVfDbg2SqfILIcbMNtF2EqC X-Received: by 2002:a67:fd50:0:b0:452:9384:139a with SMTP id g16-20020a67fd50000000b004529384139amr989334vsr.22.1696385046651; Tue, 03 Oct 2023 19:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696385046; cv=none; d=google.com; s=arc-20160816; b=kAnJgIKM0mV0NL2kxSxsrXmB2vvqlShvKglBLZ6n3elOYg1cd0KNc/Y6W+SCaSIQ63 vkYBQmcQ22BzYVGY9bV3fOLLmnXJk+1ov3p6v2o/WKKFBn9piitg9FZRR5YujxJYNExJ U9/0hFsZTU8NFnmfSSyrovyUvlsDfPu4BYHYcV0zO9LSJ6zsHXbzBkzRuBeBJ5J/9trl t2RPfHj5tG6sUyr1i371/aUVCe5MWleaHPFPVzYLeD41ZqUb77YYzQYPqQSZn4wOOWbL crMwe2IJPpZJelS3UGOZr+ISPbdR/lKTRktb3t0hCb8wjCuzKIonh5wQSw8F+Ondap2V LHeQ== 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=Y0uB9/D6WE6wdSDwrdLFRJ5C+LvQTPVM2Rb2lclrzrs=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=B3aFoQelcPdu9LpWfRx2jFi9ujHpD3+OOdfpXvN7AGJYGUaf3I/a178+Nxav90ZS5M Q0wpTu2dfL7l/43nqDJjRWT53zRtI0IiE+KHN52R/QA9bmZETbGxTwUP5uOJqLemXXtL B9JULaFyK9Jwm2oXUiXtbnzbEkQUx1Fzza5697Ni2JPCsXe9sZvWsGV2XKpa25d2cnaS y6KHCXLIWP+VEy/05UpMiGTpsINMDIvzgZ0LVtVekJuGbnFwRPYjjEIiGo3Sucgh12e/ zxI95WXVBHGPW8jmreV2ZDjMdvdBjXID/V8ImdiAKxXHfoTEyc5xKPFEB1tOMM7KQ38b woCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZG/tiCbu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id w190-20020a6382c7000000b00573fbbb7803si2595420pgd.613.2023.10.03.19.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 19:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZG/tiCbu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 96C808198755; Tue, 3 Oct 2023 19:03:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240828AbjJDCCc (ORCPT + 17 others); Tue, 3 Oct 2023 22:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240677AbjJDCC2 (ORCPT ); Tue, 3 Oct 2023 22:02:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 915D8AB; Tue, 3 Oct 2023 19:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696384945; x=1727920945; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=8t2doQA3W76ejo9Q3QbatitHE5eEQv3iv9E0a1M+xEk=; b=ZG/tiCbuVaKqe6iI+ueqfYzk6GgZZqrP+IVTjeRpb5adG78t6+YLnm1k 7/qNq68FhsjLL6/2WBeHTH+QVuHLV4OcsGCJS1Lrep3yc/o5OFCEm7dtR 2ryvaMWWaslF1QE70PjlSMfdsYovqIWlbvHQsz/sbP/WMvmqYqzkxMs5S lDHbaoTSe/6nPJc37/hVm80eLoRx2hwGHH6zLIrUwVIVnw9af2eT7b90A GgKwh3TBTZ7XC6AjN2rVv2Y6YwwqQOZSz1r7fOCKQuAV87voHKa5tEIB1 APFBt52S6Gjx24616HSIAb8SC6J/XkcLkaVdTJrgwBJu/UWzbGNUIq6kq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="413947551" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="413947551" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 19:02:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="841596680" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="841596680" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 19:02:23 -0700 Received: from debox1-desk4.intel.com (unknown [10.209.24.172]) by linux.intel.com (Postfix) with ESMTP id 7B6A8580D99; Tue, 3 Oct 2023 19:02:23 -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 V2 10/13] platform/x86/intel/pmc: Display LPM requirements for multiple PMCs Date: Tue, 3 Oct 2023 19:02:19 -0700 Message-Id: <20231004020222.193445-11-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231004020222.193445-1-david.e.box@linux.intel.com> References: <20231004020222.193445-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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 03 Oct 2023 19:03:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778788646580121557 X-GMAIL-MSGID: 1778788646580121557 From: Rajvi Jingar Update the substate_requirements attribute to display the requirements for all the PMCs on a package. Signed-off-by: Rajvi Jingar --- 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 e58c8cc286a3..df2bcead1723 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);