Skip to content

Commit 4bf5e36

Browse files
committed
Merge tag 'libnvdimm-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updayes from Vishal Verma: "You'd normally receive this pull request from Dan Williams, but he's busy watching a newborn (Congrats Dan!), so I'm watching libnvdimm this cycle. This adds a new feature in libnvdimm - 'Runtime Firmware Activation', and a few small cleanups and fixes in libnvdimm and DAX. I'd originally intended to make separate topic-based pull requests - one for libnvdimm, and one for DAX, but some of the DAX material fell out since it wasn't quite ready. Summary: - add 'Runtime Firmware Activation' support for NVDIMMs that advertise the relevant capability - misc libnvdimm and DAX cleanups" * tag 'libnvdimm-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: libnvdimm/security: ensure sysfs poll thread woke up and fetch updated attr libnvdimm/security: the 'security' attr never show 'overwrite' state libnvdimm/security: fix a typo ACPI: NFIT: Fix ARS zero-sized allocation dax: Fix incorrect argument passed to xas_set_err() ACPI: NFIT: Add runtime firmware activate support PM, libnvdimm: Add runtime firmware activation support libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO() drivers/dax: Expand lock scope to cover the use of addresses fs/dax: Remove unused size parameter dax: print error message by pr_info() in __generic_fsdax_supported() driver-core: Introduce DEVICE_ATTR_ADMIN_{RO,RW} tools/testing/nvdimm: Emulate firmware activation commands tools/testing/nvdimm: Prepare nfit_ctl_test() for ND_CMD_CALL emulation tools/testing/nvdimm: Add command debug messages tools/testing/nvdimm: Cleanup dimm index passing ACPI: NFIT: Define runtime firmware activation commands ACPI: NFIT: Move bus_dsm_mask out of generic nvdimm_bus_descriptor libnvdimm: Validate command family indices
2 parents 00e4db5 + 7f67402 commit 4bf5e36

File tree

22 files changed

+1475
-137
lines changed

22 files changed

+1475
-137
lines changed

Documentation/ABI/testing/sysfs-bus-nfit

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,25 @@ Description:
202202
functions. See the section named 'NVDIMM Root Device _DSMs' in
203203
the ACPI specification.
204204

205+
What: /sys/bus/nd/devices/ndbusX/nfit/firmware_activate_noidle
206+
Date: Apr, 2020
207+
KernelVersion: v5.8
208+
209+
Description:
210+
(RW) The Intel platform implementation of firmware activate
211+
support exposes an option let the platform force idle devices in
212+
the system over the activation event, or trust that the OS will
213+
do it. The safe default is to let the platform force idle
214+
devices since the kernel is already in a suspend state, and on
215+
the chance that a driver does not properly quiesce bus-mastering
216+
after a suspend callback the platform will handle it. However,
217+
the activation might abort if, for example, platform firmware
218+
determines that the activation time exceeds the max PCI-E
219+
completion timeout. Since the platform does not know whether the
220+
OS is running the activation from a suspend context it aborts,
221+
but if the system owner trusts driver suspend callback to be
222+
sufficient then 'firmware_activation_noidle' can be
223+
enabled to bypass the activation abort.
205224

206225
What: /sys/bus/nd/devices/regionX/nfit/range_index
207226
Date: Jun, 2015
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The libnvdimm sub-system implements a common sysfs interface for
2+
platform nvdimm resources. See Documentation/driver-api/nvdimm/.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
==================================
4+
NVDIMM Runtime Firmware Activation
5+
==================================
6+
7+
Some persistent memory devices run a firmware locally on the device /
8+
"DIMM" to perform tasks like media management, capacity provisioning,
9+
and health monitoring. The process of updating that firmware typically
10+
involves a reboot because it has implications for in-flight memory
11+
transactions. However, reboots are disruptive and at least the Intel
12+
persistent memory platform implementation, described by the Intel ACPI
13+
DSM specification [1], has added support for activating firmware at
14+
runtime.
15+
16+
A native sysfs interface is implemented in libnvdimm to allow platform
17+
to advertise and control their local runtime firmware activation
18+
capability.
19+
20+
The libnvdimm bus object, ndbusX, implements an ndbusX/firmware/activate
21+
attribute that shows the state of the firmware activation as one of 'idle',
22+
'armed', 'overflow', and 'busy'.
23+
24+
- idle:
25+
No devices are set / armed to activate firmware
26+
27+
- armed:
28+
At least one device is armed
29+
30+
- busy:
31+
In the busy state armed devices are in the process of transitioning
32+
back to idle and completing an activation cycle.
33+
34+
- overflow:
35+
If the platform has a concept of incremental work needed to perform
36+
the activation it could be the case that too many DIMMs are armed for
37+
activation. In that scenario the potential for firmware activation to
38+
timeout is indicated by the 'overflow' state.
39+
40+
The 'ndbusX/firmware/activate' property can be written with a value of
41+
either 'live', or 'quiesce'. A value of 'quiesce' triggers the kernel to
42+
run firmware activation from within the equivalent of the hibernation
43+
'freeze' state where drivers and applications are notified to stop their
44+
modifications of system memory. A value of 'live' attempts
45+
firmware activation without this hibernation cycle. The
46+
'ndbusX/firmware/activate' property will be elided completely if no
47+
firmware activation capability is detected.
48+
49+
Another property 'ndbusX/firmware/capability' indicates a value of
50+
'live' or 'quiesce', where 'live' indicates that the firmware
51+
does not require or inflict any quiesce period on the system to update
52+
firmware. A capability value of 'quiesce' indicates that firmware does
53+
expect and injects a quiet period for the memory controller, but 'live'
54+
may still be written to 'ndbusX/firmware/activate' as an override to
55+
assume the risk of racing firmware update with in-flight device and
56+
application activity. The 'ndbusX/firmware/capability' property will be
57+
elided completely if no firmware activation capability is detected.
58+
59+
The libnvdimm memory-device / DIMM object, nmemX, implements
60+
'nmemX/firmware/activate' and 'nmemX/firmware/result' attributes to
61+
communicate the per-device firmware activation state. Similar to the
62+
'ndbusX/firmware/activate' attribute, the 'nmemX/firmware/activate'
63+
attribute indicates 'idle', 'armed', or 'busy'. The state transitions
64+
from 'armed' to 'idle' when the system is prepared to activate firmware,
65+
firmware staged + state set to armed, and 'ndbusX/firmware/activate' is
66+
triggered. After that activation event the nmemX/firmware/result
67+
attribute reflects the state of the last activation as one of:
68+
69+
- none:
70+
No runtime activation triggered since the last time the device was reset
71+
72+
- success:
73+
The last runtime activation completed successfully.
74+
75+
- fail:
76+
The last runtime activation failed for device-specific reasons.
77+
78+
- not_staged:
79+
The last runtime activation failed due to a sequencing error of the
80+
firmware image not being staged.
81+
82+
- need_reset:
83+
Runtime firmware activation failed, but the firmware can still be
84+
activated via the legacy method of power-cycling the system.
85+
86+
[1]: https://docs.pmem.io/persistent-memory/

0 commit comments

Comments
 (0)