Commit 7386f88a authored by Jonathan Kim's avatar Jonathan Kim Committed by Alex Deucher
Browse files

drm/amdkfd: fix vmfault signalling with additional data.



Exception handling for vmfaults should be raised with additional data.

Reported-by: default avatarMukul Joshi <mukul.joshi@amd.com>
Signed-off-by: default avatarJonathan Kim <jonathan.kim@amd.com>
Reviewed-by: default avatarMukul Joshi <mukul.joshi@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0bc3137b
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -1240,12 +1240,16 @@ void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
		return;
	}

	/* SoC15 chips and onwards will pass in data from now on. */
	if (!data) {
		memset(&memory_exception_data, 0, sizeof(memory_exception_data));
		memory_exception_data.gpu_id = user_gpu_id;
		memory_exception_data.failure.imprecise = true;

		/* Set failure reason */
		if (info) {
		memory_exception_data.va = (info->page_addr) << PAGE_SHIFT;
			memory_exception_data.va = (info->page_addr) <<
								PAGE_SHIFT;
			memory_exception_data.failure.NotPresent =
				info->prot_valid ? 1 : 0;
			memory_exception_data.failure.NoExecute =
@@ -1254,6 +1258,7 @@ void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
				info->prot_write ? 1 : 0;
			memory_exception_data.failure.imprecise = 0;
		}
	}

	rcu_read_lock();

@@ -1261,7 +1266,8 @@ void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
	idr_for_each_entry_continue(&p->event_idr, ev, id)
		if (ev->type == KFD_EVENT_TYPE_MEMORY) {
			spin_lock(&ev->lock);
			ev->memory_exception_data = memory_exception_data;
			ev->memory_exception_data = data ? *data :
							memory_exception_data;
			set_event(ev);
			spin_unlock(&ev->lock);
		}