[PATCH drm-next v3 04/15] drm: manager to keep track of GPUs VA mappings

Boris Brezillon boris.brezillon at collabora.com
Fri Apr 21 10:46:22 UTC 2023


On Tue,  4 Apr 2023 03:27:30 +0200
Danilo Krummrich <dakr at redhat.com> wrote:

> +/**
> + * drm_gpuva_prealloc_create - creates a preallocated node to store a
> + * &drm_gpuva entry.
> + *
> + * Returns: the &drm_gpuva_prealloc object on success, NULL on failure
> + */
> +struct drm_gpuva_prealloc *
> +drm_gpuva_prealloc_create(void)
> +{
> +	struct drm_gpuva_prealloc *pa;
> +
> +	pa = kzalloc(sizeof(*pa), GFP_KERNEL);
> +	if (!pa)
> +		return NULL;
> +
> +	if (mas_preallocate(&pa->mas, GFP_KERNEL)) {

mas_preallocate() needs a valid tree field to calculate the number
of nodes to pre-allocate. I guess we're missing a MA_STATE_INIT() here,
and we need to pass a gpuva_mgr object to this helper.

> +		kfree(pa);
> +		return NULL;
> +	}
> +
> +	return pa;
> +}
> +EXPORT_SYMBOL(drm_gpuva_prealloc_create);


More information about the dri-devel mailing list