[PATCH 6/9] drm/amd: Set the PASID for KFD VMs
Felix Kuehling
Felix.Kuehling at amd.com
Sat Aug 26 07:19:06 UTC 2017
Change-Id: I5d949d61fa9d828b453187698c250633188386e0
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 ++-
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ++++--
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 2 +-
drivers/gpu/drm/radeon/radeon_kfd.c | 6 ++++--
5 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
index d9e3734..8bd34da 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
@@ -202,7 +202,8 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
struct kgd_dev *kgd, struct kgd_mem *mem, void *vm);
int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
- void **process_info);
+ void **process_info,
+ unsigned int pasid);
void amdgpu_amdkfd_gpuvm_destroy_process_vm(struct kgd_dev *kgd, void *vm);
uint32_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *vm);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 462011c..902c05d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1385,7 +1385,8 @@ static u64 get_vm_pd_gpu_offset(void *vm)
}
int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
- void **process_info)
+ void **process_info,
+ unsigned int pasid)
{
int ret;
struct amdkfd_vm *new_vm;
@@ -1397,7 +1398,8 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, void **vm,
return -ENOMEM;
/* Initialize the VM context, allocate the page directory and zero it */
- ret = amdgpu_vm_init(adev, &new_vm->base, AMDGPU_VM_CONTEXT_COMPUTE, 0);
+ ret = amdgpu_vm_init(adev, &new_vm->base, AMDGPU_VM_CONTEXT_COMPUTE,
+ pasid);
if (ret != 0) {
pr_err("Failed init vm ret %d\n", ret);
/* Undo everything related to the new VM context */
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index a20ced0..3b11e35 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -702,7 +702,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev,
/* Create the GPUVM context for this specific device */
if (dev->kfd2kgd->create_process_vm(dev->kgd, &pdd->vm,
- &p->process_info)) {
+ &p->process_info, p->pasid)) {
pr_err("Failed to create process VM object\n");
goto err_create_pdd;
}
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 5833ef7..f0c6e11 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -271,7 +271,7 @@ struct kfd2kgd_calls {
void (*free_pasid)(unsigned int pasid);
int (*create_process_vm)(struct kgd_dev *kgd, void **vm,
- void **process_info);
+ void **process_info, unsigned int pasid);
void (*destroy_process_vm)(struct kgd_dev *kgd, void *vm);
int (*create_process_gpumem)(struct kgd_dev *kgd, uint64_t va, size_t size, void *vm, struct kgd_mem **mem);
diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c
index acfe34e..9daf661 100644
--- a/drivers/gpu/drm/radeon/radeon_kfd.c
+++ b/drivers/gpu/drm/radeon/radeon_kfd.c
@@ -82,7 +82,8 @@ static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd);
static int alloc_pasid(unsigned int bits);
static void free_pasid(unsigned int pasid);
-static int create_process_vm(struct kgd_dev *kgd, void **vm, void **info);
+static int create_process_vm(struct kgd_dev *kgd, void **vm, void **info,
+ unsigned int pasid);
static void destroy_process_vm(struct kgd_dev *kgd, void *vm);
static uint32_t get_process_page_dir(void *vm);
@@ -447,7 +448,8 @@ void free_pasid(unsigned int pasid)
/*
* Creates a VM context for HSA process
*/
-static int create_process_vm(struct kgd_dev *kgd, void **vm, void **info)
+static int create_process_vm(struct kgd_dev *kgd, void **vm, void **info,
+ unsigned int pasid)
{
int ret;
struct radeon_vm *new_vm;
--
2.7.4
More information about the amd-gfx
mailing list