Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/amdgpu: -EOPNOTSUPP in amdgpu_ttm_tt_populate() when need_swiotlb is set --
commit 0d7e02838b040282a0c34d64857fd1fdc0a04ed6 Author: Himal Prasad Ghimiray <[email protected]> drm/amdgpu: Use ttm_operation_ctx numa_info instead of per-partition pools This commit removes the per-partition TTM pools on APUs with memory partitions and allocates pages from the device pool using TTM_NUMA_POLICY_PREFERRED in ttm_operation_ctx. > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > index d3a875a32af1e..8740b7a76ad19 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c [ ... ] > @@ -1242,7 +1245,9 @@ static int amdgpu_ttm_tt_populate(struct ttm_device > *bdev, > { > struct amdgpu_device *adev = amdgpu_ttm_adev(bdev); > struct amdgpu_ttm_tt *gtt = ttm_to_amdgpu_ttm_tt(ttm); > - struct ttm_pool *pool; > + /* ctx is shared by every BO of the operation; set the node locally */ > + struct ttm_operation_ctx node_ctx = *ctx; > + nodemask_t preferred; > pgoff_t i; > int ret; > > @@ -1257,11 +1262,13 @@ static int amdgpu_ttm_tt_populate(struct ttm_device > *bdev, > if (ttm->page_flags & TTM_TT_FLAG_EXTERNAL) > return 0; > > - if (adev->mman.ttm_pools && gtt->pool_id >= 0) > - pool = &adev->mman.ttm_pools[gtt->pool_id]; > - else > - pool = &adev->mman.bdev.pool; > - ret = ttm_pool_alloc(pool, ttm, ctx); > + if (gtt->numa_node != NUMA_NO_NODE) { > + nodes_clear(preferred); > + node_set(gtt->numa_node, preferred); > + node_ctx.numa_info.policy = TTM_NUMA_POLICY_PREFERRED; > + node_ctx.numa_info.nodes = &preferred; > + } > + ret = ttm_pool_alloc(&adev->mman.bdev.pool, ttm, &node_ctx); [Severity: High] Will ttm_pool_alloc() fail with -EOPNOTSUPP when adev->need_swiotlb is set on a partitioned APU? amdgpu_ttm_init() initializes adev->mman.bdev.pool with TTM_ALLOCATION_POOL_USE_DMA_ALLOC when adev->need_swiotlb is true (for example, under SME/SEV memory encryption), whereas the old amdgpu_ttm_pools_init() omitted that flag on the per-partition pools. Because ttm_pool_check_numa() rejects any policy other than TTM_NUMA_POLICY_NONE when TTM_ALLOCATION_POOL_USE_DMA_ALLOC is set on the pool, populating any BO with a partition NUMA node will now fail with -EOPNOTSUPP. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
