Skip to content

Commit 7c613a1

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: mmu: Wire up kernel AS dumper
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 31aace3 commit 7c613a1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ pub(crate) const IOVA_USER_TOP: u64 = 1 << (UAT_IAS as u64);
6464
pub(crate) const IOVA_USER_RANGE: Range<u64> = IOVA_USER_BASE..IOVA_USER_TOP;
6565

6666
/// Upper/kernel base VA
67-
// const IOVA_TTBR1_BASE: usize = 0xffffff8000000000;
67+
const IOVA_TTBR1_BASE: u64 = 0xffffff8000000000;
6868
/// Driver-managed kernel base VA
6969
const IOVA_KERN_BASE: u64 = 0xffffffa000000000;
7070
/// Driver-managed kernel top VA
7171
const IOVA_KERN_TOP: u64 = 0xffffffb000000000;
72-
/// Lower/user VA range
72+
/// Driver-managed kernel VA range
7373
const IOVA_KERN_RANGE: Range<u64> = IOVA_KERN_BASE..IOVA_KERN_TOP;
74+
/// Full kernel VA range
75+
const IOVA_KERN_FULL_RANGE: Range<u64> = IOVA_TTBR1_BASE..(!UAT_PGMSK as u64);
7476

7577
const TTBR_VALID: u64 = 0x1; // BIT(0)
7678
const TTBR_ASID_SHIFT: usize = 48;
@@ -1380,6 +1382,11 @@ impl Uat {
13801382
&self.kernel_lower_vm
13811383
}
13821384

1385+
pub(crate) fn dump_kernel_pages(&self) -> Result<KVVec<pgtable::DumpedPage>> {
1386+
let mut inner = self.kernel_vm.inner.exec_lock(None, false)?;
1387+
inner.page_table.dump_pages(IOVA_KERN_FULL_RANGE)
1388+
}
1389+
13831390
/// Returns the base physical address of the TTBAT region.
13841391
pub(crate) fn ttb_base(&self) -> u64 {
13851392
let inner = self.inner.lock();

0 commit comments

Comments
 (0)