mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
drm/amdgpu: add owner for sched fence
Signed-off-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian K?nig <christian.koenig@amd.com>
This commit is contained in:
parent
c14692f0a7
commit
84f76ea6b0
6 changed files with 10 additions and 8 deletions
|
@ -1264,7 +1264,6 @@ struct amdgpu_cs_parser {
|
||||||
struct amdgpu_job {
|
struct amdgpu_job {
|
||||||
struct amd_sched_job base;
|
struct amd_sched_job base;
|
||||||
struct amdgpu_device *adev;
|
struct amdgpu_device *adev;
|
||||||
struct drm_file *owner;
|
|
||||||
struct amdgpu_ib *ibs;
|
struct amdgpu_ib *ibs;
|
||||||
uint32_t num_ibs;
|
uint32_t num_ibs;
|
||||||
struct mutex job_lock;
|
struct mutex job_lock;
|
||||||
|
|
|
@ -847,7 +847,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||||
job->adev = parser->adev;
|
job->adev = parser->adev;
|
||||||
job->ibs = parser->ibs;
|
job->ibs = parser->ibs;
|
||||||
job->num_ibs = parser->num_ibs;
|
job->num_ibs = parser->num_ibs;
|
||||||
job->owner = parser->filp;
|
job->base.owner = parser->filp;
|
||||||
mutex_init(&job->job_lock);
|
mutex_init(&job->job_lock);
|
||||||
if (job->ibs[job->num_ibs - 1].user) {
|
if (job->ibs[job->num_ibs - 1].user) {
|
||||||
memcpy(&job->uf, &parser->uf,
|
memcpy(&job->uf, &parser->uf,
|
||||||
|
|
|
@ -44,7 +44,7 @@ static struct fence *amdgpu_sched_run_job(struct amd_gpu_scheduler *sched,
|
||||||
r = amdgpu_ib_schedule(sched_job->adev,
|
r = amdgpu_ib_schedule(sched_job->adev,
|
||||||
sched_job->num_ibs,
|
sched_job->num_ibs,
|
||||||
sched_job->ibs,
|
sched_job->ibs,
|
||||||
sched_job->owner);
|
sched_job->base.owner);
|
||||||
if (r)
|
if (r)
|
||||||
goto err;
|
goto err;
|
||||||
fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence);
|
fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence);
|
||||||
|
@ -101,7 +101,7 @@ int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev,
|
||||||
job->adev = adev;
|
job->adev = adev;
|
||||||
job->ibs = ibs;
|
job->ibs = ibs;
|
||||||
job->num_ibs = num_ibs;
|
job->num_ibs = num_ibs;
|
||||||
job->owner = owner;
|
job->base.owner = owner;
|
||||||
mutex_init(&job->job_lock);
|
mutex_init(&job->job_lock);
|
||||||
job->free_job = free_job;
|
job->free_job = free_job;
|
||||||
mutex_lock(&job->job_lock);
|
mutex_lock(&job->job_lock);
|
||||||
|
|
|
@ -232,7 +232,8 @@ static bool amd_sched_entity_in(struct amd_sched_job *job)
|
||||||
int amd_sched_entity_push_job(struct amd_sched_job *sched_job)
|
int amd_sched_entity_push_job(struct amd_sched_job *sched_job)
|
||||||
{
|
{
|
||||||
struct amd_sched_entity *entity = sched_job->s_entity;
|
struct amd_sched_entity *entity = sched_job->s_entity;
|
||||||
struct amd_sched_fence *fence = amd_sched_fence_create(entity);
|
struct amd_sched_fence *fence = amd_sched_fence_create(
|
||||||
|
entity, sched_job->owner);
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!fence)
|
if (!fence)
|
||||||
|
|
|
@ -65,6 +65,7 @@ struct amd_sched_fence {
|
||||||
struct fence base;
|
struct fence base;
|
||||||
struct amd_gpu_scheduler *scheduler;
|
struct amd_gpu_scheduler *scheduler;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
void *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct amd_sched_job {
|
struct amd_sched_job {
|
||||||
|
@ -72,6 +73,7 @@ struct amd_sched_job {
|
||||||
struct amd_gpu_scheduler *sched;
|
struct amd_gpu_scheduler *sched;
|
||||||
struct amd_sched_entity *s_entity;
|
struct amd_sched_entity *s_entity;
|
||||||
struct amd_sched_fence *s_fence;
|
struct amd_sched_fence *s_fence;
|
||||||
|
void *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct fence_ops amd_sched_fence_ops;
|
extern const struct fence_ops amd_sched_fence_ops;
|
||||||
|
@ -126,7 +128,7 @@ int amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
|
||||||
int amd_sched_entity_push_job(struct amd_sched_job *sched_job);
|
int amd_sched_entity_push_job(struct amd_sched_job *sched_job);
|
||||||
|
|
||||||
struct amd_sched_fence *amd_sched_fence_create(
|
struct amd_sched_fence *amd_sched_fence_create(
|
||||||
struct amd_sched_entity *s_entity);
|
struct amd_sched_entity *s_entity, void *owner);
|
||||||
void amd_sched_fence_signal(struct amd_sched_fence *fence);
|
void amd_sched_fence_signal(struct amd_sched_fence *fence);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
#include "gpu_scheduler.h"
|
#include "gpu_scheduler.h"
|
||||||
|
|
||||||
struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity)
|
struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity, void *owner)
|
||||||
{
|
{
|
||||||
struct amd_sched_fence *fence = NULL;
|
struct amd_sched_fence *fence = NULL;
|
||||||
unsigned seq;
|
unsigned seq;
|
||||||
|
@ -35,7 +35,7 @@ struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity
|
||||||
fence = kzalloc(sizeof(struct amd_sched_fence), GFP_KERNEL);
|
fence = kzalloc(sizeof(struct amd_sched_fence), GFP_KERNEL);
|
||||||
if (fence == NULL)
|
if (fence == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
fence->owner = owner;
|
||||||
fence->scheduler = s_entity->scheduler;
|
fence->scheduler = s_entity->scheduler;
|
||||||
spin_lock_init(&fence->lock);
|
spin_lock_init(&fence->lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue