lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250627204821.1150459-1-k-willis@ti.com>
Date: Fri, 27 Jun 2025 15:48:19 -0500
From: Kendall Willis <k-willis@...com>
To: <nm@...com>, <kristo@...nel.org>, <ssantosh@...nel.org>,
        <ulf.hansson@...aro.org>, <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>
CC: <d-gole@...com>, <vishalm@...com>, <sebin.francis@...com>,
        <msp@...libre.com>, <khilman@...libre.com>,
        Kendall Willis <k-willis@...com>
Subject: [PATCH 0/2] Enable abort sequence from LPM entry

The PM co-processor (device manager or DM) adds the ability to abort
entry to a low power mode by clearing the mode selection in the
latest version of its firmware (11.x) [1].

This series adds support for aborting entry to a low power mode if an
error occurs during suspend. If any driver with either ->suspend_late()
or ->suspend_noirq() hook in the TI SCI PM domain fails to suspend, an
abort message will be sent to the DM and the DM will abort by clearing
the current mode selection.

The flow for the abort sequence is the following:
   1. User sends a command to enter sleep
   2. Linux starts to suspend drivers
   3. TI SCI suspends and sends prepare_sleep message to DM
   4. A driver fails to suspend
   5. Linux sends DM abort message via the TI SCI PM domain driver
   6. DM aborts LPM entry by clearing the current mode selection
   7. Linux resumes the drivers that have already suspended
   8. Linux works as normal

Only devices in the TI SCI PM domain are able to trigger the abort
message because the TI SCI PM domain driver has ->suspend_late() and
->suspend_noirq() hooks that are apart of each drivers respective
suspend path. In the TI SCI PM domain driver suspend hook, the suspend
hook of the current device will be called and the TI SCI PM domain driver
will check to see if the suspend returned with an error. If it does, an
abort message is sent to the DM.

The prepare_sleep message has to be sent to the DM first before the
abort message is sent since abort works by clearing the low power mode
selected. The prepare_sleep message is sent as apart of TI SCI
->suspend(). Since TI SCI suspend happens after all TI SCI devices with
the ->suspend() hook have suspended, adding an abort call in the
->suspend() hook isn't needed.

Additionally, if TI SCI fails to suspend or fails to prepare sleep, an
abort message will be sent to the DM. This had to be done separately
because TI SCI is not a device in the TI SCI PM domain.

Testing:
To test this series, a driver in the TI SCI PM domain has to fail to
suspend. When this happens the following is printed during Linux's
suspend/resume logs:
   Failed to suspend. Abort entering low power mode.

Series has been tested on an SK-AM62B-P1 board. Normal suspend/resume
has been verified. Abort was tested by adding an error into the TI SCI
suspend hook.

[1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html

Kendall Willis (2):
  firmware: ti_sci: Enable abort handling of entry to LPM
  pmdomain: ti_sci: Add LPM abort sequence to suspend path

 drivers/firmware/ti_sci.c               | 67 +++++++++++++++++++++++--
 drivers/firmware/ti_sci.h               |  3 +-
 drivers/pmdomain/ti/ti_sci_pm_domains.c | 46 ++++++++++++++++-
 include/linux/soc/ti/ti_sci_protocol.h  |  2 +
 4 files changed, 113 insertions(+), 5 deletions(-)


base-commit: 2aeda9592360c200085898a258c4754bfe879921
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ