Message ID | 20240124122204.730370-9-o.rempel@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp965882dyi; Wed, 24 Jan 2024 04:53:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNvAseUlB7IoAWIXJ4oyNxtyFXgEXWWJHOcXJSypf5vAZ4kthESCNvk95xN5SYUqk5DZ5v X-Received: by 2002:a17:903:2287:b0:1d7:14e7:6851 with SMTP id b7-20020a170903228700b001d714e76851mr643262plh.94.1706100839144; Wed, 24 Jan 2024 04:53:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706100839; cv=pass; d=google.com; s=arc-20160816; b=JiaV8Vb+LILdfsa1m2fT86M8X9lN0xJCyUMdGfYyJ417YbWKr5SQuR7af23pJ34C5I JzSAIzl3NAv15yC7Aw/vdk0hu9+1G7S6y8dxThC9Kra0aUGMauiCqkC4iQzM7/JjGjr1 Ys5XxL4O07KEH7VioqC+SA1uG4pMI3rnz3BVM42KKtQW5DEw9ZPZaCsnl2YNJJUqmydj Sy67Kev8HTr+C2URaW354WFGopXSEDK6tyFFdqqD7trSGhAQpBhCEyHGXs/2HeIQy5Xg 9ufJzFGQLjGpTgxclpuTvZG5K62JgiU4aiOlI1/OUKKeST8m4TpTYAS1Z6wLwhnCZawD YcFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=I8r/edMx+iyEZ6fKQoBaay9p1ypCo1S2jGAadaPff+M=; fh=cTOyeHIiotxFveWD397Up69SLR8Dqpy9YboYIfW0A00=; b=mrJx50+aYaYLG+webOsnm4SAjyYyIQy6DvBcBbNHz+IQ0GO8VtiebiBIgiJLGA8dxc peb6wkOOwt6Udw4z/uBR9W/xVXOcTEQOQHV2aOYhm6siPCoZ93/zHFOjCgiU21T0xytD bk7NS7DlBE1wv8/KleRADL/XEJy0iwN/6xMSOwJaRnnHE/kk4Q4N95r6jYUhP2q/AtwF 0C6Qk4aW/X5/YHYtEWuWIOPtVe6cd7lroMZ7zc6gDarazJDFpn3zAGFffObp9BvVRj1B f4qB1rPlVqEnBmU6betQLtGKMw0mJ4UrN8ru/AOhEYpBoNySbzf5ox5Dwd1ekYQIHmjl tJ0g== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j1-20020a17090276c100b001d6fac9e759si11420274plt.116.2024.01.24.04.53.58 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 04:53:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36962-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 004C4B2B6B1 for <ouuuleilei@gmail.com>; Wed, 24 Jan 2024 12:23:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B476764CDE; Wed, 24 Jan 2024 12:22:29 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F04DC6310E for <linux-kernel@vger.kernel.org>; Wed, 24 Jan 2024 12:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098947; cv=none; b=eQ9XMdL6PCby9xLFmm0y9+GfV8xYsjlkfWBELxS0TAHzi5dfm0dRfSeELXjPPy5MbuWUIawFKOpAptpgQlViGP6QW/Erq2eC5+I5bbos+PpSKoJIGH2BtPjwY2xmVgaTeE4qXS8utdDDYHcJ9FbKQ2YhXG863J0GhCPbp5NcHvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098947; c=relaxed/simple; bh=HDAeY4bWfoe9Y+7OHDYHhF+4G8dpj+H9p3pWeswLx5k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ImzcrxLrU4IBo5LPlndz3y7d+IUFI9MZ5hbe6/JR88Q1JrxpIKfCxTt9jXSlDpybh+3OFRnOwzWVYJcZMSnU4ZrU8td73T6Y+8tGDmG68XxhbDAeLzrOXPsiWpwFrpYQFXxlRGildlvgFsZIo+YtOkcm3su+m08bYi6TlHPPoyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <ore@pengutronix.de>) id 1rScGd-0007oC-1C; Wed, 24 Jan 2024 13:22:07 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1rScGc-0023Zn-46; Wed, 24 Jan 2024 13:22:06 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from <ore@pengutronix.de>) id 1rScGc-003424-03; Wed, 24 Jan 2024 13:22:06 +0100 From: Oleksij Rempel <o.rempel@pengutronix.de> To: Sebastian Reichel <sre@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Oleksij Rempel <o.rempel@pengutronix.de>, kernel@pengutronix.de, linux-kernel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Zhang Rui <rui.zhang@intel.com>, Lukasz Luba <lukasz.luba@arm.com>, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, =?utf-8?q?S=C3=B8ren_Andersen?= <san@skov.dk> Subject: [PATCH v2 8/8] thermal: core: Record PSCR before hw_protection_shutdown() Date: Wed, 24 Jan 2024 13:22:04 +0100 Message-Id: <20240124122204.730370-9-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240124122204.730370-1-o.rempel@pengutronix.de> References: <20240124122204.730370-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788976393571035478 X-GMAIL-MSGID: 1788976393571035478 |
Series |
Introduction of PSCR Framework and Related Components
|
|
Commit Message
Oleksij Rempel
Jan. 24, 2024, 12:22 p.m. UTC
Enhance the thermal core to record the Power State Change Reason (PSCR)
prior to invoking hw_protection_shutdown(). This change integrates the
PSCR framework with the thermal subsystem, ensuring that reasons for
power state changes, such as overtemperature events, are stored in a
dedicated non-volatile memory (NVMEM) cell.
This 'black box' recording is crucial for post-mortem analysis, enabling
a deeper understanding of system failures and abrupt shutdowns,
especially in scenarios where PMICs or watchdog timers are incapable of
logging such events. The recorded data can be utilized during system
recovery routines in the bootloader or early kernel stages of subsequent
boots, significantly enhancing system diagnostics, reliability, and
debugging capabilities.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/thermal/thermal_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index dfaa6341694a..0511d82351c5 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -16,6 +16,7 @@ #include <linux/kdev_t.h> #include <linux/idr.h> #include <linux/thermal.h> +#include <linux/pscrr.h> #include <linux/reboot.h> #include <linux/string.h> #include <linux/of.h> @@ -329,6 +330,8 @@ static void thermal_zone_device_halt(struct thermal_zone_device *tz, bool shutdo dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->type); + set_power_state_change_reason(PSCR_OVERTEMPERATURE); + if (shutdown) hw_protection_shutdown(msg, poweroff_delay_ms); else