Commit e2a8e999 authored by Yong Zhao's avatar Yong Zhao Committed by Oded Gabbay

drm/amdkfd: Avoid calling amd_iommu_unbind_pasid() when suspending

When kfd suspending on APU, we do not need to call
amd_iommu_unbind_pasid(), because pasid will be unbound automatically
when power goes off.

On the other hand, calling amd_iommu_unbind_pasid() will trigger
kfd_process_iommu_unbind_callback() if the process is not terminating.
By design, kfd_process_iommu_unbind_callback() should only be called
for process terminating. So we would rather not to call
amd_iommu_unbind_pasid() when suspending.
Signed-off-by: default avatarYong Zhao <yong.zhao@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent bba9662d
...@@ -423,29 +423,25 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev) ...@@ -423,29 +423,25 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev)
} }
/* /*
* Temporarily unbind currently bound processes from the device and * Mark currently bound processes as PDD_BOUND_SUSPENDED. These
* mark them as PDD_BOUND_SUSPENDED. These processes will be restored * processes will be restored to PDD_BOUND state in
* to PDD_BOUND state in kfd_bind_processes_to_device. * kfd_bind_processes_to_device.
*/ */
void kfd_unbind_processes_from_device(struct kfd_dev *dev) void kfd_unbind_processes_from_device(struct kfd_dev *dev)
{ {
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
struct kfd_process *p; struct kfd_process *p;
unsigned int temp, temp_bound, temp_pasid; unsigned int temp;
int idx = srcu_read_lock(&kfd_processes_srcu); int idx = srcu_read_lock(&kfd_processes_srcu);
hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
mutex_lock(&p->mutex); mutex_lock(&p->mutex);
pdd = kfd_get_process_device_data(dev, p); pdd = kfd_get_process_device_data(dev, p);
temp_bound = pdd->bound;
temp_pasid = p->pasid;
if (pdd->bound == PDD_BOUND) if (pdd->bound == PDD_BOUND)
pdd->bound = PDD_BOUND_SUSPENDED; pdd->bound = PDD_BOUND_SUSPENDED;
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
if (temp_bound == PDD_BOUND)
amd_iommu_unbind_pasid(dev->pdev, temp_pasid);
} }
srcu_read_unlock(&kfd_processes_srcu, idx); srcu_read_unlock(&kfd_processes_srcu, idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment