[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240208115557.1273962-13-lukasz.luba@arm.com>
Date: Thu, 8 Feb 2024 11:55:46 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
rafael@...nel.org
Cc: lukasz.luba@....com,
dietmar.eggemann@....com,
rui.zhang@...el.com,
amit.kucheria@...durent.com,
amit.kachhap@...il.com,
daniel.lezcano@...aro.org,
viresh.kumar@...aro.org,
len.brown@...el.com,
pavel@....cz,
mhiramat@...nel.org,
qyousef@...alina.io,
wvw@...gle.com,
xuewen.yan94@...il.com
Subject: [PATCH v8 12/23] PM: EM: Add em_perf_state_from_pd() to get performance states table
Introduce a wrapper to get the performance states table of the performance
domain. The function should be called within the RCU read critical
section.
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@....com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@....com>
Signed-off-by: Lukasz Luba <lukasz.luba@....com>
---
include/linux/energy_model.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 324a3a8e0a2d..158dad6ea313 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -338,6 +338,23 @@ static inline int em_pd_nr_perf_states(struct em_perf_domain *pd)
return pd->nr_perf_states;
}
+/**
+ * em_perf_state_from_pd() - Get the performance states table of perf.
+ * domain
+ * @pd : performance domain for which this must be done
+ *
+ * To use this function the rcu_read_lock() should be hold. After the usage
+ * of the performance states table is finished, the rcu_read_unlock() should
+ * be called.
+ *
+ * Return: the pointer to performance states table of the performance domain
+ */
+static inline
+struct em_perf_state *em_perf_state_from_pd(struct em_perf_domain *pd)
+{
+ return rcu_dereference(pd->em_table)->state;
+}
+
#else
struct em_data_callback {};
#define EM_ADV_DATA_CB(_active_power_cb, _cost_cb) { }
@@ -384,6 +401,11 @@ int em_dev_update_perf_domain(struct device *dev,
{
return -EINVAL;
}
+static inline
+struct em_perf_state *em_perf_state_from_pd(struct em_perf_domain *pd)
+{
+ return NULL;
+}
#endif
#endif
--
2.25.1
Powered by blists - more mailing lists