AMD Kernel model Driver(1)

本文详细解释了AMDGPU驱动中的内存控制(MemoryControl),包括GTT、VRAM、GPU虚拟内存空间(GPUVM)的工作原理,以及它们在GPU进程管理和地址映射中的作用。特别提到了VMID、GPU地址空间和共享显存的概念。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

AMD GPU Driver

AMD相关名词解释:

MC:Memory Control

OverLay:指的是不通过GPU流水线处理也不被放入FB和CRTC的数据,但最终FB中的数据会一起通过显示器显示出来,直接覆盖在FB上面,不需要去叠加,混合,比如通过video codec出来的

Memory Manager

存储区域

  • SYSTEM域:位于系统内存,CPU可以直接访问,GPU不可访问
  • GTT域:位于系统内存,CPU可以直接访问,GPU通过GART表访问(ring buffer就在这里)
  • VRAM域:位于显存,CPU通过I/O映射访问,GPU可以直接访问,也称local,(顶点一般放这,纹理GTT和VRAM皆可)

GPUVM:

​ 是GPU提供的MMU功能,类似GART, 每一个GPU 进程有一份GPU页表,一般最多16个,在提交Command的时候GPU驱动会把进程对应的GPU页表设置到硬件寄存器中,在细节上GPU的地址分配和映射和CPU稍有不同。 和GART区别是,GART只支持一个地址空间,而GPUVM支持多个地址空间,用VMID来标识。

​ GPUVM不仅可以映射系统内存还可以映射显存,也就是说将系统内存和显存放在统一的地址空间中管理。还可以映射为snooped/nonsnoop(cache/uncache system page)

​ 在执行cmd buffer的时候,内核应该告诉engine使用使用的cmd buffer的VMID,VMID是在Submit时候动态分配的。

​ GPUVM由1-2或1-5级页表表示,具体取决于chip,它也支持RWX属性或其他属性,比如加密和caching 属性

​ 在AMD显卡中,VMID0是给内核驱动预留的,除了page table管理的apertures,vmid0还有其他apertures,有一个apertures用来直接访问VRAM,还有一个旧的AGP aperature仅仅将(memory)访问直接转发到system physical address(或当IOMMU存在时的IOVA),(这个应该说的是旧的PA模式)这些aperature提供了对这些内存的直接访问,而没有页表的开销,VIMD0由KMD用于内存管理等任务

​ GPU clients(engines),即每个APP都有自己唯一的地址空间,KMD管理每个进程的GPU VM page Table,当访问的无效页面时,会触发Page Fault

共享显存

一般在核显中常见,当作VRAM去处理,而不是GART,CPU需要IO映射才能访问,这种也叫UMA

struct radeon_mc {  
     resource_size_t  aper_size;
     resource_size_t  aper_base;
     u64          gtt_size;   
     u64          gtt_start;   
     u64          gtt_end;
     u64          mc_vram_size;
     u64          visible_vram_size;
     u64          active_vram_size;
     u64          real_vram_size;
     u64          vram_start; 
     u64          vram_end;
     …… 
};
  • mc_vram_size: 表示显卡芯片的真实显存大小

  • real_vram_size:初始化值为mc_vram_size,但如果通过启动参数radeon.vramlimit对显存容量限定的话,则取最小;

  • visible_vram_size:程序可见的显存大小,通常小于或等于real_vram_size,运行可以重新设置

  • aper_base(aperture,PCI BAR的范围在物理地址空间里面类似于一个孔洞):CPU不能访问所有显存,一般只有256m,PCI BAR的范围在物理地址空间里面类似于一个孔洞

  • aper_size:允许映射到CPU地址空间的显存大小

    通常mc_vram_size ≥ real_vram_size ≥ visible_vram_size (aper_size) ≥ active_vram_size

未完待补充…

### CM211-1 Debian Configuration and Drivers For configuring a system with hardware model CM211-1 under Debian, specific attention must be paid to both the base installation process as well as ensuring compatibility of drivers especially for graphics cards like NVIDIA. The command `debootstrap etch /mnt ftp://ftp.de.debian.org/debian/` was used historically for setting up a basic Debian environment but this method is outdated given current versions such as Debian 12[^1]. For modern installations including those targeting systems similar to CM211-1, it's recommended to use more recent tools provided by Debian or other third-party solutions that support newer architectures better. Regarding driver issues observed after updating the Linux kernel to version `linux-image-6.6.13+bpo-amd64`, there have been reports indicating problems when using certain Nvidia drivers (version `535.154.05`) which prevent users from accessing graphical interfaces post-update[^2]. This suggests potential conflicts between updated kernels and existing proprietary drivers installed on the machine. To address these challenges: - Verify if official repositories contain compatible packages for your device. - Consider testing different versions of available drivers until finding one stable enough for daily usage. - Explore community forums where others might share experiences related specifically to CM211-1 configurations within Debian environments. Additionally, while not directly linked to CM211-1 setup, some general tips about managing software services in Debian could prove useful during troubleshooting phases; for instance, knowing how easily applications can now be managed via simple commands like installing FileZilla through APT package manager has streamlined many administrative tasks over time[^4]. Lastly, advanced debugging techniques involving tools like Valgrind may help identify memory leaks or performance bottlenecks associated with running particular daemons alongside GPU operations – although primarily focused here on NFS-Ganesha setups rather than direct application towards solving initial query regarding CM211-1 specifics[^5]. ```bash sudo apt-get update && sudo apt-get upgrade -y ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值