diff mbox series

[v4] platform/chrome: cros_ec: Report EC panic as uevent

Message ID 20230509232624.3120347-1-robbarnes@google.com (mailing list archive)
State Accepted
Commit 2cbf475a04b2ae3d722bbe41742e5d874a027fc3
Headers show
Series [v4] platform/chrome: cros_ec: Report EC panic as uevent | expand

Commit Message

Rob Barnes May 9, 2023, 11:26 p.m. UTC
Create a uevent when an EC panic is detected. This will allow udev rules
to trigger when a panic occurs. For example, a udev rule could be added to
capture an EC coredump. This approach avoids the need to stuff all the
processing into the driver.

Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>

---
Changelog since v3:
- Fix typos in commit message

Changelog since v2:
- Move variable declaration to top of function

Changelog since v1:
- Inline uevent call

drivers/platform/chrome/cros_ec_lpc.c | 3 +++
1 file changed, 3 insertions(+)

Comments

patchwork-bot+chrome-platform@kernel.org May 15, 2023, 5:20 a.m. UTC | #1
Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Tue,  9 May 2023 23:26:24 +0000 you wrote:
> Create a uevent when an EC panic is detected. This will allow udev rules
> to trigger when a panic occurs. For example, a udev rule could be added to
> capture an EC coredump. This approach avoids the need to stuff all the
> processing into the driver.
> 
> Signed-off-by: Rob Barnes <robbarnes@google.com>
> Reviewed-by: Prashant Malani <pmalani@chromium.org>
> 
> [...]

Here is the summary with links:
  - [v4] platform/chrome: cros_ec: Report EC panic as uevent
    https://git.kernel.org/chrome-platform/c/2cbf475a04b2

You are awesome, thank you!
patchwork-bot+chrome-platform@kernel.org May 19, 2023, 2 a.m. UTC | #2
Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Tue,  9 May 2023 23:26:24 +0000 you wrote:
> Create a uevent when an EC panic is detected. This will allow udev rules
> to trigger when a panic occurs. For example, a udev rule could be added to
> capture an EC coredump. This approach avoids the need to stuff all the
> processing into the driver.
> 
> Signed-off-by: Rob Barnes <robbarnes@google.com>
> Reviewed-by: Prashant Malani <pmalani@chromium.org>
> 
> [...]

Here is the summary with links:
  - [v4] platform/chrome: cros_ec: Report EC panic as uevent
    https://git.kernel.org/chrome-platform/c/2cbf475a04b2

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index b399f7cbf17be..c6920df1e95dd 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -16,6 +16,7 @@ 
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/interrupt.h>
+#include <linux/kobject.h>
 #include <linux/module.h>
 #include <linux/platform_data/cros_ec_commands.h>
 #include <linux/platform_data/cros_ec_proto.h>
@@ -315,6 +316,7 @@  static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset,
 
 static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
 {
+	static const char *env[] = { "ERROR=PANIC", NULL };
 	struct cros_ec_device *ec_dev = data;
 	bool ec_has_more_events;
 	int ret;
@@ -324,6 +326,7 @@  static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
 	if (value == ACPI_NOTIFY_CROS_EC_PANIC) {
 		dev_emerg(ec_dev->dev, "CrOS EC Panic Reported. Shutdown is imminent!");
 		blocking_notifier_call_chain(&ec_dev->panic_notifier, 0, ec_dev);
+		kobject_uevent_env(&ec_dev->dev->kobj, KOBJ_CHANGE, (char **)env);
 		/* Begin orderly shutdown. Force shutdown after 1 second. */
 		hw_protection_shutdown("CrOS EC Panic", 1000);
 		/* Do not query for other events after a panic is reported */