From: Huisong Li <lihuisong@huawei.com>
To: <anatoly.burakov@intel.com>, <sivaprasad.tummala@amd.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>,
<stephen@networkplumber.org>, <fengchengwen@huawei.com>,
<yangxingui@huawei.com>, <zhanjie9@hisilicon.com>,
<lihuisong@huawei.com>
Subject: [PATCH v4 5/6] power: support automatic detection of uncore driver
Date: Wed, 29 Jul 2026 10:51:48 +0800 [thread overview]
Message-ID: <20260729025149.2158868-6-lihuisong@huawei.com> (raw)
In-Reply-To: <20260729025149.2158868-1-lihuisong@huawei.com>
Currently, uncore driver library just supports intel_uncore
driver as default driver when user use AUTO_DETECT, please see
the commit 3b3af56d3c9c ("power: fix uncore configuration").
This is not good to use for application. So this patch support
probing for uncore drivers.
Fixes: 3b3af56d3c9c ("power: fix uncore configuration")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
doc/guides/rel_notes/release_26_11.rst | 6 ++++
lib/power/rte_power_uncore.c | 46 ++++++++++++++++++++++----
2 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index c8cc86295d..65438e8e3a 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -55,6 +55,12 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
+* **Support auto-detection of uncore power driver.**
+
+ The uncore power library now supports automatic probing of multiple
+ uncore drivers when using ``RTE_UNCORE_PM_ENV_AUTO_DETECT``,
+ instead of defaulting only to the Intel uncore driver.
+
Removed Items
-------------
diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c
index b50e09a2ad..64a8c2648d 100644
--- a/lib/power/rte_power_uncore.c
+++ b/lib/power/rte_power_uncore.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2014 Intel Corporation
* Copyright(c) 2023 AMD Corporation
*/
+#include <errno.h>
#include <eal_export.h>
#include <rte_spinlock.h>
@@ -46,6 +47,39 @@ rte_power_register_uncore_ops(struct rte_power_uncore_ops *driver_ops)
return 0;
}
+static uint32_t power_uncore_driver_name2env(char *name)
+{
+ for (uint32_t i = 0; i < RTE_DIM(uncore_env_str); i++) {
+ if (!strcmp(name, uncore_env_str[i]))
+ return i;
+ }
+
+ return UINT32_MAX;
+}
+
+static int power_uncore_probe_driver(void)
+{
+ struct rte_power_uncore_ops *ops;
+ int ret;
+
+ global_uncore_ops = NULL;
+ /* Use package-0 and die-0 to probe uncore driver. */
+ RTE_TAILQ_FOREACH(ops, &uncore_ops_list, next) {
+ ret = ops->init(0, 0);
+ if (ret == 0) {
+ uint32_t env = power_uncore_driver_name2env(ops->name);
+ if (env == UINT32_MAX)
+ continue;
+ global_uncore_env = env;
+ global_uncore_ops = ops;
+ ops->exit(0, 0);
+ break;
+ }
+ }
+
+ return global_uncore_ops ? 0 : -ENODEV;
+}
+
RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_power_set_uncore_env, 23.11)
int
rte_power_set_uncore_env(enum rte_uncore_power_mgmt_env env)
@@ -60,12 +94,12 @@ rte_power_set_uncore_env(enum rte_uncore_power_mgmt_env env)
goto out;
}
- if (env == RTE_UNCORE_PM_ENV_AUTO_DETECT)
- /* Currently only intel_uncore is supported.
- * This will be extended with auto-detection support
- * for multiple uncore implementations.
- */
- env = RTE_UNCORE_PM_ENV_INTEL_UNCORE;
+ if (env == RTE_UNCORE_PM_ENV_AUTO_DETECT) {
+ ret = power_uncore_probe_driver();
+ if (ret != 0)
+ POWER_LOG(ERR, "Probe uncore driver failed, ret = %d", ret);
+ goto out;
+ }
if (env < RTE_DIM(uncore_env_str)) {
RTE_TAILQ_FOREACH(ops, &uncore_ops_list, next)
--
2.33.0
next prev parent reply other threads:[~2026-07-29 2:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 2:51 [PATCH v4 0/6] power: uncore power improvements and auto-detection Huisong Li
2026-07-29 2:51 ` [PATCH v4 1/6] examples/l3fwd-power: fix uncore deinit for non-legacy Huisong Li
2026-07-29 2:51 ` [PATCH v4 2/6] examples/l3fwd-power: enable power QoS for all modes Huisong Li
2026-07-29 2:51 ` [PATCH v4 3/6] examples/l3fwd-power: fix uncore help and log info Huisong Li
2026-07-29 2:51 ` [PATCH v4 4/6] examples/l3fwd-power: relocate uncore initialization Huisong Li
2026-07-29 2:51 ` Huisong Li [this message]
2026-07-29 2:51 ` [PATCH v4 6/6] power: remove unused auto-detection uncore Huisong Li
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=20260729025149.2158868-6-lihuisong@huawei.com \
--to=lihuisong@huawei.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=sivaprasad.tummala@amd.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=yangxingui@huawei.com \
--cc=zhanjie9@hisilicon.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