Skip to content

Commit 840e075

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: Signal soft fault support to userspace
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent a01d9f1 commit 840e075

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/gpu/drm/asahi/file.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
use crate::debug::*;
1111
use crate::driver::AsahiDevice;
12-
use crate::{alloc, buffer, driver, gem, mmu, queue, util::RangeExt};
12+
use crate::{alloc, buffer, driver, gem, hw, mmu, queue, util::RangeExt};
1313
use core::mem::MaybeUninit;
1414
use core::ops::Range;
1515
use kernel::dma_fence::RawDmaFence;
@@ -280,6 +280,10 @@ impl File {
280280
params.firmware_version[i] = *gpu.get_dyncfg().firmware_version.get(i).unwrap_or(&0);
281281
}
282282

283+
if *crate::fault_control.read() == 0xb {
284+
params.feat_compat |= hw::feat::compat::SOFT_FAULTS;
285+
}
286+
283287
let size = core::mem::size_of::<uapi::drm_asahi_params_global>().min(data.size.try_into()?);
284288

285289
// SAFETY: We only write to this userptr once, so there are no TOCTOU issues.

drivers/gpu/drm/asahi/hw/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ pub(crate) enum GpuRevisionID {
9090
/// GPU driver/hardware features, from the UABI.
9191
pub(crate) mod feat {
9292
/// Backwards-compatible features.
93-
pub(crate) mod compat {}
93+
pub(crate) mod compat {
94+
use kernel::uapi;
95+
96+
/// Soft MMU faults enabled.
97+
pub(crate) const SOFT_FAULTS: u64 =
98+
uapi::drm_asahi_feat_compat_DRM_ASAHI_FEAT_SOFT_FAULTS as u64;
99+
}
94100

95101
/// Backwards-incompatible features.
96102
pub(crate) mod incompat {

0 commit comments

Comments
 (0)