Queue memory exception records into the WAIT_EVENT path from the
KGD-side VM fault interrupt handler.

Reuse the existing VM fault interrupt handler which already decodes
fault address and status, avoiding any additional fault decoding or
KFD-side dependencies.

Emit events as GPU-scoped (queue_id = 0) since queue association is not
always available at this stage.

This does not change WAIT_EVENT UAPI semantics.

Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
index 337f3cb9e5ef..4136f2a8e31c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
@@ -26,6 +26,7 @@
 #include <drm/drm_cache.h>
 
 #include "amdgpu.h"
+#include "amdgpu_wait_event.h"
 #include "amdgpu_atomfirmware.h"
 #include "gmc_v11_0.h"
 #include "umc_v8_10.h"
@@ -142,10 +143,16 @@ static int gmc_v11_0_process_interrupt(struct 
amdgpu_device *adev,
                        list_for_each_entry(file, &adev_to_drm(adev)->filelist, 
lhead) {
                                struct amdgpu_fpriv *fpriv = file->driver_priv;
 
-                               if (fpriv)
-                                       
amdgpu_eventfd_signal(&fpriv->eventfd_mgr,
-                                                             
DRM_AMDGPU_EVENT_TYPE_MEMORY_EXCEPTION,
-                                                             0);
+                               if (!fpriv)
+                                       continue;
+
+                               amdgpu_eventfd_signal(&fpriv->eventfd_mgr,
+                                                     
DRM_AMDGPU_EVENT_TYPE_MEMORY_EXCEPTION,
+                                                     0);
+
+                               amdgpu_wait_event_push_memory_exception(
+                                       &fpriv->wait_event_mgr,
+                                       0, status, addr, 0);
                        }
                }
        }
-- 
2.34.1

Reply via email to