DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: Sivaprasad Tummala <sivaprasad.tummala@amd.com>,
	<anatoly.burakov@intel.com>, <jerinj@marvell.com>,
	<lihuisong@huawei.com>, <david.marchand@redhat.com>,
	<ferruh.yigit@amd.com>, <konstantin.ananyev@huawei.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH v1 4/4] power/amd_uncore: uncore power management support for AMD EPYC processors
Date: Tue, 23 Jul 2024 11:33:00 +0100	[thread overview]
Message-ID: <319a72e5-b1ef-4ee2-a9f4-6318c38e32b5@intel.com> (raw)
In-Reply-To: <20240720165030.246294-5-sivaprasad.tummala@amd.com>


On 20/07/2024 17:50, Sivaprasad Tummala wrote:
> This patch introduces driver support for power management of uncore
> components in AMD EPYC processors.
>
> Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> ---
>   drivers/power/amd_uncore/amd_uncore.c | 321 ++++++++++++++++++++++++++
>   drivers/power/amd_uncore/amd_uncore.h | 226 ++++++++++++++++++
>   drivers/power/amd_uncore/meson.build  |  20 ++
>   drivers/power/meson.build             |   1 +
>   4 files changed, 568 insertions(+)
>   create mode 100644 drivers/power/amd_uncore/amd_uncore.c
>   create mode 100644 drivers/power/amd_uncore/amd_uncore.h
>   create mode 100644 drivers/power/amd_uncore/meson.build
>
> diff --git a/drivers/power/amd_uncore/amd_uncore.c b/drivers/power/amd_uncore/amd_uncore.c
> new file mode 100644
> index 0000000000..f15eaaa307
> --- /dev/null
> +++ b/drivers/power/amd_uncore/amd_uncore.c
> @@ -0,0 +1,321 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2024 Advanced Micro Devices, Inc.
> + */
> +
> +#include <errno.h>
> +#include <dirent.h>
> +#include <fnmatch.h>
> +
> +#include <rte_memcpy.h>
> +
> +#include "amd_uncore.h"
> +#include "power_common.h"
> +#include "e_smi/e_smi.h"
> +
> +#define MAX_UNCORE_FREQS 8
> +#define MAX_NUMA_DIE 8
> +
> +#define BUS_FREQ 1000
> +
> +struct  __rte_cache_aligned uncore_power_info {
> +	unsigned int die;                  /* Core die id */
> +	unsigned int pkg;                  /* Package id */
> +	uint32_t freqs[MAX_UNCORE_FREQS];  /* Frequency array */
> +	uint32_t nb_freqs;                 /* Number of available freqs */
> +	uint32_t curr_idx;                 /* Freq index in freqs array */
> +	uint32_t max_freq;            /* System max uncore freq */
> +	uint32_t min_freq;            /* System min uncore freq */
> +};
> +
> +static struct uncore_power_info uncore_info[RTE_MAX_NUMA_NODES][MAX_NUMA_DIE];
> +static int esmi_initialized;
> +
> +static int
> +set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx)
> +{
> +	int ret;
> +
> +	if (idx >= MAX_UNCORE_FREQS || idx >= ui->nb_freqs) {
> +		POWER_LOG(DEBUG, "Invalid uncore frequency index %u, which "
> +				"should be less than %u", idx, ui->nb_freqs);
> +		return -1;
> +	}
> +
> +	ret = esmi_apb_disable(ui->pkg, idx);
> +	if (ret != ESMI_SUCCESS) {
> +		POWER_LOG(ERR, "DF P-state '%u' set failed for pkg %02u",
> +				idx, ui->pkg);
> +		return -1;
> +	}
> +
> +	POWER_DEBUG_LOG("DF P-state '%u' to be set for pkg %02u die %02u",
> +				idx, ui->pkg, ui->die);
> +
> +	/* write the minimum value first if the target freq is less than current max */
> +	ui->curr_idx = idx;
> +
> +	return 0;
> +}
> +
> +/*
> + * Fopen the sys file for the future setting of the uncore die frequency.
> + */


Comment may need updating, as function is not reading any sysfs files 
(for the moment, at least).


> +static int
> +power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
> +{
> +	/* open and read all uncore sys files */


Comment may need updating, as function is not reading any sysfs files 
(for the moment, at least).



> +	/* Base max */
> +	ui->max_freq = 1800000;
> +	ui->min_freq = 1200000;
> +
> +	return 0;
> +}
> +
> +/*
> + * Get the available uncore frequencies of the specific die by reading the
> + * sys file.
> + */


Comment may need updating, as function is not reading any sysfs files. 3 
uncore frequencies hard-coded for the moment, may get via esmi or sysfs 
in the future.


> +static int
> +power_get_available_uncore_freqs(struct uncore_power_info *ui)
> +{
> +	int ret = -1;
> +	uint32_t i, num_uncore_freqs = 3;
> +	uint32_t fabric_freqs[] = {
> +	/* to be extended for probing support in future */
> +		1800,
> +		1444,
> +		1200
> +	};
> +
> +	if (num_uncore_freqs >= MAX_UNCORE_FREQS) {
> +		POWER_LOG(ERR, "Too many available uncore frequencies: %d",
> +				num_uncore_freqs);
> +		goto out;
> +	}
> +
> +	/* Generate the uncore freq bucket array. */
> +	for (i = 0; i < num_uncore_freqs; i++)
> +		ui->freqs[i] = fabric_freqs[i] * BUS_FREQ;
> +
> +	ui->nb_freqs = num_uncore_freqs;
> +
> +	ret = 0;
> +
> +	POWER_DEBUG_LOG("%d frequency(s) of pkg %02u die %02u are available",
> +			num_uncore_freqs, ui->pkg, ui->die);
> +
> +out:
> +	return ret;
> +}
> +


--snip--

>   

  reply	other threads:[~2024-07-23 10:36 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 15:33 [RFC PATCH 0/2] power: refactor power management library Sivaprasad Tummala
2024-02-20 15:33 ` Sivaprasad Tummala
2024-02-20 15:33 ` [RFC PATCH 1/2] power: refactor core " Sivaprasad Tummala
2024-02-27 16:18   ` Ferruh Yigit
2024-02-29  7:10     ` Tummala, Sivaprasad
2024-02-28 12:51   ` Ferruh Yigit
2024-03-01  2:56   ` lihuisong (C)
2024-03-01 10:39     ` Hunt, David
2024-03-05  4:35     ` Tummala, Sivaprasad
2024-02-20 15:33 ` [RFC PATCH 2/2] power: refactor uncore " Sivaprasad Tummala
2024-03-01  3:33   ` lihuisong (C)
2024-03-01  6:06     ` Tummala, Sivaprasad
2024-07-20 16:50 ` [PATCH v1 0/4] power: refactor " Sivaprasad Tummala
2024-07-20 16:50   ` [PATCH v1 1/4] power: refactor core " Sivaprasad Tummala
2024-07-23 10:03     ` Hunt, David
2024-07-27 18:44       ` Tummala, Sivaprasad
2024-07-20 16:50   ` [PATCH v1 2/4] power: refactor uncore " Sivaprasad Tummala
2024-07-23 10:26     ` Hunt, David
2024-07-20 16:50   ` [PATCH v1 3/4] test/power: removed function pointer validations Sivaprasad Tummala
2024-07-22 10:49     ` Hunt, David
2024-07-27 18:45       ` Tummala, Sivaprasad
2024-07-20 16:50   ` [PATCH v1 4/4] power/amd_uncore: uncore power management support for AMD EPYC processors Sivaprasad Tummala
2024-07-23 10:33     ` Hunt, David [this message]
2024-07-27 18:46       ` Tummala, Sivaprasad
2024-07-20 16:50   ` [PATCH v1 0/4] power: refactor power management library Sivaprasad Tummala
2024-08-26 13:06   ` [PATCH v2 " Sivaprasad Tummala
2024-08-26 13:06     ` [PATCH v2 1/4] power: refactor core " Sivaprasad Tummala
2024-08-26 15:26       ` Stephen Hemminger
2024-10-07 19:25         ` Tummala, Sivaprasad
2024-08-27  8:21       ` lihuisong (C)
2024-09-12 11:17         ` Tummala, Sivaprasad
2024-09-13  7:34           ` lihuisong (C)
2024-09-18  8:37             ` Tummala, Sivaprasad
2024-09-19  3:37               ` lihuisong (C)
2024-08-26 13:06     ` [PATCH v2 2/4] power: refactor uncore " Sivaprasad Tummala
2024-08-27 13:02       ` lihuisong (C)
2024-10-08  6:19         ` Tummala, Sivaprasad
2024-10-22  2:05           ` lihuisong (C)
2024-08-26 13:06     ` [PATCH v2 3/4] test/power: removed function pointer validations Sivaprasad Tummala
2024-08-26 13:06     ` [PATCH v2 4/4] power/amd_uncore: uncore power management support for AMD EPYC processors Sivaprasad Tummala
2024-08-26 13:06     ` [PATCH v2 0/4] power: refactor power management library Sivaprasad Tummala
2024-10-07 18:01     ` Stephen Hemminger
2024-10-08 17:27     ` [PATCH v3 0/5] " Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 1/5] power: refactor core " Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 4/5] power/amd_uncore: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-08 17:27       ` [PATCH v3 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-08 17:43       ` Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 1/5] power: refactor core " Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 4/5] power/amd_uncore: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-08 17:43         ` [PATCH v3 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-12 17:44         ` Stephen Hemminger
2024-10-15  2:49       ` [PATCH v4 " Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 1/5] power: refactor core " Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 4/5] power/amd_uncore: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-15  2:49         ` [PATCH v4 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-15  3:15         ` Stephen Hemminger
2024-10-17 10:26         ` [PATCH v5 " Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 1/5] power: refactor core " Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 4/5] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-17 10:26           ` [PATCH v5 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-17 16:17           ` Stephen Hemminger
2024-10-20  9:22           ` [PATCH v6 " Sivaprasad Tummala
2024-10-20  9:22             ` [PATCH v6 1/5] power: refactor core " Sivaprasad Tummala
2024-10-20  9:22             ` [PATCH v6 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-20 23:25               ` Stephen Hemminger
2024-10-20 23:28               ` Stephen Hemminger
2024-10-20  9:22             ` [PATCH v6 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-20  9:22             ` [PATCH v6 4/5] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-20  9:22             ` [PATCH v6 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-20  9:22             ` [PATCH v6 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-21  4:07             ` [PATCH v7 " Sivaprasad Tummala
2024-10-21  4:07               ` [PATCH v7 1/5] power: refactor core " Sivaprasad Tummala
2024-10-22  1:20                 ` Stephen Hemminger
2024-10-22  6:45                   ` Tummala, Sivaprasad
2024-10-22  3:03                 ` lihuisong (C)
2024-10-22  7:13                   ` Tummala, Sivaprasad
2024-10-22  8:36                     ` lihuisong (C)
2024-10-21  4:07               ` [PATCH v7 2/5] power: refactor uncore " Sivaprasad Tummala
2024-10-22  1:18                 ` Stephen Hemminger
2024-10-22  6:45                   ` Tummala, Sivaprasad
2024-10-22  3:17                 ` lihuisong (C)
2024-10-22  6:46                   ` Tummala, Sivaprasad
2024-10-21  4:07               ` [PATCH v7 3/5] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-21  4:07               ` [PATCH v7 4/5] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-21  4:07               ` [PATCH v7 5/5] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-21  4:07               ` [PATCH v7 0/5] power: refactor power management library Sivaprasad Tummala
2024-10-22  1:34               ` Stephen Hemminger
2024-10-22 18:41               ` [PATCH v8 0/6] " Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 1/6] power: refactor core " Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 2/6] power: refactor uncore " Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 3/6] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 4/6] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 5/6] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 6/6] power: rename library sources for cpu frequency management Sivaprasad Tummala
2024-10-22 18:41                 ` [PATCH v8 0/6] power: refactor power management library Sivaprasad Tummala
2024-10-23  1:40                 ` Stephen Hemminger
2024-10-23  5:11                 ` [PATCH v9 " Sivaprasad Tummala
2024-10-23  5:11                   ` [PATCH v9 1/6] power: refactor core " Sivaprasad Tummala
2024-10-26  3:06                     ` lihuisong (C)
2024-10-26  5:22                       ` Tummala, Sivaprasad
2024-10-26  7:03                         ` lihuisong (C)
2024-10-23  5:11                   ` [PATCH v9 2/6] power: refactor uncore " Sivaprasad Tummala
2024-10-26  3:12                     ` lihuisong (C)
2024-10-23  5:11                   ` [PATCH v9 3/6] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-23  5:11                   ` [PATCH v9 4/6] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-23  5:11                   ` [PATCH v9 5/6] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-23  5:11                   ` [PATCH v9 6/6] power: rename library sources for cpu frequency management Sivaprasad Tummala
2024-10-26  4:09                     ` lihuisong (C)
2024-10-23  5:11                   ` [PATCH v9 0/6] power: refactor power management library Sivaprasad Tummala
2024-10-28 19:55                   ` [PATCH v10 " Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 1/6] power: refactor core " Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 2/6] power: refactor uncore " Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 3/6] test/power: removed function pointer validations Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 4/6] drivers/power: uncore support for AMD EPYC processors Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 5/6] maintainers: update for drivers/power Sivaprasad Tummala
2024-10-28 19:55                     ` [PATCH v10 6/6] power: rename library sources for cpu frequency management Sivaprasad Tummala

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=319a72e5-b1ef-4ee2-a9f4-6318c38e32b5@intel.com \
    --to=david.hunt@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=jerinj@marvell.com \
    --cc=konstantin.ananyev@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=sivaprasad.tummala@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).