Skip to content

Commit b9a8114

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: Move the unknown dummy page to the top of the address space
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 10d7883 commit b9a8114

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

drivers/gpu/drm/asahi/file.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ const VM_DRV_GPU_END: u64 = 0x70_ffffffff;
170170
const VM_DRV_GPUFW_START: u64 = 0x71_00000000;
171171
/// End address of the kernel-managed GPU/FW shared mapping region.
172172
const VM_DRV_GPUFW_END: u64 = 0x71_ffffffff;
173-
/// Address of a special dummy page?
174-
const VM_UNK_PAGE: u64 = 0x6f_ffff8000;
175173

176174
impl drm::file::DriverFile for File {
177175
type Driver = driver::AsahiDriver;
@@ -349,7 +347,8 @@ impl File {
349347
);
350348
let mut dummy_obj = gem::new_kernel_object(device, 0x4000)?;
351349
dummy_obj.vmap()?.as_mut_slice().fill(0);
352-
let dummy_mapping = dummy_obj.map_at(&vm, VM_UNK_PAGE, mmu::PROT_GPU_SHARED_RW, true)?;
350+
let dummy_mapping =
351+
dummy_obj.map_at(&vm, mmu::IOVA_UNK_PAGE, mmu::PROT_GPU_SHARED_RW, true)?;
353352

354353
mod_dev_dbg!(device, "[File {} VM {}]: VM created\n", file_id, id);
355354
resv.store(Box::new(Vm {

drivers/gpu/drm/asahi/initdata.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,12 @@ impl<'a> InitDataBuilder::ver<'a> {
487487
#[ver(V < V13_0B4)]
488488
unk_10: U64(0x1_00000000),
489489
unk_18: U64(0xffc00000),
490-
unk_20: U64(0x11_00000000),
491-
unk_28: U64(0x11_00000000),
492-
// userspace address?
493-
unk_30: U64(0x6f_ffff8000),
490+
// USC start
491+
unk_20: U64(0), // U64(0x11_00000000),
492+
unk_28: U64(0), // U64(0x11_00000000),
493+
// Unknown page
494+
//unk_30: U64(0x6f_ffff8000),
495+
unk_30: U64(mmu::IOVA_UNK_PAGE),
494496
// unmapped?
495497
unkptr_38: U64(0xffffffa0_11800000),
496498
// TODO: yuv matrices

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ const TTBR_ASID_SHIFT: usize = 48;
8787

8888
const PTE_TABLE: u64 = 0x3; // BIT(0) | BIT(1)
8989

90+
/// Address of a special dummy page?
91+
//const IOVA_UNK_PAGE: u64 = 0x6f_ffff8000;
92+
pub(crate) const IOVA_UNK_PAGE: u64 = IOVA_USER_TOP - 2 * UAT_PGSZ as u64;
93+
9094
// KernelMapping protection types
9195

9296
// Note: prot::CACHE means "cache coherency", which for UAT means *uncached*,

0 commit comments

Comments
 (0)