Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp907485lqt; Fri, 7 Jun 2024 02:14:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxJh91Oro3vsS71nf3H9hyWhfhrm4GTjte6pPaNhfYzZbty3FFtXd/7tLaR5WpifVyhFOkKcs/nw9NDIEUcJ67z+q3EnpEV3i9sE8s5w== X-Google-Smtp-Source: AGHT+IFFZ/tokdV4IwKUV7VDR/uNLp5qs/3sQvzApLoe53X8KHHK4ayMgtRRplNA0eKvzg5XEQUl X-Received: by 2002:a50:c345:0:b0:57c:54af:713b with SMTP id 4fb4d7f45d1cf-57c54af72admr812158a12.14.1717751678420; Fri, 07 Jun 2024 02:14:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717751678; cv=pass; d=google.com; s=arc-20160816; b=fQQQDfgVEoGH1Xp+aXDirdd/IdEDlB7f/mFSi8wr2NASCyiW8Q9SmqH2DPL0mFLNjv Dxlezs6BMeVlIVViPCI83k28eh46FIsOtjodt4Bae8loIRRfeeMv6deEcJhl0FrHJDAt dhmpsM6dbhSeS9CU+q94dQNOsiF4UYnnwfjfHVE1APH8P6jACMurfEehS7VfEClOWBvS pH+nGEuSWMqRmfK84Ypx3/JQMWjmV8+JFnRhNfWSHacfv3Zbb5Hfu+b1T5ntvnipu0xH oJCEL2AJWShOgmgAnlsadYSQfkHVs3/RpwrbThCNwP6PAu104/ww6isGKjAAiVM00RW1 1azw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ts4ZPCWdX1WWZnRhg2kN6M+wqUEnt4/e2UDw6VFJ03s=; fh=KXu1z4dkWexfeLhTKo7mIzxmbdLNmjlhoZeisBGhTsk=; b=I69F4sXsvVpm1ziskVy8cNSEXcGT2XBj19C/VlK9oGthgRI3259LmdjjcyMHlR4DT0 HIpEF0P+Ruw35Ci6BkFLm0WI7EW+fUdC5yOlFC/aBUVBL6PTjJYZ+YlBmdIpyGjVNSVE vGIH2TqQMvMd31CZ5ux78eaVcSSTYqyPq4mTrTILoFZgTNMWfZ1+k4tWMCk1OmlaPMxt mj0quhe/KbgZsUPfAsNcz/UEoCfBcXATNh9n9SEvspHhoOIkD0+bqyd64nHKqzC4NNyN Qz0WvgxSXCIAU4T1b3BlK4xgJ/P8Pnp3O/7jt/3UnfIbEXmKrVb0VAMSv5PSx5HMNYmO 8qJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diG8Q5cH; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205695-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae22be1fsi1638093a12.414.2024.06.07.02.14.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 02:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diG8Q5cH; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205695-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F0E791F22209 for ; Fri, 7 Jun 2024 09:14:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CEF915E5B8; Fri, 7 Jun 2024 09:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="diG8Q5cH" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66F5315DBCB for ; Fri, 7 Jun 2024 09:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717751578; cv=none; b=KIlP7Myh5xqZWcFRDN8MU+lms1q497cjYvjy2rSief+QuOKCQCFpCtBNJTNvTQ3Yzqj2m68jhlexvz6qKE3PMU+tpRRXDOTAEjw4vFLj+ThwX13+mffqWTs9POTINYk0Ky+4SJFB1pyNEdXjngMBiJcgBqU/r3UJt/sjP/iXyxg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717751578; c=relaxed/simple; bh=SP0zF/qQV6su2Bz7tEn1mT4rgqW43S1jdltO3YIwopc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MU4zWm0tWH8OX3SLSo+QTqig9b7l/v+FUBYr7Et0Oo7+UEz9+lBJ+SZ6JbdjtxWLRAESMitu9CoIw6ZAgolWiT7CYx2zyHGyyODy1jeutdWU5uOnjT2Gh1Vtv4kxNhpCNceOejrdStEiyg+oSAKdMcipCg4tJEX6tsWbGdI+HZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=diG8Q5cH; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f6ab88dfaeso16772645ad.2 for ; Fri, 07 Jun 2024 02:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717751576; x=1718356376; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ts4ZPCWdX1WWZnRhg2kN6M+wqUEnt4/e2UDw6VFJ03s=; b=diG8Q5cHBNOTeBiAsas9EL2SXoP2vtSUQtwxTs/e4F/F2ZXnUb+/nyIahGUGeZyZBR h+cv4eyDNNZIDgooVG8d/IV+9h0VuqMUIXyHt/tvQbHwQKYml568ctipqOJPDOeYQYT2 IhtIcBU5V42ZOGpFWy7tqGjO90okR38er68h+ckvt+KecaAzXYlXWLParP3GiYQ01cJ+ bIqM/paOl1Hvx83ghzoWuz92HXzWYxry2Z9U5kgVQOmuoOjmKLnz/BEUQc3NMp7tCCQX Wh5eTVCSE1m1OepAqDMSRlcrnDcJSbbR441DQU3430x492XUxFkFalz4cTUWCmJQJ3eH ZS3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717751576; x=1718356376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ts4ZPCWdX1WWZnRhg2kN6M+wqUEnt4/e2UDw6VFJ03s=; b=Emd6bF7JARzI9N6zs9LYOw2ng2eGyQmEsBrxf87bHXkhD5BAWcQKjG0uwCF7Rgszoa MEoGyVByvgDN8nKjGCbw2bwUJ952cqhJ/FgI58C2jTsYyWuHiXA/DDw8zyg3evXWLrB+ u92rcFxJWKObmAbMknzXwfjoNAmac6kGpSxhGIIn/3Xtl2CdnCM3nb9NrxSYuPO3sGlk 383S1MggQFab7l1gqQ4QFETay831YcFmd46tb+YVQFpz9GgRvIAvGJANne4MvQRM3mCU Gu4lCC6rm6aLzyVWuYTnn06tCAEIcvnTJMeINehAq5o2BBIiFkvVxsFqGoCa21Q4gLvQ 4Usg== X-Forwarded-Encrypted: i=1; AJvYcCX2FbwNOG5mGnTHMNKjODLSNPWBx6wA5e65K054Csc5UVlPa21sEJjp/+wbnH5xs2YRPHGWDjQ6b+J4ItvSVUrhBnJT/OPBwDHfD988 X-Gm-Message-State: AOJu0Yy9DNsqC79heQUTkHkLZHb+9BAbb+7NFWg8GcxNvYusrAD+L1/i B5jy4fXpmHfq2jEVpx0lDAWbDC+x9Hd228Rj1Ko8a/qoiD1+UJ04m6z4bFkQoIM= X-Received: by 2002:a17:902:da89:b0:1f6:7e02:7ab8 with SMTP id d9443c01a7336-1f6d03e70ddmr21788485ad.68.1717751575441; Fri, 07 Jun 2024 02:12:55 -0700 (PDT) Received: from localhost ([122.172.82.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7603bdsm29922285ad.50.2024.06.07.02.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 02:12:54 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Miguel Ojeda , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , rust-for-linux@vger.kernel.org, Manos Pitsidianakis , Erik Schilling , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Joakim Bech , Rob Herring , linux-kernel@vger.kernel.org Subject: [RFC PATCH V2 5/8] rust: Extend cpufreq bindings for policy and driver ops Date: Fri, 7 Jun 2024 14:42:20 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This extends the cpufreq bindings with bindings for cpufreq policy and driver operations. Signed-off-by: Viresh Kumar --- rust/kernel/cpufreq.rs | 335 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 333 insertions(+), 2 deletions(-) diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs index 51a4a9bd8d3c..d5679272e40b 100644 --- a/rust/kernel/cpufreq.rs +++ b/rust/kernel/cpufreq.rs @@ -7,15 +7,20 @@ //! C header: [`include/linux/cpufreq.h`](../../../../../../include/linux/cpufreq.h) use crate::{ - bindings, - error::{code::*, to_result, Result}, + bindings, clk, cpumask, + device::Device, + error::{code::*, from_err_ptr, to_result, Result, VTABLE_DEFAULT_ERROR}, prelude::*, + types::{ARef, ForeignOwnable}, }; use core::{ pin::Pin, + ptr::self, }; +use macros::vtable; + /// Default transition latency value. pub const ETERNAL_LATENCY: u32 = bindings::CPUFREQ_ETERNAL as u32; @@ -249,3 +254,329 @@ pub fn data(&self, index: usize) -> Result { Ok(unsafe { (*self.ptr.add(index)).driver_data }) } } + +/// Equivalent to `struct cpufreq_policy` in the C code. +pub struct Policy { + ptr: *mut bindings::cpufreq_policy, + put_cpu: bool, + cpumask: cpumask::Cpumask, +} + +impl Policy { + /// Creates a new instance of [`Policy`]. + /// + /// # Safety + /// + /// Callers must ensure that `ptr` is valid and non-null. + pub unsafe fn from_ptr(ptr: *mut bindings::cpufreq_policy) -> Self { + Self { + ptr, + put_cpu: false, + // SAFETY: The pointer is guaranteed to be valid for the lifetime of `Self`. The `cpus` + // pointer is guaranteed to be valid by the C code. + cpumask: unsafe { cpumask::Cpumask::new((*ptr).cpus) }, + } + } + + fn from_cpu(cpu: u32) -> Result { + // SAFETY: It is safe to call `cpufreq_cpu_get()` for any CPU. + let ptr = from_err_ptr(unsafe { bindings::cpufreq_cpu_get(cpu) })?; + + // SAFETY: The pointer is guaranteed to be valid by the C code. + let mut policy = unsafe { Policy::from_ptr(ptr) }; + policy.put_cpu = true; + Ok(policy) + } + + /// Raw pointer to the underlying cpufreq policy. + pub fn as_ptr(&self) -> *mut bindings::cpufreq_policy { + self.ptr + } + + fn as_ref(&self) -> &bindings::cpufreq_policy { + // SAFETY: By the type invariants, we know that `self` owns a reference to the pointer. + unsafe { &(*self.ptr) } + } + fn as_mut_ref(&mut self) -> &mut bindings::cpufreq_policy { + // SAFETY: By the type invariants, we know that `self` owns a reference to the pointer. + unsafe { &mut (*self.ptr) } + } + + /// Returns the primary CPU for a cpufreq policy. + pub fn cpu(&self) -> u32 { + self.as_ref().cpu + } + + /// Returns the minimum frequency for a cpufreq policy. + pub fn min(&self) -> u32 { + self.as_ref().min + } + + /// Returns the maximum frequency for a cpufreq policy. + pub fn max(&self) -> u32 { + self.as_ref().max + } + + /// Returns the current frequency for a cpufreq policy. + pub fn cur(&self) -> u32 { + self.as_ref().cur + } + + /// Sets the suspend frequency for a cpufreq policy. + pub fn set_suspend_freq(&mut self, freq: u32) -> &mut Self { + self.as_mut_ref().suspend_freq = freq; + self + } + + /// Returns the suspend frequency for a cpufreq policy. + pub fn suspend_freq(&self) -> u32 { + self.as_ref().suspend_freq + } + + /// Provides a wrapper to the generic suspend routine. + pub fn generic_suspend(&self) -> Result<()> { + // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to + // use it now. + to_result(unsafe { bindings::cpufreq_generic_suspend(self.as_ptr()) }) + } + + /// Provides a wrapper to the generic get routine. + pub fn generic_get(&self) -> Result { + // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to + // use it now. + Ok(unsafe { bindings::cpufreq_generic_get(self.cpu()) }) + } + + /// Provides a wrapper to the register em with OPP routine. + pub fn register_em_opp(&self) { + // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to + // use it now. + unsafe { bindings::cpufreq_register_em_with_opp(self.as_ptr()) }; + } + + /// Gets raw pointer to cpufreq policy's CPUs mask. + pub fn cpus(&mut self) -> &mut cpumask::Cpumask { + &mut self.cpumask + } + + /// Sets CPUs mask for a cpufreq policy. + /// + /// Update the `cpus` mask with a single CPU. + pub fn set_cpus(&mut self, cpu: u32) -> &mut Self { + // SAFETY: The `cpus` pointer is guaranteed to be valid for the lifetime of `self`. And it + // is safe to call `cpumask_set_cpus()` for any CPU. + unsafe { bindings::cpumask_set_cpu(cpu, self.cpus().as_mut_ptr()) }; + self + } + + /// Sets CPUs mask for a cpufreq policy. + /// + /// Update the `cpus` mask with a single CPU if `cpu` is set to `Some(cpu)`, else sets all + /// CPUs. + pub fn set_all_cpus(&mut self) -> &mut Self { + // SAFETY: The `cpus` pointer is guaranteed to be valid for the lifetime of `self`. And it + // is safe to call `cpumask_setall()`. + unsafe { bindings::cpumask_setall(self.cpus().as_mut_ptr()) }; + self + } + + /// Sets clock for a cpufreq policy. + pub fn set_clk(&mut self, dev: ARef, name: Option<&CStr>) -> Result { + let clk = clk::Clk::new(dev, name)?; + self.as_mut_ref().clk = clk.as_ptr(); + Ok(clk) + } + + /// Allows frequency switching code to run on any CPU. + pub fn set_dvfs_possible_from_any_cpu(&mut self) -> &mut Self { + self.as_mut_ref().dvfs_possible_from_any_cpu = true; + self + } + + /// Sets transition latency for a cpufreq policy. + pub fn set_transition_latency(&mut self, latency: u32) -> &mut Self { + self.as_mut_ref().cpuinfo.transition_latency = latency; + self + } + + /// Returns the cpufreq table for a cpufreq policy. The cpufreq table is recreated in a + /// light-weight manner from the raw pointer. The table in C code is not freed once this table + /// is dropped. + pub fn freq_table(&self) -> Result { + if self.as_ref().freq_table == ptr::null_mut() { + return Err(EINVAL); + } + + // SAFETY: The `freq_table` is guaranteed to be valid. + Ok(unsafe { Table::from_raw(self.as_ref().freq_table) }) + } + + /// Sets the cpufreq table for a cpufreq policy. + /// + /// The cpufreq driver must guarantee that the frequency table does not get freed while it is + /// still being used by the C code. + pub fn set_freq_table(&mut self, table: &Table) -> &mut Self { + self.as_mut_ref().freq_table = table.as_ptr(); + self + } + + /// Returns the data for a cpufreq policy. + pub fn data(&mut self) -> Option<::Borrowed<'_>> { + if self.as_ref().driver_data.is_null() { + None + } else { + // SAFETY: The data is earlier set by us from [`set_data()`]. + Some(unsafe { T::borrow(self.as_ref().driver_data) }) + } + } + + // Sets the data for a cpufreq policy. + fn set_data(&mut self, data: T) -> Result<()> { + if self.as_ref().driver_data.is_null() { + // Pass the ownership of the data to the foreign interface. + self.as_mut_ref().driver_data = ::into_foreign(data) as _; + Ok(()) + } else { + Err(EBUSY) + } + } + + // Returns the data for a cpufreq policy. + fn clear_data(&mut self) -> Option { + if self.as_ref().driver_data.is_null() { + None + } else { + // SAFETY: The data is earlier set by us from [`set_data()`]. It is safe to take back + // the ownership of the data from the foreign interface. + let data = + Some(unsafe { ::from_foreign(self.as_ref().driver_data) }); + self.as_mut_ref().driver_data = ptr::null_mut(); + data + } + } +} + +impl Drop for Policy { + fn drop(&mut self) { + if self.put_cpu { + // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to + // relinquish it now. + unsafe { bindings::cpufreq_cpu_put(self.as_ptr()) }; + } + } +} + +/// Operations to be implemented by a cpufreq driver. +#[vtable] +pub trait DriverOps { + /// Driver specific data. + /// + /// Corresponds to the data retrieved via the kernel's + /// `cpufreq_get_driver_data()` function. + /// + /// Require that `Data` implements `ForeignOwnable`. We guarantee to + /// never move the underlying wrapped data structure. + type Data: ForeignOwnable; + + /// Policy specific data. + /// + /// Require that `PData` implements `ForeignOwnable`. We guarantee to + /// never move the underlying wrapped data structure. + type PData: ForeignOwnable; + + /// Policy's init callback. + fn init(policy: &mut Policy) -> Result; + + /// Policy's exit callback. + fn exit(_policy: &mut Policy, _data: Option) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's online callback. + fn online(_policy: &mut Policy) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's offline callback. + fn offline(_policy: &mut Policy) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's suspend callback. + fn suspend(_policy: &mut Policy) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's resume callback. + fn resume(_policy: &mut Policy) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's ready callback. + fn ready(_policy: &mut Policy) { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's verify callback. + fn verify(data: &mut PolicyData) -> Result<()>; + + /// Policy's setpolicy callback. + fn setpolicy(_policy: &mut Policy) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's target callback. + fn target(_policy: &mut Policy, _target_freq: u32, _relation: Relation) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's target_index callback. + fn target_index(_policy: &mut Policy, _index: u32) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's fast_switch callback. + fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32 { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's adjust_perf callback. + fn adjust_perf(_policy: &mut Policy, _min_perf: u64, _target_perf: u64, _capacity: u64) { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's get_intermediate callback. + fn get_intermediate(_policy: &mut Policy, _index: u32) -> u32 { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's target_intermediate callback. + fn target_intermediate(_policy: &mut Policy, _index: u32) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's get callback. + fn get(_policy: &mut Policy) -> Result { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's update_limits callback. + fn update_limits(_policy: &mut Policy) { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's bios_limit callback. + fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's set_boost callback. + fn set_boost(_policy: &mut Policy, _state: i32) -> Result<()> { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } + + /// Policy's register_em callback. + fn register_em(_policy: &mut Policy) { + kernel::build_error(VTABLE_DEFAULT_ERROR) + } +} -- 2.31.1.272.g89b43f80a514