On 22.08.2025 12:52, Penny Zheng wrote: > Even if Xen governor is not used in amd-cppc active mode, we could > somehow deduce which performance policy (CPUFREQ_POLICY_xxx) user wants to > apply through which governor they choose, such as: > If user chooses performance governor, they want maximum performance, then > the policy shall be CPUFREQ_POLICY_PERFORMANCE > If user chooses powersave governor, they want the least power consumption, > then the policy shall be CPUFREQ_POLICY_POWERSAVE > Function cpufreq_policy_from_governor() is responsible for above transition, > and it shall be also effective when users setting new governor through xenpm. > > userspace are forbidden choices, and if users specify such options,
Odd use of plural here, when only one bad variant is named. > --- a/xen/drivers/acpi/pm-op.c > +++ b/xen/drivers/acpi/pm-op.c > @@ -206,6 +206,14 @@ static int set_cpufreq_gov(struct xen_sysctl_pm_op *op) > if ( new_policy.governor == NULL ) > return -EINVAL; > > + new_policy.policy = cpufreq_policy_from_governor(new_policy.governor); > + if ( new_policy.policy == CPUFREQ_POLICY_UNKNOWN ) > + { > + printk("Failed to get performance policy from %s, Try \"xenpm > set-cpufreq-cppc\"\n", > + new_policy.governor->name); > + return -EINVAL; > + } Don't you also need to check for CPPC mode, or else you reject "userspace" for other drivers as well? Jan