History

accel/amdxdna: Add command doorbell and wait support

Expose the command doorbell register to userspace on a per-hardware context basis, enabling applications to notify the firmware of pending commands via doorbell writes. Introduce DRM_IOCTL_AMDXDNA_WAIT_CMD to allow userspace to wait for completion of individual commands.

David Zhang committed 6 months ago

Commit 91f4da81 parent 193612711 files · +198 −7Browse files

Showing the changes to include/uapi (1 of 11 files). Show all

Unified · Split

include/uapi/drm/amdxdna_accel.h+21−1
@@ -45,7 +45,8 @@ enum amdxdna_drm_ioctl_id { · 44 unmodified lines
4545 DRM_AMDXDNA_EXEC_CMD,
4646 DRM_AMDXDNA_GET_INFO,
4747 DRM_AMDXDNA_SET_STATE,
48− DRM_AMDXDNA_GET_ARRAY = 10,
48+ DRM_AMDXDNA_WAIT_CMD,
49+ DRM_AMDXDNA_GET_ARRAY,
4950 };
5051
5152 /**
@@ -274,6 +275,21 @@ struct amdxdna_drm_exec_cmd { · 222 unmodified lines
274275 __u64 seq;
275276 };
276277
278+/**
279+ * struct amdxdna_drm_wait_cmd - Wait execution command.
280+ *
281+ * @hwctx: Context handle.
282+ * @timeout: timeout in ms, 0 implies infinite wait.
283+ * @seq: sequence number of the command returned by execute command.
284+ *
285+ * Wait a command specified by seq to be completed.
286+ */
287+struct amdxdna_drm_wait_cmd {
288+ __u32 hwctx;
289+ __u32 timeout;
290+ __u64 seq;
291+};
292+
277293 /**
278294 * struct amdxdna_drm_query_aie_status - Query the status of the AIE hardware
279295 * @buffer: The user space buffer that will return the AIE status.
@@ -739,6 +755,10 @@ struct amdxdna_drm_set_power_mode { · 459 unmodified lines
739755 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_GET_ARRAY, \
740756 struct amdxdna_drm_get_array)
741757
758+#define DRM_IOCTL_AMDXDNA_WAIT_CMD \
759+ DRM_IOW(DRM_COMMAND_BASE + DRM_AMDXDNA_WAIT_CMD, \
760+ struct amdxdna_drm_wait_cmd)
761+
742762 #if defined(__cplusplus)
743763 } /* extern c end */
744764 #endif