Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shimtest import export test failure when NPU driver is loaded wit… #217

Merged
merged 1 commit into from
Aug 22, 2024
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
3 changes: 3 additions & 0 deletions src/driver/amdxdna/amdxdna_devel.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ void amdxdna_bo_dma_unmap(struct amdxdna_gem_obj *abo)
struct amdxdna_dev *xdna = to_xdna_dev(to_gobj(abo)->dev);

XDNA_DBG(xdna, "BO type %d dma_addr 0x%llx", abo->type, abo->mem.dma_addr);
if (is_import_bo(abo))
return;

drm_gem_shmem_put_pages(&abo->base);
}
#else
Expand Down
14 changes: 14 additions & 0 deletions src/driver/amdxdna/amdxdna_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,20 @@ amdxdna_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf)
gobj->import_attach = attach;
gobj->resv = dma_buf->resv;

#ifdef AMDXDNA_DEVEL
if (iommu_mode == AMDXDNA_IOMMU_NO_PASID) {
struct amdxdna_gem_obj *abo;

abo = to_xdna_obj(gobj);
ret = amdxdna_bo_dma_map(abo);
if (ret) {
drm_gem_object_put(gobj);
goto fail_unmap;
}
abo->mem.dev_addr = abo->mem.dma_addr;
}
#endif

return gobj;

fail_unmap:
Expand Down