Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion drivers/gpu/drm/asahi/g17/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,13 @@ impl Manager {
if metrics.scene_stride != layout.metric_stride {
return Err(EINVAL);
}
// The parameter-buffer graph's kernel mapping, in the upper half every execution context
// includes, is the firmware's alone. The GPU reaches its page list only through the
// client alias below.
let mut graph = alloc.kernel(
layout.bytes,
cfg::TVB_PAGE,
mmu::PROT_GPU_FW_SHARED_RW,
mmu::PROT_FW_SHARED_RW,
CpuMap::WriteCombined,
)?;
let source = layout.pages..layout.pages + layout.page_bytes;
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/asahi/g17/queue/render/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,13 @@ impl NeoGeneration {
mmu::PROT_GPU_FW_SHARED_RW,
mmu::UAT_PGSZ,
)?;
// The fragment status page's kernel mapping, in the upper half every execution context
// includes, is the firmware's alone: the firmware reads the status there, and the GPU
// writes it through the client alias below.
let fragment = alloc.kernel(
mmu::UAT_PGSZ,
mmu::UAT_PGSZ as u64,
mmu::PROT_GPU_FW_SHARED_RW,
mmu::PROT_FW_SHARED_RW,
CpuMap::WriteCombined,
)?;
let fragment_client = buffer::compact_alias(
Expand Down
3 changes: 2 additions & 1 deletion tools/asahi/neo-auxiliary-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
impl<T> Deref for KBox<T>{type Target=T;fn deref(&self)->&T{&self.0}}
mod mmu {
pub const UAT_PGSZ:usize=0x4000;
pub const PROT_FW_SHARED_RW:u32=1;
pub const PROT_GPU_FW_SHARED_RW:u32=3;
pub const PROT_GPU_SHARED_RW:u32=2;
pub struct Vm;
Expand All @@ -35,7 +36,7 @@
fn map_range(&self,_v:&mmu::Vm,_r:Range<usize>,_a:Range<u64>,_align:u64,_p:u32,_g:u32)->Result<mmu::KernelMapping>{Err(-28)}
}
struct Allocator<'a>{_p:std::marker::PhantomData<&'a ()>}
impl Allocator<'_>{fn kernel(&self,size:usize,align:u64,p:u32,_c:CpuMap)->Result<KernelObject>{assert_eq!(size,mmu::UAT_PGSZ);assert_eq!(align,0x4000);assert_eq!(p,3);Ok(KernelObject{va:0x40000000,size})}}
impl Allocator<'_>{fn kernel(&self,size:usize,align:u64,p:u32,_c:CpuMap)->Result<KernelObject>{assert_eq!(size,mmu::UAT_PGSZ);assert_eq!(align,0x4000);assert_eq!(p,mmu::PROT_FW_SHARED_RW,"the fragment status page's kernel mapping is firmware-only");Ok(KernelObject{va:0x40000000,size})}}
mod buffer{
use super::*;
pub fn compact_alias(o:&KernelObject,_v:&mmu::Vm,r:Range<usize>,align:u64,p:u32,guard:usize)->Result<mmu::KernelMapping>{assert!(r.end<=o.size);assert_eq!(align,0x4000);assert_eq!(guard,0x4000);assert!(p==2||p==3);Ok(mmu::KernelMapping{va:o.va+r.start as u64})}
Expand Down
Loading