Expose a small helper which injects a prepared WAIT_EVENT record into a
per-file wait-event manager.

The debugger routing layer uses this helper when the debugger forwards an
intercepted event back to the application. Keeping this helper separate makes
the later debug-event core build cleanly.

Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c
index 8ecc4e40a95c..4ae72acb9778 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c
@@ -29,6 +29,9 @@
 #include "amdgpu.h"
 #include "amdgpu_wait_event.h"
 
+#include "amdgpu.h"
+#include "amdgpu_wait_event.h"
+
 int amdgpu_userq_wait_event_check_queue_reset(struct drm_file *file_priv,
                                              u32 queue_id);
 
@@ -179,6 +182,18 @@ static int amdgpu_wait_event_push_common(struct 
amdgpu_wait_event_mgr *mgr,
        return 0;
 }
 
+int amdgpu_wait_event_push_data(struct amdgpu_wait_event_mgr *mgr,
+                               const struct drm_amdgpu_wait_event_data *data)
+{
+       struct drm_amdgpu_wait_event_data tmp;
+
+       if (!mgr || !data)
+               return -EINVAL;
+
+       tmp = *data;
+       return amdgpu_wait_event_push_common(mgr, &tmp);
+}
+
 void amdgpu_wait_event_mgr_init(struct amdgpu_wait_event_mgr *mgr)
 {
        spin_lock_init(&mgr->lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h
index 3cccc652360f..0bde6861522c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h
@@ -58,6 +58,9 @@ struct amdgpu_wait_event_mgr {
 void amdgpu_wait_event_mgr_init(struct amdgpu_wait_event_mgr *mgr);
 void amdgpu_wait_event_mgr_fini(struct amdgpu_wait_event_mgr *mgr);
 
+int amdgpu_wait_event_push_data(struct amdgpu_wait_event_mgr *mgr,
+                               const struct drm_amdgpu_wait_event_data *data);
+
 int amdgpu_wait_event_drm_ioctl(struct drm_device *dev, void *data,
                                struct drm_file *file_priv);
 
-- 
2.34.1

Reply via email to