===================================================================
@@ -676,6 +676,38 @@ void em_dev_unregister_perf_domain(struc
}
EXPORT_SYMBOL_GPL(em_dev_unregister_perf_domain);
+/**
+ * em_dev_expand_perf_domain() - Expand CPU perf domain
+ * @dev: CPU device of a CPU in the perf domain.
+ * @new_cpu: CPU to add to the perf domain.
+ */
+int em_dev_expand_perf_domain(struct device *dev, int new_cpu)
+{
+ struct device *new_cpu_dev;
+ struct em_perf_domain *pd;
+
+ if (IS_ERR_OR_NULL(dev) || !_is_cpu_device(dev))
+ return -EINVAL;
+
+ new_cpu_dev = get_cpu_device(new_cpu);
+ if (!new_cpu_dev)
+ return -EINVAL;
+
+ guard(mutex)(&em_pd_mutex);
+
+ if (em_pd_get(new_cpu_dev))
+ return -EEXIST;
+
+ pd = em_pd_get(dev);
+ if (!pd)
+ return -EINVAL;
+
+ cpumask_set_cpu(new_cpu, em_span_cpus(pd));
+ new_cpu_dev->em_pd = pd;
+
+ return 0;
+}
+
static struct em_perf_table __rcu *em_table_dup(struct em_perf_domain *pd)
{
struct em_perf_table __rcu *em_table;
===================================================================
@@ -172,6 +172,7 @@ int em_dev_register_perf_domain(struct d
struct em_data_callback *cb, cpumask_t *span,
bool microwatts);
void em_dev_unregister_perf_domain(struct device *dev);
+int em_dev_expand_perf_domain(struct device *dev, int new_cpu);
struct em_perf_table __rcu *em_table_alloc(struct em_perf_domain *pd);
void em_table_free(struct em_perf_table __rcu *table);
int em_dev_compute_costs(struct device *dev, struct em_perf_state *table,
@@ -354,6 +355,10 @@ int em_dev_register_perf_domain(struct d
static inline void em_dev_unregister_perf_domain(struct device *dev)
{
}
+static inline int em_dev_expand_perf_domain(struct device *dev, int new_cpu)
+{
+ return -EINVAL;
+}
static inline struct em_perf_domain *em_cpu_get(int cpu)
{
return NULL;