drm/msm: Add support for private address space instances
Add support for allocating private address space instances. Targets that support per-context pagetables should implement their own function to allocate private address spaces. The default will return a pointer to the global address space. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
@@ -589,7 +589,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file)
|
||||
kref_init(&ctx->ref);
|
||||
msm_submitqueue_init(dev, ctx);
|
||||
|
||||
ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL;
|
||||
ctx->aspace = msm_gpu_create_private_address_space(priv->gpu);
|
||||
file->driver_priv = ctx;
|
||||
|
||||
return 0;
|
||||
@@ -772,18 +772,19 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
|
||||
}
|
||||
|
||||
static int msm_ioctl_gem_info_iova(struct drm_device *dev,
|
||||
struct drm_gem_object *obj, uint64_t *iova)
|
||||
struct drm_file *file, struct drm_gem_object *obj,
|
||||
uint64_t *iova)
|
||||
{
|
||||
struct msm_drm_private *priv = dev->dev_private;
|
||||
struct msm_file_private *ctx = file->driver_priv;
|
||||
|
||||
if (!priv->gpu)
|
||||
if (!ctx->aspace)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Don't pin the memory here - just get an address so that userspace can
|
||||
* be productive
|
||||
*/
|
||||
return msm_gem_get_iova(obj, priv->gpu->aspace, iova);
|
||||
return msm_gem_get_iova(obj, ctx->aspace, iova);
|
||||
}
|
||||
|
||||
static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
|
||||
@@ -822,7 +823,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
|
||||
args->value = msm_gem_mmap_offset(obj);
|
||||
break;
|
||||
case MSM_INFO_GET_IOVA:
|
||||
ret = msm_ioctl_gem_info_iova(dev, obj, &args->value);
|
||||
ret = msm_ioctl_gem_info_iova(dev, file, obj, &args->value);
|
||||
break;
|
||||
case MSM_INFO_SET_NAME:
|
||||
/* length check should leave room for terminating null: */
|
||||
|
Reference in New Issue
Block a user