From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Xi Pardee <xi.pardee@linux.intel.com>
Cc: irenic.rajneesh@gmail.com, david.e.box@linux.intel.com,
Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 2/5] platform/x86:intel/pmc: Move telemetry endpoint register handling
Date: Mon, 30 Jun 2025 14:25:19 +0300 (EEST) [thread overview]
Message-ID: <a40aa7c1-084c-e49c-33ee-57088a58debe@linux.intel.com> (raw)
In-Reply-To: <20250625063145.624585-3-xi.pardee@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4189 bytes --]
On Tue, 24 Jun 2025, Xi Pardee wrote:
> Move telemetry endpoint handling to pmc_core_get_telem_info(). This
> is a preparation patch to introduce a new table to obtain Low Power
> Mode substate requirement data for platforms starting from Panther
> Lake.
>
> Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
> ---
> drivers/platform/x86/intel/pmc/core.c | 51 +++++++++++++--------------
> 1 file changed, 25 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
> index 540cd2fb0673b..a1dd80bdbd413 100644
> --- a/drivers/platform/x86/intel/pmc/core.c
> +++ b/drivers/platform/x86/intel/pmc/core.c
> @@ -1399,36 +1399,23 @@ static u32 pmc_core_find_guid(struct pmc_info *list, const struct pmc_reg_map *m
> * +----+---------------------------------------------------------+
> *
> */
> -static int pmc_core_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc, struct pci_dev *pcidev)
> +static int pmc_core_pmt_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc,
> + struct telem_endpoint *ep)
> {
> - struct telem_endpoint *ep;
> const u8 *lpm_indices;
> int num_maps, mode_offset = 0;
> int ret, mode;
> int lpm_size;
> - u32 guid;
>
> lpm_indices = pmc->map->lpm_reg_index;
> num_maps = pmc->map->lpm_num_maps;
> lpm_size = LPM_MAX_NUM_MODES * num_maps;
>
> - guid = pmc_core_find_guid(pmcdev->regmap_list, pmc->map);
> - if (!guid)
> - return -ENXIO;
> -
> - ep = pmt_telem_find_and_register_endpoint(pcidev, guid, 0);
> - if (IS_ERR(ep)) {
> - dev_dbg(&pmcdev->pdev->dev, "couldn't get telem endpoint %pe", ep);
> - return -EPROBE_DEFER;
> - }
> -
> pmc->lpm_req_regs = devm_kzalloc(&pmcdev->pdev->dev,
> lpm_size * sizeof(u32),
> GFP_KERNEL);
> - if (!pmc->lpm_req_regs) {
> - ret = -ENOMEM;
> - goto unregister_ep;
> - }
> + if (!pmc->lpm_req_regs)
> + return -ENOMEM;
>
> mode_offset = LPM_HEADER_OFFSET + LPM_MODE_OFFSET;
> pmc_for_each_mode(mode, pmcdev) {
> @@ -1442,23 +1429,21 @@ static int pmc_core_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc, struct
> if (ret) {
> dev_err(&pmcdev->pdev->dev,
> "couldn't read Low Power Mode requirements: %d\n", ret);
> - goto unregister_ep;
> + return ret;
> }
> ++req_offset;
> }
> mode_offset += LPM_REG_COUNT + LPM_MODE_OFFSET;
> }
> -
> -unregister_ep:
> - pmt_telem_unregister_endpoint(ep);
> -
> return ret;
> }
>
> -static int pmc_core_ssram_get_lpm_reqs(struct pmc_dev *pmcdev, int func)
> +static int pmc_core_get_telem_info(struct pmc_dev *pmcdev, int func)
> {
> struct pci_dev *pcidev __free(pci_dev_put) = NULL;
> + struct telem_endpoint *ep;
> unsigned int i;
> + u32 guid;
> int ret;
>
> pcidev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(20, func));
> @@ -1466,10 +1451,24 @@ static int pmc_core_ssram_get_lpm_reqs(struct pmc_dev *pmcdev, int func)
> return -ENODEV;
>
> for (i = 0; i < ARRAY_SIZE(pmcdev->pmcs); ++i) {
> - if (!pmcdev->pmcs[i])
> + struct pmc *pmc;
> +
> + pmc = pmcdev->pmcs[i];
> + if (!pmc)
> continue;
>
> - ret = pmc_core_get_lpm_req(pmcdev, pmcdev->pmcs[i], pcidev);
> + guid = pmc_core_find_guid(pmcdev->regmap_list, pmc->map);
> + if (!guid)
> + return -ENXIO;
> +
> + ep = pmt_telem_find_and_register_endpoint(pcidev, guid, 0);
> + if (IS_ERR(ep)) {
> + dev_dbg(&pmcdev->pdev->dev, "couldn't get telem endpoint %pe", ep);
> + return -EPROBE_DEFER;
> + }
> +
> + ret = pmc_core_pmt_get_lpm_req(pmcdev, pmc, ep);
> + pmt_telem_unregister_endpoint(ep);
> if (ret)
> return ret;
> }
> @@ -1583,7 +1582,7 @@ int generic_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)
> pmc_core_punit_pmt_init(pmcdev, pmc_dev_info->dmu_guid);
>
> if (ssram) {
> - ret = pmc_core_ssram_get_lpm_reqs(pmcdev, pmc_dev_info->pci_func);
> + ret = pmc_core_get_telem_info(pmcdev, pmc_dev_info->pci_func);
> if (ret)
> goto unmap_regbase;
> }
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2025-06-30 11:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 6:31 [PATCH v2 0/5] Enable SSRAM support in PTL and LNL Xi Pardee
2025-06-25 6:31 ` [PATCH v2 1/5] platform/x86:intel/pmc: Enable SSRAM support for Lunar Lake Xi Pardee
2025-06-30 11:25 ` Ilpo Järvinen
2025-06-25 6:31 ` [PATCH v2 2/5] platform/x86:intel/pmc: Move telemetry endpoint register handling Xi Pardee
2025-06-30 11:25 ` Ilpo Järvinen [this message]
2025-06-25 6:31 ` [PATCH v2 3/5] platform/x86:intel/pmc: Improve function to show substate header Xi Pardee
2025-06-30 11:34 ` Ilpo Järvinen
2025-06-30 17:35 ` Xi Pardee
2025-06-25 6:31 ` [PATCH v2 4/5] platform/x86:intel/pmc: Show substate requirement for S0ix blockers Xi Pardee
2025-06-26 16:38 ` Ilpo Järvinen
2025-06-26 21:16 ` Xi Pardee
2025-06-27 8:08 ` Ilpo Järvinen
2025-06-30 18:01 ` Xi Pardee
2025-06-25 6:31 ` [PATCH v2 5/5] platform/x86:intel/pmc: Enable SSRAM support for Panther Lake Xi Pardee
2025-06-30 11:28 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a40aa7c1-084c-e49c-33ee-57088a58debe@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=david.e.box@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=irenic.rajneesh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=xi.pardee@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.