public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Barnes <robbarnes@google.com>
To: groeck@chromium.org, pmalani@chromium.org
Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org,
	dtor@chromium.org, Rob Barnes <robbarnes@google.com>
Subject: [PATCH v3 2/2] platform/chrome: cros_ec: Shutdown on EC Panic
Date: Wed,  4 Jan 2023 01:15:24 +0000	[thread overview]
Message-ID: <20230104011524.369764-3-robbarnes@google.com> (raw)
In-Reply-To: <20230104011524.369764-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.

Signed-off-by: Rob Barnes <robbarnes@google.com>
---

Changelog since v1:
- Split into two patches

 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-04  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  1:15 [PATCH v3 0/2] Handle CrOS EC Panics Rob Barnes
2023-01-04  1:15 ` [PATCH v3 1/2] platform/chrome: cros_ec: Poll EC log on EC panic Rob Barnes
2023-01-05  4:40   ` Prashant Malani
2023-01-10 22:09   ` Marek Szyprowski
2023-01-04  1:15 ` Rob Barnes [this message]
2023-01-04 18:41   ` [PATCH v3 2/2] platform/chrome: cros_ec: Shutdown on EC Panic Prashant Malani
2023-01-06  3:50 ` [PATCH v3 0/2] Handle CrOS EC Panics patchwork-bot+chrome-platform
2023-01-09  5:30 ` patchwork-bot+chrome-platform

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=20230104011524.369764-3-robbarnes@google.com \
    --to=robbarnes@google.com \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dtor@chromium.org \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.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