drm/amdkfd: New IOCTL to allocate queue GWS
Add a new kfd ioctl to allocate queue GWS. Queue GWS is released on queue destroy. Signed-off-by: Oak Zeng <Oak.Zeng@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
eb82da1dc4
commit
1a058c3376
2 changed files with 46 additions and 1 deletions
|
@ -1567,6 +1567,31 @@ copy_from_user_failed:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int kfd_ioctl_alloc_queue_gws(struct file *filep,
|
||||||
|
struct kfd_process *p, void *data)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
struct kfd_ioctl_alloc_queue_gws_args *args = data;
|
||||||
|
struct kfd_dev *dev = NULL;
|
||||||
|
|
||||||
|
if (!hws_gws_support ||
|
||||||
|
dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
dev = kfd_device_by_id(args->gpu_id);
|
||||||
|
if (!dev) {
|
||||||
|
pr_debug("Could not find gpu id 0x%x\n", args->gpu_id);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_lock(&p->mutex);
|
||||||
|
retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL);
|
||||||
|
mutex_unlock(&p->mutex);
|
||||||
|
|
||||||
|
args->first_gws = 0;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static int kfd_ioctl_get_dmabuf_info(struct file *filep,
|
static int kfd_ioctl_get_dmabuf_info(struct file *filep,
|
||||||
struct kfd_process *p, void *data)
|
struct kfd_process *p, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1769,6 +1794,8 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {
|
||||||
AMDKFD_IOCTL_DEF(AMDKFD_IOC_IMPORT_DMABUF,
|
AMDKFD_IOCTL_DEF(AMDKFD_IOC_IMPORT_DMABUF,
|
||||||
kfd_ioctl_import_dmabuf, 0),
|
kfd_ioctl_import_dmabuf, 0),
|
||||||
|
|
||||||
|
AMDKFD_IOCTL_DEF(AMDKFD_IOC_ALLOC_QUEUE_GWS,
|
||||||
|
kfd_ioctl_alloc_queue_gws, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls)
|
#define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls)
|
||||||
|
|
|
@ -410,6 +410,21 @@ struct kfd_ioctl_unmap_memory_from_gpu_args {
|
||||||
__u32 n_success; /* to/from KFD */
|
__u32 n_success; /* to/from KFD */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Allocate GWS for specific queue
|
||||||
|
*
|
||||||
|
* @gpu_id: device identifier
|
||||||
|
* @queue_id: queue's id that GWS is allocated for
|
||||||
|
* @num_gws: how many GWS to allocate
|
||||||
|
* @first_gws: index of the first GWS allocated.
|
||||||
|
* only support contiguous GWS allocation
|
||||||
|
*/
|
||||||
|
struct kfd_ioctl_alloc_queue_gws_args {
|
||||||
|
__u32 gpu_id; /* to KFD */
|
||||||
|
__u32 queue_id; /* to KFD */
|
||||||
|
__u32 num_gws; /* to KFD */
|
||||||
|
__u32 first_gws; /* from KFD */
|
||||||
|
};
|
||||||
|
|
||||||
struct kfd_ioctl_get_dmabuf_info_args {
|
struct kfd_ioctl_get_dmabuf_info_args {
|
||||||
__u64 size; /* from KFD */
|
__u64 size; /* from KFD */
|
||||||
__u64 metadata_ptr; /* to KFD */
|
__u64 metadata_ptr; /* to KFD */
|
||||||
|
@ -529,7 +544,10 @@ enum kfd_mmio_remap {
|
||||||
#define AMDKFD_IOC_IMPORT_DMABUF \
|
#define AMDKFD_IOC_IMPORT_DMABUF \
|
||||||
AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args)
|
AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args)
|
||||||
|
|
||||||
|
#define AMDKFD_IOC_ALLOC_QUEUE_GWS \
|
||||||
|
AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args)
|
||||||
|
|
||||||
#define AMDKFD_COMMAND_START 0x01
|
#define AMDKFD_COMMAND_START 0x01
|
||||||
#define AMDKFD_COMMAND_END 0x1E
|
#define AMDKFD_COMMAND_END 0x1F
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue