]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdkfd: Optimize out some duplicated code in kfd_signal_iommu_event()
authorYong Zhao <yong.zhao@amd.com>
Fri, 13 Jul 2018 20:17:47 +0000 (16:17 -0400)
committerOded Gabbay <oded.gabbay@gmail.com>
Fri, 13 Jul 2018 20:17:47 +0000 (16:17 -0400)
memory_exception_data is already initialized for not-present faults.
It only needs to be overridden for permission faults.

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_events.c

index 4dcacce2db86989a92d91bf1a93951215eb4aefe..e9f0e0a1b41c074204a69a7745e29bc8e53668ba 100644 (file)
@@ -911,22 +911,18 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid,
        memory_exception_data.failure.NotPresent = 1;
        memory_exception_data.failure.NoExecute = 0;
        memory_exception_data.failure.ReadOnly = 0;
-       if (vma) {
-               if (vma->vm_start > address) {
-                       memory_exception_data.failure.NotPresent = 1;
-                       memory_exception_data.failure.NoExecute = 0;
+       if (vma && address >= vma->vm_start) {
+               memory_exception_data.failure.NotPresent = 0;
+
+               if (is_write_requested && !(vma->vm_flags & VM_WRITE))
+                       memory_exception_data.failure.ReadOnly = 1;
+               else
                        memory_exception_data.failure.ReadOnly = 0;
-               } else {
-                       memory_exception_data.failure.NotPresent = 0;
-                       if (is_write_requested && !(vma->vm_flags & VM_WRITE))
-                               memory_exception_data.failure.ReadOnly = 1;
-                       else
-                               memory_exception_data.failure.ReadOnly = 0;
-                       if (is_execute_requested && !(vma->vm_flags & VM_EXEC))
-                               memory_exception_data.failure.NoExecute = 1;
-                       else
-                               memory_exception_data.failure.NoExecute = 0;
-               }
+
+               if (is_execute_requested && !(vma->vm_flags & VM_EXEC))
+                       memory_exception_data.failure.NoExecute = 1;
+               else
+                       memory_exception_data.failure.NoExecute = 0;
        }
 
        up_read(&mm->mmap_sem);