Skip to content

Commit 7386f88

Browse files
jokim-amdalexdeucher
authored andcommitted
drm/amdkfd: fix vmfault signalling with additional data.
Exception handling for vmfaults should be raised with additional data. Reported-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0bc3137 commit 7386f88

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_events.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,19 +1240,24 @@ void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
12401240
return;
12411241
}
12421242

1243-
memset(&memory_exception_data, 0, sizeof(memory_exception_data));
1244-
memory_exception_data.gpu_id = user_gpu_id;
1245-
memory_exception_data.failure.imprecise = true;
1246-
/* Set failure reason */
1247-
if (info) {
1248-
memory_exception_data.va = (info->page_addr) << PAGE_SHIFT;
1249-
memory_exception_data.failure.NotPresent =
1250-
info->prot_valid ? 1 : 0;
1251-
memory_exception_data.failure.NoExecute =
1252-
info->prot_exec ? 1 : 0;
1253-
memory_exception_data.failure.ReadOnly =
1254-
info->prot_write ? 1 : 0;
1255-
memory_exception_data.failure.imprecise = 0;
1243+
/* SoC15 chips and onwards will pass in data from now on. */
1244+
if (!data) {
1245+
memset(&memory_exception_data, 0, sizeof(memory_exception_data));
1246+
memory_exception_data.gpu_id = user_gpu_id;
1247+
memory_exception_data.failure.imprecise = true;
1248+
1249+
/* Set failure reason */
1250+
if (info) {
1251+
memory_exception_data.va = (info->page_addr) <<
1252+
PAGE_SHIFT;
1253+
memory_exception_data.failure.NotPresent =
1254+
info->prot_valid ? 1 : 0;
1255+
memory_exception_data.failure.NoExecute =
1256+
info->prot_exec ? 1 : 0;
1257+
memory_exception_data.failure.ReadOnly =
1258+
info->prot_write ? 1 : 0;
1259+
memory_exception_data.failure.imprecise = 0;
1260+
}
12561261
}
12571262

12581263
rcu_read_lock();
@@ -1261,7 +1266,8 @@ void kfd_signal_vm_fault_event(struct kfd_node *dev, u32 pasid,
12611266
idr_for_each_entry_continue(&p->event_idr, ev, id)
12621267
if (ev->type == KFD_EVENT_TYPE_MEMORY) {
12631268
spin_lock(&ev->lock);
1264-
ev->memory_exception_data = memory_exception_data;
1269+
ev->memory_exception_data = data ? *data :
1270+
memory_exception_data;
12651271
set_event(ev);
12661272
spin_unlock(&ev->lock);
12671273
}

0 commit comments

Comments
 (0)