summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiqi Lin <siqilin@google.com>2021-08-05 09:51:31 -0700
committerSiqi Lin <siqilin@google.com>2021-08-06 19:31:40 +0000
commit24fa013e3de8ee6687f2f4d66f578fdb50a37bb8 (patch)
tree4bcd6461c25a7cd955599f6099822a420fce75c4
parent59ea28d79ebb47e1ce47d732ecf7e478824bf682 (diff)
downloadaoc-24fa013e3de8ee6687f2f4d66f578fdb50a37bb8.tar.gz
aoc: Add sysfs node for AoC DRAM exception wakeups
AoC exports a log of the last 16 DRAM exceptions that caused an AP wakeup. This log will be included in the bugreport to help debug unexpected AP wakeups due to AoC. Bug: 186456919 Test: cat /sys/devices/platform/19000000.aoc/control/memory_exception Signed-off-by: Siqi Lin <siqilin@google.com> Change-Id: I8b419a16ee026ff76f61ec15d86c674d608c0a8f
-rw-r--r--aoc-interface.h33
-rw-r--r--aoc_control_dev.c49
2 files changed, 80 insertions, 2 deletions
diff --git a/aoc-interface.h b/aoc-interface.h
index efab304..75884ee 100644
--- a/aoc-interface.h
+++ b/aoc-interface.h
@@ -18,7 +18,7 @@
* Autogenerated AoC interface matching AoC source code
* associated with the following source code:
*
- * hash: 3ee0b2e5ee2b66275066797cc3a0462f3709b01b
+ * hash: 6dae669039a25e1fe76d8018387a392dddca51a0
*
* DO NOT MODIFY THIS FILE
*
@@ -99,8 +99,10 @@ enum AOC_COMMAND {
CMD_UWB_SET_RESET_GPIO_DIRECTION_ID = 205, /* [0x00cd] -> struct CMD_UWB_SET_RESET_GPIO_DIRECTION */
CMD_AUDIO_INPUT_HOTWORD_ENABLE_AEC_ID = 206, /* [0x00ce] -> struct CMD_HDR */
CMD_AUDIO_OUTPUT_EP_SETUP_ID = 206, /* [0x00ce] -> struct CMD_AUDIO_OUTPUT_EP_SETUP */
+ CMD_GET_MEMORY_EXCEPTION_DATA_COUNT_ID = 206, /* [0x00ce] -> struct CMD_GET_MEMORY_EXCEPTION_DATA_COUNT */
CMD_AUDIO_INPUT_HOTWORD_DISABLE_AEC_ID = 207, /* [0x00cf] -> struct CMD_HDR */
CMD_AUDIO_OUTPUT_DECODE_ID = 207, /* [0x00cf] -> struct CMD_AUDIO_OUTPUT_DECODE */
+ CMD_GET_MEMORY_EXCEPTION_DATA_ID = 207, /* [0x00cf] -> struct CMD_GET_MEMORY_EXCEPTION_DATA */
CMD_AUDIO_OUTPUT_AEC_NOTIFY_ID = 208, /* [0x00d0] -> struct CMD_AUDIO_OUTPUT_AEC_NOTIFY */
CMD_AUDIO_INPUT_AP_INPUT_START_ID = 208, /* [0x00d0] -> struct CMD_AUDIO_INPUT_AP_INPUT_START */
CMD_AUDIO_OUTPUT_SET_PARAMETER_ID = 209, /* [0x00d1] -> struct CMD_AUDIO_OUTPUT_SET_PARAMETER */
@@ -2124,6 +2126,31 @@ struct CMD_AUDIO_OUTPUT_DSP_MODE {
uint8_t mode; /* For valid values, refer to "enum AudioDSPMode" */
} __attribute__((packed));
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_GET_MEMORY_EXCEPTION_DATA_COUNT_ID, UUID: 28f0f531d9df8239a69ecc3144864106
+ */
+struct CMD_GET_MEMORY_EXCEPTION_DATA_COUNT {
+ struct CMD_HDR parent;
+ uint32_t num_memory_exception;
+} __attribute__((packed));
+
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_GET_MEMORY_EXCEPTION_DATA_ID, UUID: 9212b73d3346ace571f370610f20166a
+ */
+struct CMD_GET_MEMORY_EXCEPTION_DATA {
+ struct CMD_HDR parent;
+ uint32_t id;
+ uint32_t return_address;
+ uint32_t fault_address;
+ char task_name[16];
+ uint8_t log_index;
+ uint8_t valid;
+} __attribute__((packed));
+
struct NOTIF_HDR {
struct CONTAINER_HDR parent;
uint32_t id;
@@ -2164,7 +2191,7 @@ static inline void AocCmdHdrSet(struct CMD_HDR * cmd, uint16_t id, uint16_t leng
/**
* Total number of UUID strings to check against the FW image.
*/
-#define AOC_UUID_ENTRIES (217)
+#define AOC_UUID_ENTRIES (219)
/**
* UUID entry size.
@@ -2222,6 +2249,7 @@ static inline int AocInterfaceCheck(const void * addr, int size) {
{ 0x25, 0x09, 0xef, 0x21, 0x85, 0x79, 0xe8, 0x6f, 0x41, 0x93, 0x90, 0xb7, 0x01, 0xef, 0xa7, 0xa9},
{ 0x26, 0xff, 0x9e, 0x04, 0x4e, 0x65, 0x51, 0x07, 0x75, 0x29, 0x1a, 0xbe, 0x87, 0x40, 0x5f, 0xbc},
{ 0x28, 0xc0, 0xb7, 0x33, 0x5f, 0x0b, 0xfd, 0x1f, 0x67, 0xdb, 0xe0, 0x11, 0xca, 0x7a, 0x07, 0x4e},
+ { 0x28, 0xf0, 0xf5, 0x31, 0xd9, 0xdf, 0x82, 0x39, 0xa6, 0x9e, 0xcc, 0x31, 0x44, 0x86, 0x41, 0x06},
{ 0x2a, 0x1e, 0x68, 0xa1, 0xc7, 0xa2, 0x1f, 0xdc, 0x68, 0x04, 0x3f, 0x70, 0x26, 0xa3, 0x4e, 0x4a},
{ 0x2a, 0x2b, 0x74, 0x38, 0xe1, 0x68, 0x76, 0x65, 0x83, 0x21, 0xcc, 0x7e, 0x8c, 0x4f, 0x23, 0x51},
{ 0x2b, 0x50, 0x8f, 0x8f, 0x52, 0x02, 0x9e, 0x2f, 0x70, 0x50, 0x5c, 0x90, 0x55, 0xca, 0x50, 0xce},
@@ -2316,6 +2344,7 @@ static inline int AocInterfaceCheck(const void * addr, int size) {
{ 0x90, 0x69, 0x0c, 0xde, 0xee, 0xd1, 0x10, 0x27, 0x8c, 0x34, 0xab, 0x2c, 0xe5, 0xb1, 0xe8, 0x47},
{ 0x90, 0xb1, 0x92, 0x11, 0x9b, 0x47, 0x1f, 0x4b, 0xf2, 0x35, 0x3a, 0xc4, 0xf0, 0xac, 0x8a, 0x86},
{ 0x90, 0xd9, 0x24, 0x60, 0x10, 0x4e, 0x4b, 0xc6, 0xc2, 0xd9, 0xc9, 0xa0, 0xf6, 0x35, 0xb5, 0xc9},
+ { 0x92, 0x12, 0xb7, 0x3d, 0x33, 0x46, 0xac, 0xe5, 0x71, 0xf3, 0x70, 0x61, 0x0f, 0x20, 0x16, 0x6a},
{ 0x93, 0x6b, 0x01, 0x0c, 0xde, 0x4c, 0x78, 0x6c, 0xa6, 0xe8, 0xd8, 0xac, 0xec, 0x5d, 0x87, 0xf8},
{ 0x94, 0xcf, 0x5c, 0xad, 0x30, 0x28, 0x0a, 0x4e, 0xc7, 0x85, 0x3e, 0xa7, 0xe7, 0xa0, 0x1c, 0xa2},
{ 0x94, 0xec, 0x52, 0x04, 0x2e, 0x50, 0x0d, 0x4e, 0x1c, 0x12, 0xf4, 0x6b, 0x8b, 0xef, 0x2b, 0x0e},
diff --git a/aoc_control_dev.c b/aoc_control_dev.c
index 82f4296..da0ec6c 100644
--- a/aoc_control_dev.c
+++ b/aoc_control_dev.c
@@ -126,6 +126,54 @@ static ssize_t hf_build_info_show(struct device *dev,
static DEVICE_ATTR_RO(hf_build_info);
+static ssize_t memory_exception_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct stats_prvdata *prvdata = dev_get_drvdata(dev);
+ struct CMD_GET_MEMORY_EXCEPTION_DATA_COUNT get_count_cmd;
+ struct CMD_GET_MEMORY_EXCEPTION_DATA get_data_cmd;
+ u32 total_count;
+ u32 i;
+ u32 bytes_written;
+ int ret;
+
+ AocCmdHdrSet(&get_count_cmd.parent, CMD_GET_MEMORY_EXCEPTION_DATA_COUNT_ID,
+ sizeof(get_count_cmd));
+
+ ret = read_attribute(prvdata, &get_count_cmd, sizeof(get_count_cmd),
+ &get_count_cmd, sizeof(get_count_cmd));
+
+ if (ret < 0)
+ return ret;
+
+ total_count = get_count_cmd.num_memory_exception;
+ if (total_count > 16) {
+ total_count = 16;
+ }
+ bytes_written = 0;
+ for (i = 0; i < total_count; i++) {
+ AocCmdHdrSet(&get_data_cmd.parent, CMD_GET_MEMORY_EXCEPTION_DATA_ID,
+ sizeof(get_data_cmd));
+ get_data_cmd.log_index = i;
+ get_data_cmd.valid = false;
+ ret = read_attribute(prvdata, &get_data_cmd, sizeof(get_data_cmd),
+ &get_data_cmd, sizeof(get_data_cmd));
+ if (ret < 0)
+ return ret;
+
+ if (get_data_cmd.valid) {
+ bytes_written += scnprintf(buf + bytes_written, PAGE_SIZE - bytes_written,
+ "index = %u, id = %u, return_address = 0x%x, fault_address = 0x%x, task_name = %s\n",
+ i, get_data_cmd.id, get_data_cmd.return_address,
+ get_data_cmd.fault_address, get_data_cmd.task_name);
+ }
+ }
+
+ return bytes_written;
+}
+
+static DEVICE_ATTR_RO(memory_exception);
+
static ssize_t read_timed_stat(struct device *dev, char *buf, int index)
{
struct stats_prvdata *prvdata = dev_get_drvdata(dev);
@@ -306,6 +354,7 @@ static struct attribute *aoc_stats_attrs[] = {
&dev_attr_audio_wakeup.attr,
&dev_attr_logging_wakeup.attr,
&dev_attr_hotword_wakeup.attr,
+ &dev_attr_memory_exception.attr,
NULL
};