public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Rob Barnes <robbarnes@google.com>,
	Prashant Malani <pmalani@chromium.org>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	bleung@chromium.org, chrome-platform@lists.linux.dev
Subject: [PATCH AUTOSEL 6.4 01/12] platform/chrome: cros_ec: Report EC panic as uevent
Date: Sun,  2 Jul 2023 15:50:46 -0400	[thread overview]
Message-ID: <20230702195057.1787686-1-sashal@kernel.org> (raw)

From: Rob Barnes <robbarnes@google.com>

[ Upstream commit 2cbf475a04b2ae3d722bbe41742e5d874a027fc3 ]

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>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230509232624.3120347-1-robbarnes@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 68bba0fcafab3..2b1ce3e1abf2e 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 */
-- 
2.39.2


             reply	other threads:[~2023-07-02 19:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 19:50 Sasha Levin [this message]
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 02/12] ACPI: x86: Add skip i2c clients quirk for Nextbook Ares 8A Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 03/12] ACPI: button: Add lid disable DMI " Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 04/12] ACPI: x86: Add ACPI_QUIRK_UART1_SKIP for Lenovo Yoga Book yb1-x90f/l Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 05/12] ACPI: video: Add backlight=native DMI quirk for Apple iMac11,3 Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 06/12] ACPI: video: Add backlight=native DMI quirk for Lenovo ThinkPad X131e (3371 AMD version) Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 07/12] arm64: cpufeature: detect FEAT_HCX Sasha Levin
2023-07-03 11:51   ` Mark Brown
2023-07-09 14:56     ` Sasha Levin
2023-07-09 21:13       ` Mark Brown
2023-07-10  9:44         ` Will Deacon
2023-07-10 13:31           ` Greg KH
2023-07-10 13:47             ` Mark Brown
2023-07-10 14:09               ` Greg KH
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 08/12] ACPI: resource: Remove "Zen" specific match and quirks Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 09/12] arm64: set __exception_irq_entry with __irq_entry as a default Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 10/12] arm64: mm: fix VA-range sanity check Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 11/12] drivers/perf: hisi: Add support for HiSilicon H60PA and PAv3 PMU driver Sasha Levin
2023-07-03 10:14   ` Mark Rutland
2023-07-21 15:13     ` Sasha Levin
2023-07-02 19:50 ` [PATCH AUTOSEL 6.4 12/12] ACPI: video: Add backlight=native DMI quirk for Dell Studio 1569 Sasha Levin
2023-07-10 22:46 ` [PATCH AUTOSEL 6.4 01/12] platform/chrome: cros_ec: Report EC panic as uevent Brian Norris
2023-07-21 15:11   ` Sasha Levin

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=20230702195057.1787686-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmalani@chromium.org \
    --cc=robbarnes@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tzungbi@kernel.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