mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
drm/amdgpu: make sure userptr ttm is allocated
We need to allocate that manually now. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Tested-by: Michel Dänzer <mdaenzer@redhat.com> Link: https://patchwork.freedesktop.org/patch/384330/
This commit is contained in:
parent
2966141ad2
commit
77f47d2395
4 changed files with 15 additions and 10 deletions
|
@ -564,7 +564,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr)
|
||||||
|
|
||||||
mutex_lock(&process_info->lock);
|
mutex_lock(&process_info->lock);
|
||||||
|
|
||||||
ret = amdgpu_ttm_tt_set_userptr(bo->tbo.ttm, user_addr, 0);
|
ret = amdgpu_ttm_tt_set_userptr(&bo->tbo, user_addr, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s: Failed to set userptr: %d\n", __func__, ret);
|
pr_err("%s: Failed to set userptr: %d\n", __func__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -332,7 +332,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
|
||||||
bo = gem_to_amdgpu_bo(gobj);
|
bo = gem_to_amdgpu_bo(gobj);
|
||||||
bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
|
bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
|
||||||
bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
|
bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
|
||||||
r = amdgpu_ttm_tt_set_userptr(bo->tbo.ttm, args->addr, args->flags);
|
r = amdgpu_ttm_tt_set_userptr(&bo->tbo, args->addr, args->flags);
|
||||||
if (r)
|
if (r)
|
||||||
goto release_object;
|
goto release_object;
|
||||||
|
|
||||||
|
|
|
@ -1407,21 +1407,26 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
|
||||||
* amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt for the current
|
* amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt for the current
|
||||||
* task
|
* task
|
||||||
*
|
*
|
||||||
* @ttm: The ttm_tt object to bind this userptr object to
|
* @bo: The ttm_buffer_object to bind this userptr to
|
||||||
* @addr: The address in the current tasks VM space to use
|
* @addr: The address in the current tasks VM space to use
|
||||||
* @flags: Requirements of userptr object.
|
* @flags: Requirements of userptr object.
|
||||||
*
|
*
|
||||||
* Called by amdgpu_gem_userptr_ioctl() to bind userptr pages
|
* Called by amdgpu_gem_userptr_ioctl() to bind userptr pages
|
||||||
* to current task
|
* to current task
|
||||||
*/
|
*/
|
||||||
int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
|
int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo,
|
||||||
uint32_t flags)
|
uint64_t addr, uint32_t flags)
|
||||||
{
|
{
|
||||||
struct amdgpu_ttm_tt *gtt = (void *)ttm;
|
struct amdgpu_ttm_tt *gtt;
|
||||||
|
|
||||||
if (gtt == NULL)
|
if (!bo->ttm) {
|
||||||
return -EINVAL;
|
/* TODO: We want a separate TTM object type for userptrs */
|
||||||
|
bo->ttm = amdgpu_ttm_tt_create(bo, 0);
|
||||||
|
if (bo->ttm == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtt = (void*)bo->ttm;
|
||||||
gtt->userptr = addr;
|
gtt->userptr = addr;
|
||||||
gtt->userflags = flags;
|
gtt->userflags = flags;
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,8 @@ static inline bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages);
|
void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages);
|
||||||
int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
|
int amdgpu_ttm_tt_set_userptr(struct ttm_buffer_object *bo,
|
||||||
uint32_t flags);
|
uint64_t addr, uint32_t flags);
|
||||||
bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm);
|
bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm);
|
||||||
struct mm_struct *amdgpu_ttm_tt_get_usermm(struct ttm_tt *ttm);
|
struct mm_struct *amdgpu_ttm_tt_get_usermm(struct ttm_tt *ttm);
|
||||||
bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start,
|
bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start,
|
||||||
|
|
Loading…
Add table
Reference in a new issue