On 9/17/26 14:12, SRINIVASAN SHANMUGAM wrote: > > On 9/17/2026 5:13 PM, Christian König wrote: >> On 9/17/26 11:05, Srinivasan Shanmugam wrote: >>> Replace amdgpu_bo_kmap()/amdgpu_bo_kunmap() in the trap handler code >>> with ttm_bo_vmap()/ttm_bo_vunmap(). >>> >>> Store the mapping as struct iosys_map and use iosys_map helpers for >>> memory access. This aligns the trap code with the modern DRM/TTM mapping >>> interfaces. >>> >>> Using iosys_map allows the code to use common DRM mapping helpers >>> instead of directly accessing memory through raw CPU pointers. >> I'm really wondering if we shouldn't rework amdgpu_bo_kmap() into >> amdgpu_bo_vmap() and use that everywhere? > > Hi Christian, > > Thanks, that's a very good point. > > Introducing amdgpu_bo_vmap()/amdgpu_bo_vunmap() and gradually > converting existing amdgpu_bo_kmap() users sounds like a useful > cleanup for AMDGPU in general. > > I did a quick grep and found amdgpu_bo_kmap() users in a number > of AMDGPU/KFD files, so this seems broader than the trap-specific > conversion.
That's what I meant with a backward compatible interface. E.g. just return the kernel pointer the same way kmap does, it isn't 100% clean but still better than what we do today. > > Would it make sense to keep this trap change focused on the > original conversion and handle the wider AMDGPU migration as a > separate follow-up cleanup activity? I leave that up to you, if you feel that this is to much work feel free to add my rb to the existing patch. That one looks good enough that we can land it. Regards, Christian. > > I'd be happy to look into that separately as well. > > Regards, > Srini > >> >> We can of course start with backward compatible return the kernel poiunter >> and then switch other users of amdgpu_bo_kmap() over to iosys_map one by one. >> >> Regards, >> Christian.
