diff options
author | Alex Iacobucci <alexiacobucci@google.com> | 2023-11-09 17:59:04 +0000 |
---|---|---|
committer | Alex Iacobucci <alexiacobucci@google.com> | 2023-11-21 16:56:34 +0000 |
commit | 6d2d774d935dffec66058aabecf3699ebef9bb8f (patch) | |
tree | f83781bc4e7aacb2a20dc494fa6b8cc6424ba198 | |
parent | c4a71452049c4a25ad6b7eb3ad8a5f4ac7f5af81 (diff) | |
download | aoc-6d2d774d935dffec66058aabecf3699ebef9bb8f.tar.gz |
aoc: notify aocd when aoc_request_on times out
Test: on device
Bug: 309950738
Change-Id: I60c14d8d89847c0681ff285b1f4d26d37858be18
Signed-off-by: Alex Iacobucci <alexiacobucci@google.com>
-rw-r--r-- | Documentation/ABI/sysfs-devices-platform-aoc | 9 | ||||
-rw-r--r-- | aoc.c | 20 | ||||
-rw-r--r-- | aoc.h | 2 | ||||
-rw-r--r-- | aoc_v1.c | 3 |
4 files changed, 34 insertions, 0 deletions
diff --git a/Documentation/ABI/sysfs-devices-platform-aoc b/Documentation/ABI/sysfs-devices-platform-aoc new file mode 100644 index 0000000..81a5b6c --- /dev/null +++ b/Documentation/ABI/sysfs-devices-platform-aoc @@ -0,0 +1,9 @@ +What: /sys/devices/platform/[0-9]+.aoc/notify_timeout_aoc_status +Date: Nov 2023 +KernelVersion: 2.6.22 +Contact: alexiacobucci@google.com +Description: + Read-only node used by AOC's kernel driver to notify userspace + if a request for AOC fabric to reach a certain state has timed out. + +Users: AOC kernel driver, aocd process in userspace. @@ -1014,6 +1014,14 @@ static ssize_t sensor_power_enable_store(struct device *dev, static DEVICE_ATTR_WO(sensor_power_enable); +static ssize_t notify_timeout_aoc_status_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return 0; +} + +static DEVICE_ATTR_RO(notify_timeout_aoc_status); + static struct attribute *aoc_attrs[] = { &dev_attr_firmware.attr, &dev_attr_revision.attr, @@ -1027,6 +1035,7 @@ static struct attribute *aoc_attrs[] = { &dev_attr_sensor_power_enable.attr, &dev_attr_force_reload.attr, &dev_attr_dmic_power_enable.attr, + &dev_attr_notify_timeout_aoc_status.attr, NULL }; @@ -1569,6 +1578,7 @@ static void aoc_take_offline(struct aoc_prvdata *prvdata) dev_err(prvdata->dev, "timed out waiting for aoc_ack\n"); if (prvdata->protected_by_gsa) dev_err(prvdata->dev, "skipping GSA commands"); + notify_timeout_aoc_status(); return; } } @@ -1635,6 +1645,16 @@ exit: atomic_dec(&prvdata->aoc_process_active); } +void notify_timeout_aoc_status(void) +{ + if (aoc_platform_device == NULL) { + pr_err("AOC platform device is undefined, can't notify aocd\n"); + return; + } + sysfs_notify(&aoc_platform_device->dev.kobj, NULL, + "notify_timeout_aoc_status"); +} + void aoc_set_map_handler(struct aoc_service_dev *dev, aoc_map_handler handler, void *ctx) { @@ -287,6 +287,8 @@ u32 dt_property(struct device_node *node, const char *key); void configure_crash_interrupts(struct aoc_prvdata *prvdata, bool enable); +void notify_timeout_aoc_status(void); + #define AOC_SERVICE_NAME_LENGTH 32 /* Rings should have the ring flag set, slots = 1, size = ring size @@ -142,6 +142,7 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata, aoc_req_rc = wait_for_aoc_status(prvdata, true); if (aoc_req_rc) { dev_err(prvdata->dev, "timed out waiting for aoc_ack\n"); + notify_timeout_aoc_status(); continue; } dev_info(prvdata->dev, "resetting aoc\n"); @@ -174,6 +175,8 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata, if (aoc_req_rc && *(aoc_module_params->aoc_panic_on_req_timeout)) { dev_err(prvdata->dev, "timed out too many times waiting for aoc_ack, triggering kernel panic\n"); + /* Sleep to ensure aocd can process notification of timeout before panic */ + msleep(1000); panic("AoC kernel panic: timed out waiting for aoc_ack"); } |