summaryrefslogtreecommitdiff
path: root/gxp-notification.h
diff options
context:
space:
mode:
authorNeela Chithirala <chithiralan@google.com>2022-01-17 04:41:54 +0000
committerNeela Chithirala <chithiralan@google.com>2022-02-03 06:27:20 +0000
commit3ccb2479717de3089dbbcb894ddd045b2ddc256c (patch)
treea577f284ff42d11b1fcfb7c338a7f0b59b10672a /gxp-notification.h
parente14069f1739b05c7a7f60ae73c8ce14b91ef12e0 (diff)
downloadgs201-3ccb2479717de3089dbbcb894ddd045b2ddc256c.tar.gz
Merge branch 'gs201-release' to android13-gs-pixel-5.10
* gs201-release: gxp: Fix multicore VDs not shutting down clean Bug: 215303765 gxp: Rework VD locking and remove mailbox locking Bug: 189018271 gxp: initial commit for thermal driver Bug: 177217526 gxp: Add wakelock interface and make debugfs wakelock aware Bug: 215192870 gxp: Hook-up pm ops for driver suspend/resume Bug: 204924965 gxp: Dynamically power BLK_AUR on and off Bug: 204924965 gxp: support GXP_PLATFORM=GEM5 Bug: 204942713 gxp: Remove delay waiting for FW mailbox init Bug: 207037428 gxp: Fix infrequent crash during mailbox release gxp: Release FW file on firmware loading errors gxp: return GXP_RESP_CANCELLED if timeout occurs Bug: 207432733 gxp: Remove initial 10ms delay when disabling telemetry gxp: Cast telemetry buffer IOVAs to u32s before use gxp: check sscoredump by CONFIG_SUBSYSTEM_COREDUMP gxp: Fix double-lock hang in gxp_telemetry_vma_close gxp: Log driver git commit hash on probe Bug: 206744969 gxp: Add ioctl for reading the TOP global counter gxp: Implement eventfd signalling for telemetry gxp: Notify running cores of telemetry state changes gxp: Add notification interface Signed-off-by: Neela Chithirala <chithiralan@google.com> Change-Id: Ic7cd7b81ee643371c600ac208ae33d6344ed7f1b
Diffstat (limited to 'gxp-notification.h')
-rw-r--r--gxp-notification.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/gxp-notification.h b/gxp-notification.h
new file mode 100644
index 0000000..1c18a30
--- /dev/null
+++ b/gxp-notification.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * GXP notification interface.
+ *
+ * Copyright (C) 2021 Google LLC
+ */
+#ifndef __GXP_NOTIFICATION_H__
+#define __GXP_NOTIFICATION_H__
+
+#include <linux/workqueue.h>
+
+#include "gxp-internal.h"
+
+enum gxp_notification_to_host_type {
+ HOST_NOTIF_MAILBOX_RESPONSE = 0,
+ HOST_NOTIF_DEBUG_DUMP_READY = 1,
+ HOST_NOTIF_TELEMETRY_STATUS = 2,
+ HOST_NOTIF_MAX
+};
+
+enum gxp_notification_to_core_type {
+ CORE_NOTIF_MAILBOX_COMMAND = 0,
+ CORE_NOTIF_GENERATE_DEBUG_DUMP = 1,
+ CORE_NOTIF_TELEMETRY_STATUS = 2,
+ CORE_NOTIF_MAX
+};
+
+/**
+ * gxp_notification_register_handler() - Register a work_struct to be called
+ * when the specified @core sends a
+ * notification of the specified @type.
+ * @gxp: The GXP device to register the handler for
+ * @core: The core inside the GXP device to receive notifications from
+ * @type: The `gxp_notification_to_host_type` of notification to handle
+ * @handler: A callback to be invoked via `schedule_work()` when a notification
+ * of @type arrives.
+ *
+ * This function requires the specified @core has its firmware loaded and
+ * initialized before this function is called.
+ *
+ * If the callback requires additional context, such as the core number or a
+ * pointer to @gxp, the caller should allocate @handler as part of wrapper
+ * struct containing any context, then obtain that wrapping struct with
+ * `container_of()` inside the handler's callback.
+ *
+ * Return:
+ * * 0 - Success
+ * * -EINVAL - The specified @core or @type is not valid
+ * * -ENODEV - The specified @core is not running firmware
+ */
+int gxp_notification_register_handler(struct gxp_dev *gxp, uint core,
+ enum gxp_notification_to_host_type type,
+ struct work_struct *handler);
+
+/**
+ * gxp_notification_unregister_handler() - Unregister the work for handling
+ * notifications of type @type from core
+ * @core.
+ * @gxp: The GXP device to unregister the handler for
+ * @core: The core inside the GXP device to remove the notifications handler for
+ * @type: The `gxp_notification_to_host_type` of notification to unregister
+ *
+ * This function requires the specified @core has its firmware loaded and
+ * initialized before this function is called.
+ *
+ * Return:
+ * * 0 - Success
+ * * -EINVAL - The specified @core or @type is not valid
+ * * -ENODEV - The specified @core is not running firmware
+ */
+int gxp_notification_unregister_handler(
+ struct gxp_dev *gxp, uint core,
+ enum gxp_notification_to_host_type type);
+
+/**
+ * gxp_notification_send() - Send a notification of @type to @core.
+ * @gxp: The GXP device to send a notification to
+ * @core: The core inside the GXP device to route the notification to
+ * @type:The `gxp_notification_to_core_type` of notification to send
+ *
+ * This function requires the specified @core has its firmware loaded and
+ * initialized before this function is called.
+ *
+ * The caller must also hold gxp->vd_semaphore for reading, to ensure firmware
+ * continues running until this call completes.
+ *
+ * Return:
+ * * 0 - Success
+ * * -EINVAL - The specified @core or @type is not valid
+ * * -ENODEV - The specified @core is not running firmware
+ */
+int gxp_notification_send(struct gxp_dev *gxp, uint core,
+ enum gxp_notification_to_core_type type);
+
+#endif /* __GXP_NOTIFICATION_H__ */