diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-03 15:44:49 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-03 15:44:49 +0100 |
| commit | 4dac529c9a2c0ed1286801ec62d23538035a3a1d (patch) | |
| tree | c99335269438629bc089c9895e6156cf9a374a22 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | |
| parent | 5a42c9f18870162ae14f0d8e193671017421a982 (diff) | |
| parent | 50be7c9b5d5ea55fd40bb411cf324cec99ec7417 (diff) | |
| download | linux-next-4dac529c9a2c0ed1286801ec62d23538035a3a1d.tar.gz linux-next-4dac529c9a2c0ed1286801ec62d23538035a3a1d.zip | |
Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux.git
# Conflicts:
# drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
# drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
# drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
# drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h index e444b2088d40..a4b89eca4169 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h @@ -25,6 +25,7 @@ #include <linux/ktime.h> #include <linux/types.h> +#include <linux/xarray.h> #include "amdgpu_ring.h" @@ -60,16 +61,21 @@ struct amdgpu_ctx { struct amdgpu_ctx_mgr { struct amdgpu_device *adev; - struct mutex lock; - /* protected by lock */ - struct idr ctx_handles; + struct xarray ctx_handles; atomic64_t time_spend[AMDGPU_HW_IP_NUM]; }; extern const unsigned int amdgpu_ctx_num_entities[AMDGPU_HW_IP_NUM]; struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id); -int amdgpu_ctx_put(struct amdgpu_ctx *ctx); + +void amdgpu_ctx_fini(struct kref *kref); + +static inline void amdgpu_ctx_put(struct amdgpu_ctx *ctx) +{ + if (ctx) + kref_put(&ctx->refcount, amdgpu_ctx_fini); +} int amdgpu_ctx_get_entity(struct amdgpu_ctx *ctx, u32 hw_ip, u32 instance, u32 ring, struct drm_sched_entity **entity); |
