[PATCH 13/34] drm/amdgpu: Convert ctx_handles to XArray
Matthew Wilcox
willy at infradead.org
Mon Feb 25 16:39:09 UTC 2019
On Mon, Feb 25, 2019 at 05:07:24PM +0100, Christian König wrote:
> > -#define AMDGPU_VM_MAX_NUM_CTX 4096
> > +#define AMDGPU_VM_CTX_LIMIT XA_LIMIT(0, 4095)
>
> IIRC we actually use 0 as reserved context value in some places.
That's OK; the ALLOC1 prevents it from using index 0.
You can change it to be XA_LIMIT(1, 4095) if you think that'll be clearer;
it'll be slightly less efficient assembly (a 64-bit mov-immediate instead
of a 32-bit mov-immediate), but it's your driver, so it's up to you.
> > @@ -533,22 +533,18 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
> > void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
> > {
> > mutex_init(&mgr->lock);
> > - idr_init(&mgr->ctx_handles);
> > + xa_init_flags(&mgr->ctx_handles, XA_FLAGS_ALLOC1);
> > }
> > void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)
> > {
More information about the dri-devel
mailing list