Add core documentation for connection setup and events.
Follow-up patches can then incrementally add their workings.

Signed-off-by: Mika Kuoppala <[email protected]>
---
 Documentation/gpu/xe/index.rst      |  1 +
 Documentation/gpu/xe/xe_eudebug.rst | 56 +++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_eudebug.c     | 19 ++++++++++
 3 files changed, 76 insertions(+)
 create mode 100644 Documentation/gpu/xe/xe_eudebug.rst

diff --git a/Documentation/gpu/xe/index.rst b/Documentation/gpu/xe/index.rst
index 0247a255f7e6..8d4abdfe71a7 100644
--- a/Documentation/gpu/xe/index.rst
+++ b/Documentation/gpu/xe/index.rst
@@ -36,3 +36,4 @@ The display, or :ref:`drm-kms`, support for drm/xe is 
provided by
    xe_configfs
    xe_gt_stats
    xe_sigid
+   xe_eudebug
diff --git a/Documentation/gpu/xe/xe_eudebug.rst 
b/Documentation/gpu/xe/xe_eudebug.rst
new file mode 100644
index 000000000000..a73f8bd9a8e9
--- /dev/null
+++ b/Documentation/gpu/xe/xe_eudebug.rst
@@ -0,0 +1,56 @@
+.. SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+===================================
+Xe EU Debug (eudebug)
+===================================
+
+.. The uapi header is also included in full by driver-uapi.rst, so keep
+   the structs pulled in here out of the global C namespace to avoid
+   duplicate declaration warnings.
+
+.. c:namespace:: xe_eudebug
+
+Overview
+========
+
+The EU Debug (eudebug) subsystem provides an interface for debugging
+Execution Unit (EU) workloads on Intel Xe GPUs, independently from
+CPU process debugging. This enables tools like GDB (via gdbserver-intelgt)
+to debug GPU compute workloads through the Level-Zero Debug API.
+In practice, this allows SYCL/DPC++ workloads submitted by the
+compute-runtime to be debugged interactively.
+
+
+Connection Establishment
+========================
+
+.. kernel-doc:: drivers/gpu/drm/xe/xe_eudebug.c
+   :doc: Connection Establishment
+
+Events
+======
+
+.. kernel-doc:: drivers/gpu/drm/xe/xe_eudebug.c
+   :doc: Events
+
+Reading Events
+--------------
+
+.. kernel-doc:: include/uapi/drm/xe_drm_eudebug.h
+   :doc: DRM_XE_EUDEBUG_IOCTL_READ_EVENT
+
+Base Event Header
+-----------------
+
+The debugger receives events with the DRM_XE_EUDEBUG_IOCTL_READ_EVENT
+ioctl on the eudebug file descriptor. Every event has
+:c:type:`drm_xe_eudebug_event` as a header.
+
+.. kernel-doc:: include/uapi/drm/xe_drm_eudebug.h
+   :identifiers: drm_xe_eudebug_event
+
+Resource Event Types
+--------------------
+
+.. kernel-doc:: include/uapi/drm/xe_drm_eudebug.h
+   :identifiers: drm_xe_eudebug_event_vm
diff --git a/drivers/gpu/drm/xe/xe_eudebug.c b/drivers/gpu/drm/xe/xe_eudebug.c
index 0a57d99fc5e8..61572c006d22 100644
--- a/drivers/gpu/drm/xe/xe_eudebug.c
+++ b/drivers/gpu/drm/xe/xe_eudebug.c
@@ -19,6 +19,25 @@
 #include "xe_macros.h"
 #include "xe_vm.h"
 
+/**
+ * DOC: Connection Establishment
+ *
+ * To debug a target DRM client, the debugger must first establish
+ * a connection using :c:type:`drm_xe_eudebug_connect`.
+ *
+ */
+
+/**
+ * DOC: Events
+ *
+ * Resource creation/destruction and hardware state changes are
+ * delivered as events to the debugger.
+ *
+ * To read an event, ioctl DRM_XE_EUDEBUG_IOCTL_READ_EVENT command
+ * can be issued with prefilled :c:type:`drm_xe_eudebug_event` as argument.
+ *
+ */
+
 #define cast_event(T, event) container_of((event), typeof(*(T)), base)
 
 static const struct rhashtable_params rhash_res = {
-- 
2.53.0

Reply via email to