summaryrefslogtreecommitdiff
path: root/drivers/edgetpu/mobile-debug-dump.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edgetpu/mobile-debug-dump.h')
-rw-r--r--drivers/edgetpu/mobile-debug-dump.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/edgetpu/mobile-debug-dump.h b/drivers/edgetpu/mobile-debug-dump.h
new file mode 100644
index 0000000..105bd70
--- /dev/null
+++ b/drivers/edgetpu/mobile-debug-dump.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Module that defines structure to retrieve debug dump segments
+ * specific to the family of EdgeTPUs for mobile devices.
+ *
+ * Copyright (C) 2021 Google, Inc.
+ */
+#ifndef __MOBILE_DEBUG_DUMP_H__
+#define __MOBILE_DEBUG_DUMP_H__
+
+#include <linux/platform_data/sscoredump.h>
+
+#include "edgetpu-debug-dump.h"
+
+struct mobile_sscd_info {
+ void *pdata; /* SSCD platform data */
+ void *dev; /* SSCD platform device */
+};
+
+struct mobile_sscd_mappings_dump {
+ u64 host_address;
+ u64 device_address;
+ u64 alloc_iova;
+ u64 size;
+};
+
+/*
+ * Collects the mapping information of all the host mapping and dmabuf mapping buffers of all
+ * @groups as an array of struct mobile_sscd_mappings_dump and populates the @sscd_seg.
+ *
+ * Returns the pointer to the first element of the mappings dump array. The allocated array should
+ * be freed by the caller after the sscd segment is reported.
+ * Returns NULL in case of failure.
+ */
+struct mobile_sscd_mappings_dump *
+mobile_sscd_collect_mappings_segment(struct edgetpu_device_group **groups, size_t num_groups,
+ struct sscd_segment *sscd_seg);
+
+/*
+ * Collects the VII cmd and resp queues of all @groups that @etdev belongs to and the KCI cmd and
+ * resp queues and populates them as @sscd_seg_arr elements.
+ *
+ * Returns the total number of queues collected since some queues may have been released for groups
+ * with detached mailboxes. The return value is less than or equal to the total number of queues
+ * expected based on @num_groups i.e (2 * @num_groups +2).
+ */
+size_t mobile_sscd_collect_cmd_resp_queues(struct edgetpu_dev *etdev,
+ struct edgetpu_device_group **groups, size_t num_groups,
+ struct sscd_segment *sscd_seg_arr);
+
+#endif /* MOBILE_DEBUG_DUMP_H_ */