Skip to content

Commit f6a111c

Browse files
jannaujohn-cabaj
authored andcommitted
fixup! rust: drm: sched: Add GPU scheduler abstraction
kernel API changes: - externel submit workqueues - scheduler/job credits Signed-off-by: Janne Grunau <j@jannau.net> (cherry picked from commit ad7070d https://github.com/AsahiLinux/linux) Signed-off-by: John Cabaj <john.cabaj@canonical.com>
1 parent dec905b commit f6a111c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

rust/kernel/drm/sched.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<T: JobImpl> Entity<T> {
262262
///
263263
/// The entity must outlive the pending job until it transitions into the submitted state,
264264
/// after which the scheduler owns it.
265-
pub fn new_job(&self, inner: T) -> Result<PendingJob<'_, T>> {
265+
pub fn new_job(&self, credits: u32, inner: T) -> Result<PendingJob<'_, T>> {
266266
let mut job: Box<MaybeUninit<Job<T>>> = Box::try_new_zeroed()?;
267267

268268
// SAFETY: We hold a reference to the entity (which is a valid pointer),
@@ -271,6 +271,7 @@ impl<T: JobImpl> Entity<T> {
271271
bindings::drm_sched_job_init(
272272
addr_of_mut!((*job.as_mut_ptr()).job),
273273
&self.0.as_ref().get_ref().entity as *const _ as *mut _,
274+
credits,
274275
core::ptr::null_mut(),
275276
)
276277
})?;
@@ -310,12 +311,14 @@ impl<T: JobImpl> Scheduler<T> {
310311
run_job: Some(run_job_cb::<T>),
311312
timedout_job: Some(timedout_job_cb::<T>),
312313
free_job: Some(free_job_cb::<T>),
314+
update_job_credits: None,
313315
};
314316
/// Creates a new DRM Scheduler object
315317
// TODO: Shared timeout workqueues & scores
316318
pub fn new(
317319
device: &impl device::RawDevice,
318-
hw_submission: u32,
320+
num_rqs: u32,
321+
credit_limit: u32,
319322
hang_limit: u32,
320323
timeout_ms: usize,
321324
name: &'static CStr,
@@ -327,7 +330,9 @@ impl<T: JobImpl> Scheduler<T> {
327330
bindings::drm_sched_init(
328331
addr_of_mut!((*sched.as_mut_ptr()).sched),
329332
&Self::OPS,
330-
hw_submission,
333+
core::ptr::null_mut(),
334+
num_rqs,
335+
credit_limit,
331336
hang_limit,
332337
bindings::msecs_to_jiffies(timeout_ms.try_into()?).try_into()?,
333338
core::ptr::null_mut(),

0 commit comments

Comments
 (0)