* [PATCH] cpufreq: rcpufreq_dt: implement software boost support
@ 2026-12-02 3:51 Poil Zero
2026-12-02 6:10 ` Zhongqiu Han
0 siblings, 1 reply; 5+ messages in thread
From: Poil Zero @ 2026-12-02 3:51 UTC (permalink / raw)
To: Viresh Kumar, Rafael J. Wysocki; +Cc: linux-pm, rust-for-linux
rcpufreq_dt advertises boost support but its set_boost() callback returns
success without updating the policy limits. As a result, enabling boost
can leave boost frequencies outside the policy's usable range.
Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
updates the frequency limits and QoS request. Start with driver-level
boost disabled, as cpufreq-dt does.
Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
---
drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
rust/kernel/cpufreq.rs | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
index 2b1f18b..e0e1814 100644
--- a/drivers/cpufreq/rcpufreq_dt.rs
+++ b/drivers/cpufreq/rcpufreq_dt.rs
@@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
impl cpufreq::Driver for CPUFreqDTDriver {
const NAME: &'static CStr = c"cpufreq-dt";
const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
cpufreq::flags::IS_COOLING_DEV;
- const BOOST_ENABLED: bool = true;
+ // Keep the initial driver level boost state disabled and let the
userspace enable it if
+ // required, like the C driver does.
+ const BOOST_ENABLED: bool = false;
type PData = Arc<CPUFreqDTDevice>;
@@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
policy.generic_get()
}
- fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
- Ok(())
+ fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
+ policy.set_boost_sw(state)
}
fn register_em(policy: &mut cpufreq::Policy) {
diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
index f316711..ad01387 100644
--- a/rust/kernel/cpufreq.rs
+++ b/rust/kernel/cpufreq.rs
@@ -544,6 +544,16 @@ impl Policy {
Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
}
+ /// Provides a wrapper to the generic software boost routine.
+ ///
+ /// This recomputes the policy's `cpuinfo` limits from its
frequency table, taking the
+ /// current driver and per-policy boost state into account.
+ #[inline]
+ pub fn set_boost_sw(&mut self, state: i32) -> Result {
+ // SAFETY: By the type invariant, the pointer stored in
`self` is valid.
+ to_result(unsafe {
bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
+ }
+
/// Provides a wrapper to the register with energy model using
the OPP core.
#[cfg(CONFIG_PM_OPP)]
#[inline]
@@ -741,7 +751,10 @@ pub trait Driver {
/// Driver's flags.
const FLAGS: u16;
- /// Boost support.
+ /// Initial state of the driver level boost support.
+ ///
+ /// This maps to `cpufreq_driver.boost_enabled`. Boost support
itself is advertised to the
+ /// core by implementing [`Driver::set_boost`].
const BOOST_ENABLED: bool;
/// Policy specific data.
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: rcpufreq_dt: implement software boost support
2026-12-02 3:51 [PATCH] cpufreq: rcpufreq_dt: implement software boost support Poil Zero
@ 2026-12-02 6:10 ` Zhongqiu Han
2026-12-02 7:37 ` Poil Zero
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zhongqiu Han @ 2026-12-02 6:10 UTC (permalink / raw)
To: Poil Zero, Viresh Kumar, Rafael J. Wysocki
Cc: linux-pm, rust-for-linux, Zhongqiu Han
On 12/2/2026 11:51 AM, Poil Zero wrote:
> rcpufreq_dt advertises boost support but its set_boost() callback returns
> success without updating the policy limits. As a result, enabling boost
> can leave boost frequencies outside the policy's usable range.
>
> Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
> updates the frequency limits and QoS request. Start with driver-level
> boost disabled, as cpufreq-dt does.
The checkpatch.pl reports the following error:
ERROR: patch seems to be corrupt (line wrapped?)
#30: FILE: drivers/cpufreq/rcpufreq_dt.rs:62:
cpufreq::flags::IS_COOLING_DEV;
total: 1 errors, 0 warnings, 54 lines checked
Did you use git send-email or b4 send to send this patch?
>
> Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
> ---
> drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
> rust/kernel/cpufreq.rs | 15 ++++++++++++++-
> 2 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> index 2b1f18b..e0e1814 100644
> --- a/drivers/cpufreq/rcpufreq_dt.rs
> +++ b/drivers/cpufreq/rcpufreq_dt.rs
> @@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
> impl cpufreq::Driver for CPUFreqDTDriver {
> const NAME: &'static CStr = c"cpufreq-dt";
> const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
> cpufreq::flags::IS_COOLING_DEV;
> - const BOOST_ENABLED: bool = true;
> + // Keep the initial driver level boost state disabled and let the
> userspace enable it if
> + // required, like the C driver does.
> + const BOOST_ENABLED: bool = false;
>
> type PData = Arc<CPUFreqDTDevice>;
>
> @@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
> policy.generic_get()
> }
>
> - fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
> - Ok(())
> + fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
> + policy.set_boost_sw(state)
> }
>
> fn register_em(policy: &mut cpufreq::Policy) {
> diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
> index f316711..ad01387 100644
> --- a/rust/kernel/cpufreq.rs
> +++ b/rust/kernel/cpufreq.rs
> @@ -544,6 +544,16 @@ impl Policy {
> Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
> }
>
> + /// Provides a wrapper to the generic software boost routine.
> + ///
> + /// This recomputes the policy's `cpuinfo` limits from its
> frequency table, taking the
> + /// current driver and per-policy boost state into account.
> + #[inline]
> + pub fn set_boost_sw(&mut self, state: i32) -> Result {
> + // SAFETY: By the type invariant, the pointer stored in
> `self` is valid.
> + to_result(unsafe {
> bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
> + }
> +
> /// Provides a wrapper to the register with energy model using
> the OPP core.
> #[cfg(CONFIG_PM_OPP)]
> #[inline]
> @@ -741,7 +751,10 @@ pub trait Driver {
> /// Driver's flags.
> const FLAGS: u16;
>
> - /// Boost support.
> + /// Initial state of the driver level boost support.
> + ///
> + /// This maps to `cpufreq_driver.boost_enabled`. Boost support
> itself is advertised to the
> + /// core by implementing [`Driver::set_boost`].
> const BOOST_ENABLED: bool;
>
> /// Policy specific data.
--
Thx and BRs,
Zhongqiu Han
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: rcpufreq_dt: implement software boost support
2026-12-02 6:10 ` Zhongqiu Han
@ 2026-12-02 7:37 ` Poil Zero
2026-12-02 7:38 ` [PATCH v2] " Poil Zero
2026-12-02 7:40 ` Poil Zero
2 siblings, 0 replies; 5+ messages in thread
From: Poil Zero @ 2026-12-02 7:37 UTC (permalink / raw)
To: Zhongqiu Han; +Cc: Viresh Kumar, Rafael J. Wysocki, linux-pm, rust-for-linux
Hi Zhongqiu,
> Did you use git send-email or b4 send to send this patch?
Thanks for catching the wrapped FLAGS line. I sent v1 directly through
the Gmail API. For v2 I used git send-email to prepare the message and
the Gmail API to deliver it. The code is unchanged.
I sent v2 to myself first and ran git am on the raw email from my inbox
in a test tree with the original patch context. It applied cleanly, and
the FLAGS line was intact. I've sent v2 to the list and copied you.
v2 Message-ID:
<CAGdLfDfUTJSAgto=vyRONaF-pUxa_axi5ymo5SL8yxSSTiRRfw@mail.gmail.com>
Thanks,
Poil Zero
On Wed, 02 Dec 2026 14:10:32 +0800, Zhongqiu Han
<zhongqiu.han@oss.qualcomm.com> wrote:
> On 12/2/2026 11:51 AM, Poil Zero wrote:
> > rcpufreq_dt advertises boost support but its set_boost() callback returns
> > success without updating the policy limits. As a result, enabling boost
> > can leave boost frequencies outside the policy's usable range.
> >
> > Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
> > updates the frequency limits and QoS request. Start with driver-level
> > boost disabled, as cpufreq-dt does.
>
>
> The checkpatch.pl reports the following error:
>
> ERROR: patch seems to be corrupt (line wrapped?)
> #30: FILE: drivers/cpufreq/rcpufreq_dt.rs:62:
> cpufreq::flags::IS_COOLING_DEV;
>
> total: 1 errors, 0 warnings, 54 lines checked
>
> Did you use git send-email or b4 send to send this patch?
>
>
> >
> > Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
> > ---
> > drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
> > rust/kernel/cpufreq.rs | 15 ++++++++++++++-
> > 2 files changed, 19 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> > index 2b1f18b..e0e1814 100644
> > --- a/drivers/cpufreq/rcpufreq_dt.rs
> > +++ b/drivers/cpufreq/rcpufreq_dt.rs
> > @@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
> > impl cpufreq::Driver for CPUFreqDTDriver {
> > const NAME: &'static CStr = c"cpufreq-dt";
> > const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
> > cpufreq::flags::IS_COOLING_DEV;
> > - const BOOST_ENABLED: bool = true;
> > + // Keep the initial driver level boost state disabled and let the
> > userspace enable it if
> > + // required, like the C driver does.
> > + const BOOST_ENABLED: bool = false;
> >
> > type PData = Arc<CPUFreqDTDevice>;
> >
> > @@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
> > policy.generic_get()
> > }
> >
> > - fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
> > - Ok(())
> > + fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
> > + policy.set_boost_sw(state)
> > }
> >
> > fn register_em(policy: &mut cpufreq::Policy) {
> > diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
> > index f316711..ad01387 100644
> > --- a/rust/kernel/cpufreq.rs
> > +++ b/rust/kernel/cpufreq.rs
> > @@ -544,6 +544,16 @@ impl Policy {
> > Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
> > }
> >
> > + /// Provides a wrapper to the generic software boost routine.
> > + ///
> > + /// This recomputes the policy's `cpuinfo` limits from its
> > frequency table, taking the
> > + /// current driver and per-policy boost state into account.
> > + #[inline]
> > + pub fn set_boost_sw(&mut self, state: i32) -> Result {
> > + // SAFETY: By the type invariant, the pointer stored in
> > `self` is valid.
> > + to_result(unsafe {
> > bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
> > + }
> > +
> > /// Provides a wrapper to the register with energy model using
> > the OPP core.
> > #[cfg(CONFIG_PM_OPP)]
> > #[inline]
> > @@ -741,7 +751,10 @@ pub trait Driver {
> > /// Driver's flags.
> > const FLAGS: u16;
> >
> > - /// Boost support.
> > + /// Initial state of the driver level boost support.
> > + ///
> > + /// This maps to `cpufreq_driver.boost_enabled`. Boost support
> > itself is advertised to the
> > + /// core by implementing [`Driver::set_boost`].
> > const BOOST_ENABLED: bool;
> >
> > /// Policy specific data.
>
>
> --
> Thx and BRs,
> Zhongqiu Han
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] cpufreq: rcpufreq_dt: implement software boost support
2026-12-02 6:10 ` Zhongqiu Han
2026-12-02 7:37 ` Poil Zero
@ 2026-12-02 7:38 ` Poil Zero
2026-12-02 7:40 ` Poil Zero
2 siblings, 0 replies; 5+ messages in thread
From: Poil Zero @ 2026-12-02 7:38 UTC (permalink / raw)
To: Zhongqiu Han; +Cc: Viresh Kumar, Rafael J. Wysocki, linux-pm, rust-for-linux
rcpufreq_dt advertises boost support but its set_boost() callback returns
success without updating the policy limits. As a result, enabling boost
can leave boost frequencies outside the policy's usable range.
Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
updates the frequency limits and QoS request. Start with driver-level
boost disabled, as cpufreq-dt does.
Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
---
Changes in v2:
- Resend to fix line wrapping in v1. No code changes.
drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
rust/kernel/cpufreq.rs | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
index 2b1f18b..e0e1814 100644
--- a/drivers/cpufreq/rcpufreq_dt.rs
+++ b/drivers/cpufreq/rcpufreq_dt.rs
@@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
impl cpufreq::Driver for CPUFreqDTDriver {
const NAME: &'static CStr = c"cpufreq-dt";
const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
cpufreq::flags::IS_COOLING_DEV;
- const BOOST_ENABLED: bool = true;
+ // Keep the initial driver level boost state disabled and let the
userspace enable it if
+ // required, like the C driver does.
+ const BOOST_ENABLED: bool = false;
type PData = Arc<CPUFreqDTDevice>;
@@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
policy.generic_get()
}
- fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
- Ok(())
+ fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
+ policy.set_boost_sw(state)
}
fn register_em(policy: &mut cpufreq::Policy) {
diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
index f316711..ad01387 100644
--- a/rust/kernel/cpufreq.rs
+++ b/rust/kernel/cpufreq.rs
@@ -544,6 +544,16 @@ impl Policy {
Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
}
+ /// Provides a wrapper to the generic software boost routine.
+ ///
+ /// This recomputes the policy's `cpuinfo` limits from its
frequency table, taking the
+ /// current driver and per-policy boost state into account.
+ #[inline]
+ pub fn set_boost_sw(&mut self, state: i32) -> Result {
+ // SAFETY: By the type invariant, the pointer stored in
`self` is valid.
+ to_result(unsafe {
bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
+ }
+
/// Provides a wrapper to the register with energy model using
the OPP core.
#[cfg(CONFIG_PM_OPP)]
#[inline]
@@ -741,7 +751,10 @@ pub trait Driver {
/// Driver's flags.
const FLAGS: u16;
- /// Boost support.
+ /// Initial state of the driver level boost support.
+ ///
+ /// This maps to `cpufreq_driver.boost_enabled`. Boost support
itself is advertised to the
+ /// core by implementing [`Driver::set_boost`].
const BOOST_ENABLED: bool;
/// Policy specific data.
--
2.43.0
On Wed, 02 Dec 2026 14:10:32 +0800, Zhongqiu Han
<zhongqiu.han@oss.qualcomm.com> wrote:
> On 12/2/2026 11:51 AM, Poil Zero wrote:
> > rcpufreq_dt advertises boost support but its set_boost() callback returns
> > success without updating the policy limits. As a result, enabling boost
> > can leave boost frequencies outside the policy's usable range.
> >
> > Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
> > updates the frequency limits and QoS request. Start with driver-level
> > boost disabled, as cpufreq-dt does.
>
>
> The checkpatch.pl reports the following error:
>
> ERROR: patch seems to be corrupt (line wrapped?)
> #30: FILE: drivers/cpufreq/rcpufreq_dt.rs:62:
> cpufreq::flags::IS_COOLING_DEV;
>
> total: 1 errors, 0 warnings, 54 lines checked
>
> Did you use git send-email or b4 send to send this patch?
>
>
> >
> > Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
> > ---
> > drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
> > rust/kernel/cpufreq.rs | 15 ++++++++++++++-
> > 2 files changed, 19 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> > index 2b1f18b..e0e1814 100644
> > --- a/drivers/cpufreq/rcpufreq_dt.rs
> > +++ b/drivers/cpufreq/rcpufreq_dt.rs
> > @@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
> > impl cpufreq::Driver for CPUFreqDTDriver {
> > const NAME: &'static CStr = c"cpufreq-dt";
> > const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
> > cpufreq::flags::IS_COOLING_DEV;
> > - const BOOST_ENABLED: bool = true;
> > + // Keep the initial driver level boost state disabled and let the
> > userspace enable it if
> > + // required, like the C driver does.
> > + const BOOST_ENABLED: bool = false;
> >
> > type PData = Arc<CPUFreqDTDevice>;
> >
> > @@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
> > policy.generic_get()
> > }
> >
> > - fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
> > - Ok(())
> > + fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
> > + policy.set_boost_sw(state)
> > }
> >
> > fn register_em(policy: &mut cpufreq::Policy) {
> > diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
> > index f316711..ad01387 100644
> > --- a/rust/kernel/cpufreq.rs
> > +++ b/rust/kernel/cpufreq.rs
> > @@ -544,6 +544,16 @@ impl Policy {
> > Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
> > }
> >
> > + /// Provides a wrapper to the generic software boost routine.
> > + ///
> > + /// This recomputes the policy's `cpuinfo` limits from its
> > frequency table, taking the
> > + /// current driver and per-policy boost state into account.
> > + #[inline]
> > + pub fn set_boost_sw(&mut self, state: i32) -> Result {
> > + // SAFETY: By the type invariant, the pointer stored in
> > `self` is valid.
> > + to_result(unsafe {
> > bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
> > + }
> > +
> > /// Provides a wrapper to the register with energy model using
> > the OPP core.
> > #[cfg(CONFIG_PM_OPP)]
> > #[inline]
> > @@ -741,7 +751,10 @@ pub trait Driver {
> > /// Driver's flags.
> > const FLAGS: u16;
> >
> > - /// Boost support.
> > + /// Initial state of the driver level boost support.
> > + ///
> > + /// This maps to `cpufreq_driver.boost_enabled`. Boost support
> > itself is advertised to the
> > + /// core by implementing [`Driver::set_boost`].
> > const BOOST_ENABLED: bool;
> >
> > /// Policy specific data.
>
>
> --
> Thx and BRs,
> Zhongqiu Han
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] cpufreq: rcpufreq_dt: implement software boost support
2026-12-02 6:10 ` Zhongqiu Han
2026-12-02 7:37 ` Poil Zero
2026-12-02 7:38 ` [PATCH v2] " Poil Zero
@ 2026-12-02 7:40 ` Poil Zero
2 siblings, 0 replies; 5+ messages in thread
From: Poil Zero @ 2026-12-02 7:40 UTC (permalink / raw)
To: Zhongqiu Han; +Cc: Viresh Kumar, Rafael J. Wysocki, linux-pm, rust-for-linux
rcpufreq_dt advertises boost support but its set_boost() callback returns
success without updating the policy limits. As a result, enabling boost
can leave boost frequencies outside the policy's usable range.
Use cpufreq_boost_set_sw() through a Rust Policy wrapper so the callback
updates the frequency limits and QoS request. Start with driver-level
boost disabled, as cpufreq-dt does.
Signed-off-by: Poil Zero <poilandgginchi@gmail.com>
---
Changes in v2:
- Resend to fix line wrapping in v1. No code changes.
drivers/cpufreq/rcpufreq_dt.rs | 8 +++++---
rust/kernel/cpufreq.rs | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
index 2b1f18b..e0e1814 100644
--- a/drivers/cpufreq/rcpufreq_dt.rs
+++ b/drivers/cpufreq/rcpufreq_dt.rs
@@ -60,7 +60,9 @@ impl opp::ConfigOps for CPUFreqDTDriver {}
impl cpufreq::Driver for CPUFreqDTDriver {
const NAME: &'static CStr = c"cpufreq-dt";
const FLAGS: u16 = cpufreq::flags::NEED_INITIAL_FREQ_CHECK |
cpufreq::flags::IS_COOLING_DEV;
- const BOOST_ENABLED: bool = true;
+ // Keep the initial driver level boost state disabled and let the
userspace enable it if
+ // required, like the C driver does.
+ const BOOST_ENABLED: bool = false;
type PData = Arc<CPUFreqDTDevice>;
@@ -190,8 +192,8 @@ impl cpufreq::Driver for CPUFreqDTDriver {
policy.generic_get()
}
- fn set_boost(_policy: &mut cpufreq::Policy, _state: i32) -> Result {
- Ok(())
+ fn set_boost(policy: &mut cpufreq::Policy, state: i32) -> Result {
+ policy.set_boost_sw(state)
}
fn register_em(policy: &mut cpufreq::Policy) {
diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
index f316711..ad01387 100644
--- a/rust/kernel/cpufreq.rs
+++ b/rust/kernel/cpufreq.rs
@@ -544,6 +544,16 @@ impl Policy {
Ok(unsafe { bindings::cpufreq_generic_get(u32::from(self.cpu())) })
}
+ /// Provides a wrapper to the generic software boost routine.
+ ///
+ /// This recomputes the policy's `cpuinfo` limits from its
frequency table, taking the
+ /// current driver and per-policy boost state into account.
+ #[inline]
+ pub fn set_boost_sw(&mut self, state: i32) -> Result {
+ // SAFETY: By the type invariant, the pointer stored in
`self` is valid.
+ to_result(unsafe {
bindings::cpufreq_boost_set_sw(self.as_mut_ref(), state) })
+ }
+
/// Provides a wrapper to the register with energy model using
the OPP core.
#[cfg(CONFIG_PM_OPP)]
#[inline]
@@ -741,7 +751,10 @@ pub trait Driver {
/// Driver's flags.
const FLAGS: u16;
- /// Boost support.
+ /// Initial state of the driver level boost support.
+ ///
+ /// This maps to `cpufreq_driver.boost_enabled`. Boost support
itself is advertised to the
+ /// core by implementing [`Driver::set_boost`].
const BOOST_ENABLED: bool;
/// Policy specific data.
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-02 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 3:51 [PATCH] cpufreq: rcpufreq_dt: implement software boost support Poil Zero
2026-12-02 6:10 ` Zhongqiu Han
2026-12-02 7:37 ` Poil Zero
2026-12-02 7:38 ` [PATCH v2] " Poil Zero
2026-12-02 7:40 ` Poil Zero
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.