Chrome platform driver development
 help / color / mirror / Atom feed
From: Rob Barnes <robbarnes@google.com>
To: groeck@chromium.org, pmalani@chromium.org
Cc: chrome-platform@lists.linux.dev, dtor@chromium.org,
	 Rob Barnes <robbarnes@google.com>
Subject: [PATCH v2 2/2] platform/chrome: cros_ec: Shutdown on EC Panic
Date: Tue,  3 Jan 2023 22:52:03 +0000	[thread overview]
Message-ID: <20230103225204.346088-3-robbarnes@google.com> (raw)
In-Reply-To: <20230103225204.346088-1-robbarnes@google.com>

When an EC panic is reported, attempt an orderly shutdown.
Force a shutdown after a brief timeout if the orderly shutdown
fails for any reason.

Using the common hw_protection_shutdown utility function since
an EC panic has the potential to cause hw damage.

This is all best effort. EC should also force a hard reset after a
short timeout.

Change-Id: Ie87e7921431b85e3aba5c0e6c9f0a34e4daa181d
Signed-off-by: Rob Barnes <robbarnes@google.com>
---
 drivers/platform/chrome/cros_ec_lpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 5738f1d25091..3708fa75feb1 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -21,6 +21,7 @@
 #include <linux/platform_data/cros_ec_proto.h>
 #include <linux/platform_device.h>
 #include <linux/printk.h>
+#include <linux/reboot.h>
 #include <linux/suspend.h>
 
 #include "cros_ec.h"
@@ -323,6 +324,8 @@ 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);
+		/* 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 */
 		return;
 	}
-- 
2.39.0.314.g84b9a713c41-goog


  parent reply	other threads:[~2023-01-03 22:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 18:55 [PATCH] drivers/cros_ec: Handle CrOS EC panics Rob Barnes
2022-12-21 19:23 ` Prashant Malani
2022-12-21 23:55   ` Rob Barnes
2022-12-22  0:38     ` Prashant Malani
2023-01-03 22:52       ` [PATCH v2 0/2] Handle CrOS EC Panics Rob Barnes
2023-01-03 22:52         ` [PATCH v2 1/2] platform/chrome: cros_ec: Poll EC log on EC panic Rob Barnes
2023-01-03 23:14           ` Brian Norris
2023-01-03 23:17             ` Rob Barnes
2023-01-03 22:52         ` Rob Barnes [this message]
2023-01-03 23:14       ` [PATCH] drivers/cros_ec: Handle CrOS EC panics Rob Barnes
2023-01-03 23:27         ` Prashant Malani
2023-01-04  1:19           ` Rob Barnes
2022-12-21 20:07 ` Guenter Roeck
2022-12-21 23:55   ` Rob Barnes
2022-12-22  0:08     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230103225204.346088-3-robbarnes@google.com \
    --to=robbarnes@google.com \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dtor@chromium.org \
    --cc=groeck@chromium.org \
    --cc=pmalani@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox