Skip to content

Commit 6dc7d3b

Browse files
committed
fixup! drm/asahi: Adapt to v6.15 + v6.16-rc1 rust / driver-core(rust)
1 parent 64bde2c commit 6dc7d3b

5 files changed

Lines changed: 19 additions & 20 deletions

File tree

drivers/gpu/drm/asahi/channel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use kernel::{
1818
c_str,
1919
prelude::*,
2020
sync::Arc,
21-
time::{delay::fsleep, Delta, Instant},
21+
time::{delay::fsleep, Delta, Instant, Monotonic},
2222
};
2323

2424
pub(crate) use crate::fw::channels::PipeType;
@@ -164,7 +164,7 @@ where
164164
/// If the poll takes longer than 10ms, this switches to sleeping between polls.
165165
pub(crate) fn wait_for(&mut self, wptr: u32, timeout_ms: i64) -> Result {
166166
const MAX_FAST_POLL: i64 = 10;
167-
let start = Instant::now();
167+
let start = Instant::<Monotonic>::now();
168168
let timeout_ms = timeout_ms.max(1);
169169
let timeout_fast = Delta::from_millis(timeout_ms.min(MAX_FAST_POLL));
170170
let timeout_slow = Delta::from_millis(timeout_ms);

drivers/gpu/drm/asahi/driver.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Top-level GPU driver implementation.
44
55
use kernel::{
6-
c_str, device::Core, drm, drm::ioctl, error::Result, of, platform, prelude::*, sync::Arc,
6+
c_str, device::Core, dma::{Device, DmaMask}, drm, drm::ioctl, error::Result, of, platform, prelude::*, sync::Arc,
77
};
88

99
use crate::{debug, file, gem, gpu, hw, regs};
@@ -149,8 +149,7 @@ impl platform::Driver for AsahiDriver {
149149

150150
let cfg = info.ok_or(ENODEV)?;
151151

152-
pdev.as_ref()
153-
.dma_set_mask_and_coherent((1 << cfg.uat_oas) - 1)?;
152+
unsafe { pdev.dma_set_mask_and_coherent(DmaMask::try_new((1 << cfg.uat_oas) - 1)?)? };
154153

155154
let res = regs::Resources::new(pdev)?;
156155

drivers/gpu/drm/asahi/gpu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use kernel::{
2828
lock::{mutex::MutexBackend, Guard},
2929
Arc, Mutex, UniqueArc,
3030
},
31-
time::{msecs_to_jiffies, Delta, Instant},
31+
time::{msecs_to_jiffies, Delta, Instant, Monotonic},
3232
types::ForeignOwnable,
3333
};
3434

@@ -1017,7 +1017,7 @@ impl GpuManager::ver {
10171017
dev_err!(self.dev.as_ref(), " Halted: {}\n", halted);
10181018

10191019
if halted == 0 {
1020-
let start = Instant::now();
1020+
let start = Instant::<Monotonic>::now();
10211021
while start.elapsed() < HALT_ENTER_TIMEOUT {
10221022
halted = raw.flags.halted.load(Ordering::Relaxed);
10231023
if halted != 0 {

drivers/gpu/drm/asahi/initdata.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'a> InitDataBuilder::ver<'a> {
162162

163163
/// Create the HwDataShared3 structure, which is used in two places in InitData.
164164
fn hw_shared3(cfg: &'static hw::HwConfig) -> impl Init<raw::HwDataShared3> {
165-
pin_init::zeroed::<raw::HwDataShared3>().chain(|ret| {
165+
pin_init::init_zeroed::<raw::HwDataShared3>().chain(|ret| {
166166
if !cfg.shared3_tab.is_empty() {
167167
ret.unk_0 = 1;
168168
ret.unk_4 = 500;
@@ -181,7 +181,7 @@ impl<'a> InitDataBuilder::ver<'a> {
181181
) -> impl Init<raw::T81xxData> {
182182
let _perf_max_pstate = dyncfg.pwr.perf_max_pstate;
183183

184-
pin_init::zeroed::<raw::T81xxData>().chain(move |_ret| {
184+
pin_init::init_zeroed::<raw::T81xxData>().chain(move |_ret| {
185185
match cfg.chip_id {
186186
0x8103 | 0x8112 => {
187187
#[ver(V < V13_3)]
@@ -235,7 +235,7 @@ impl<'a> InitDataBuilder::ver<'a> {
235235

236236
self.alloc
237237
.private
238-
.new_init(pin_init::zeroed(), |_inner, _ptr| {
238+
.new_init(pin_init::init_zeroed(), |_inner, _ptr| {
239239
let cfg = &self.cfg;
240240
let dyncfg = &self.dyncfg;
241241
try_init!(raw::HwDataA::ver {
@@ -399,7 +399,7 @@ impl<'a> InitDataBuilder::ver<'a> {
399399
unk_114: f32!(65536.0),
400400
unk_124: 40,
401401
max_pstate_scaled_2: max_ps_scaled,
402-
..Zeroable::zeroed()
402+
..Zeroable::init_zeroed()
403403
})
404404
},
405405
fast_die0_sensor_mask_2: U64(cfg.fast_sensor_mask[0]),
@@ -418,7 +418,7 @@ impl<'a> InitDataBuilder::ver<'a> {
418418
hws2 <- Self::hw_shared2(cfg, dyncfg),
419419
hws3 <- Self::hw_shared3(cfg),
420420
unk_3ce8: 1,
421-
..Zeroable::zeroed()
421+
..Zeroable::init_zeroed()
422422
})
423423
.chain(|raw| {
424424
for i in 0..self.dyncfg.pwr.perf_states.len() {
@@ -512,7 +512,7 @@ impl<'a> InitDataBuilder::ver<'a> {
512512
fn hwdata_b(&mut self) -> Result<GpuObject<HwDataB::ver>> {
513513
self.alloc
514514
.private
515-
.new_init(pin_init::zeroed(), |_inner, _ptr| {
515+
.new_init(pin_init::init_zeroed(), |_inner, _ptr| {
516516
let cfg = &self.cfg;
517517
let dyncfg = &self.dyncfg;
518518
try_init!(raw::HwDataB::ver {
@@ -589,7 +589,7 @@ impl<'a> InitDataBuilder::ver<'a> {
589589
unk_c3c: 0x19,
590590
#[ver(V >= V13_3)]
591591
unk_c3c: 0x1a,
592-
..Zeroable::zeroed()
592+
..Zeroable::init_zeroed()
593593
})
594594
.chain(|raw| {
595595
#[ver(V >= V13_3)]
@@ -692,7 +692,7 @@ impl<'a> InitDataBuilder::ver<'a> {
692692
fn globals(&mut self) -> Result<GpuObject<Globals::ver>> {
693693
self.alloc
694694
.private
695-
.new_init(pin_init::zeroed(), |_inner, _ptr| {
695+
.new_init(pin_init::init_zeroed(), |_inner, _ptr| {
696696
let cfg = &self.cfg;
697697
let dyncfg = &self.dyncfg;
698698
let pwr = &dyncfg.pwr;
@@ -725,7 +725,7 @@ impl<'a> InitDataBuilder::ver<'a> {
725725
unk_58: 0xffff,
726726
unk_5e: U32(1),
727727
unk_66: U32(1),
728-
..Zeroable::zeroed()
728+
..Zeroable::init_zeroed()
729729
}),
730730
unk_8900: 1,
731731
pending_submissions: AtomicU32::new(0),
@@ -768,7 +768,7 @@ impl<'a> InitDataBuilder::ver<'a> {
768768
unk_903c: 1,
769769
#[ver(V < V13_0B4)]
770770
unk_903c: 0,
771-
fault_control: *module_parameters::fault_control.get(),
771+
fault_control: *module_parameters::fault_control.value(),
772772
do_init: 1,
773773
progress_check_interval_3d: 40,
774774
progress_check_interval_ta: 10,
@@ -860,7 +860,7 @@ impl<'a> InitDataBuilder::ver<'a> {
860860
try_init!(Stats::ver {
861861
vtx: alloc.private.new_default::<GpuGlobalStatsVtx>()?,
862862
frag: alloc.private.new_init(
863-
pin_init::zeroed::<GpuGlobalStatsFrag::ver>(),
863+
pin_init::init_zeroed::<GpuGlobalStatsFrag::ver>(),
864864
|_inner, _ptr| {
865865
try_init!(raw::GpuGlobalStatsFrag::ver {
866866
total_cmds: 0,

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use kernel::{
2828
lock::{mutex::MutexBackend, Guard},
2929
Arc, Mutex,
3030
},
31-
time::{delay::fsleep, Delta, Instant},
31+
time::{delay::fsleep, Delta, Instant, Monotonic},
3232
types::ARef,
3333
};
3434

@@ -414,7 +414,7 @@ impl VmInner {
414414
let mut offset = node.offset;
415415
let mut left = node.mapped_size;
416416

417-
for range in unsafe { sgt.iter_raw() } {
417+
for range in sgt.iter() {
418418
if left == 0 {
419419
break;
420420
}

0 commit comments

Comments
 (0)