From patchwork Fri Mar 14 11:36:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 14016684 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 77EFB1FDE24 for ; Fri, 14 Mar 2025 11:36:38 +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=1741952199; cv=none; b=mriMwtnpWhf4974OAfpJy7OVAswkeYz0pwJIsNRLTOEelL7MbDIBoiG4IsW7c9naRABBtCizl7SxWc1N6OLdYokYUR5JSAmSxJFvNkhbLSjPtlqM8LGyy+N1zAuJ/cCyYOwLJza01Ca7ntWXRMYop+7jDI1s+r+i7oHqIXWA/LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741952199; c=relaxed/simple; bh=BM2P1+sWqXKKZwR/jHqONVfULGU+/JuCKI63iVNdZTM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WlMhTNMU1cK54PaOpi/GLeLz0jTMO/FDRMcxh15OjmKeYe8Qope5wGCHutE5SpzIQdSJ3TgI5gWXtvR/Y9eLmweQMZDOTdvnAk6pe3qDZukgyt7WpWAstwBE5muucX+20tDUIfI33v0WSOoE/r4HnNXLxd9VPcl9PC4OZBpqtgg= 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 ) id 1tt3Kg-0007Nf-QE; Fri, 14 Mar 2025 12:36:06 +0100 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tt3Kf-005h5z-2K; Fri, 14 Mar 2025 12:36:05 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1tt3Kf-007S73-1z; Fri, 14 Mar 2025 12:36:05 +0100 From: Oleksij Rempel To: Sebastian Reichel , Srinivas Kandagatla , Benson Leung , Tzung-Bi Shih , Daniel Lezcano Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org, =?utf-8?q?S=C3=B8ren_Andersen?= , Guenter Roeck , Matti Vaittinen , Ahmad Fatoum , Andrew Morton , chrome-platform@lists.linux.dev Subject: [PATCH v6 7/7] Documentation: Add sysfs documentation for PSCRR reboot reason tracking Date: Fri, 14 Mar 2025 12:36:04 +0100 Message-Id: <20250314113604.1776201-8-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314113604.1776201-1-o.rempel@pengutronix.de> References: <20250314113604.1776201-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: chrome-platform@lists.linux.dev Add documentation for the Power State Change Reason Recorder (PSCRR) sysfs interface, which allows tracking of system shutdown and reboot reasons. The documentation provides details on available sysfs entries under `/sys/kernel/pscrr/`, explaining their functionality, example usage, and how they interact with different backend storage options (e.g., NVMEM). Signed-off-by: Oleksij Rempel --- .../ABI/testing/sysfs-kernel-reboot-pscrr | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-kernel-reboot-pscrr diff --git a/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr b/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr new file mode 100644 index 000000000000..7cc643f89675 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr @@ -0,0 +1,46 @@ +What: /sys/kernel/pscrr/reason +Date: April 2025 +KernelVersion: 6.15 +Contact: Oleksij Rempel +Description: + This file provides access to the last recorded power state + change reason. The storage backend is configurable and, if + supported, the reason may be stored persistently in an + NVMEM cell or another backend. + + Reading this file returns an integer representing the last + recorded shutdown or reboot cause. + + Writing an integer value to this file sets the reason to be + stored and recorded for system analysis. + + Example usage (values are for illustration and may not reflect + actual reasons used in a given system): + Read: + $ cat /sys/kernel/pscrr/reason + 3 # (Example: Power loss event, may differ per system) + + Write: + $ echo 5 > /sys/kernel/pscrr/reason + # Sets the reason to 5 (Example: User-triggered reboot, + # this may not be a real value in your system) + + Values are defined in: + - `include/linux/reboot.h` (enum psc_reason) + +What: /sys/kernel/pscrr/reason_boot +Date: April 2025 +KernelVersion: 6.15 +Contact: Oleksij Rempel +Description: + This file provides the last recorded power state change reason + from before the current system boot. If a supported backend + (e.g., NVMEM) is configured, this value is retained across + reboots. + + Example usage (values are for illustration and may not reflect + actual reasons used in a given system): + Read: + $ cat /sys/kernel/pscrr/reason_boot + 2 # (Example: Over-temperature shutdown, may differ per system) +