mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
Merge tag 'v6.17-rc6' into drm-next
This is a backmerge of Linux 6.17-rc6, needed for msm, also requested by misc. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -285,6 +285,36 @@ static int amdgpu_dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int amdgpu_dma_buf_vmap(struct dma_buf *dma_buf, struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_object *obj = dma_buf->priv;
|
||||
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Pin to keep buffer in place while it's vmap'ed. The actual
|
||||
* domain is not that important as long as it's mapable. Using
|
||||
* GTT and VRAM should be compatible with most use cases.
|
||||
*/
|
||||
ret = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT | AMDGPU_GEM_DOMAIN_VRAM);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = drm_gem_dmabuf_vmap(dma_buf, map);
|
||||
if (ret)
|
||||
amdgpu_bo_unpin(bo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void amdgpu_dma_buf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_object *obj = dma_buf->priv;
|
||||
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
|
||||
|
||||
drm_gem_dmabuf_vunmap(dma_buf, map);
|
||||
amdgpu_bo_unpin(bo);
|
||||
}
|
||||
|
||||
const struct dma_buf_ops amdgpu_dmabuf_ops = {
|
||||
.attach = amdgpu_dma_buf_attach,
|
||||
.pin = amdgpu_dma_buf_pin,
|
||||
@@ -294,8 +324,8 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = {
|
||||
.release = drm_gem_dmabuf_release,
|
||||
.begin_cpu_access = amdgpu_dma_buf_begin_cpu_access,
|
||||
.mmap = drm_gem_dmabuf_mmap,
|
||||
.vmap = drm_gem_dmabuf_vmap,
|
||||
.vunmap = drm_gem_dmabuf_vunmap,
|
||||
.vmap = amdgpu_dma_buf_vmap,
|
||||
.vunmap = amdgpu_dma_buf_vunmap,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -526,7 +556,7 @@ bool amdgpu_dmabuf_is_xgmi_accessible(struct amdgpu_device *adev,
|
||||
return false;
|
||||
|
||||
if (drm_gem_is_imported(obj)) {
|
||||
struct dma_buf *dma_buf = obj->dma_buf;
|
||||
struct dma_buf *dma_buf = obj->import_attach->dmabuf;
|
||||
|
||||
if (dma_buf->ops != &amdgpu_dmabuf_ops)
|
||||
/* No XGMI with non AMD GPUs */
|
||||
|
||||
Reference in New Issue
Block a user