mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
PM, libnvdimm: Add runtime firmware activation support
Abstract platform specific mechanics for nvdimm firmware activation behind a handful of generic ops. At the bus level ->activate_state() indicates the unified state (idle, busy, armed) of all DIMMs on the bus, and ->capability() indicates the system state expectations for activate. At the DIMM level ->activate_state() indicates the per-DIMM state, ->activate_result() indicates the outcome of the last activation attempt, and ->arm() attempts to transition the DIMM from 'idle' to 'armed'. A new hibernate_quiet_exec() facility is added to support firmware activation in an OS defined system quiesce state. It leverages the fact that the hibernate-freeze state wants to assert that a memory hibernation snapshot can be taken. This is in contrast to a platform firmware defined quiesce state that may forcefully quiet the memory controller independent of whether an individual device-driver properly supports hibernate-freeze. The libnvdimm sysfs interface is extended to support detection of a firmware activate capability. The mechanism supports enumeration and triggering of firmware activate, optionally in the hibernate_quiet_exec() context. [rafael: hibernate_quiet_exec() proposal] [vishal: fix up sparse warning, grammar in Documentation/] Cc: Pavel Machek <pavel@ucw.cz> Cc: Ira Weiny <ira.weiny@intel.com> Cc: Len Brown <len.brown@intel.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Reported-by: kernel test robot <lkp@intel.com> Co-developed-by: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Signed-off-by: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
This commit is contained in:
parent
5cf81ce189
commit
48001ea50d
8 changed files with 500 additions and 0 deletions
|
@ -86,6 +86,7 @@ struct nvdimm_bus_descriptor {
|
|||
int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
|
||||
int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc,
|
||||
struct nvdimm *nvdimm, unsigned int cmd, void *data);
|
||||
const struct nvdimm_bus_fw_ops *fw_ops;
|
||||
};
|
||||
|
||||
struct nd_cmd_desc {
|
||||
|
@ -200,6 +201,49 @@ struct nvdimm_security_ops {
|
|||
int (*query_overwrite)(struct nvdimm *nvdimm);
|
||||
};
|
||||
|
||||
enum nvdimm_fwa_state {
|
||||
NVDIMM_FWA_INVALID,
|
||||
NVDIMM_FWA_IDLE,
|
||||
NVDIMM_FWA_ARMED,
|
||||
NVDIMM_FWA_BUSY,
|
||||
NVDIMM_FWA_ARM_OVERFLOW,
|
||||
};
|
||||
|
||||
enum nvdimm_fwa_trigger {
|
||||
NVDIMM_FWA_ARM,
|
||||
NVDIMM_FWA_DISARM,
|
||||
};
|
||||
|
||||
enum nvdimm_fwa_capability {
|
||||
NVDIMM_FWA_CAP_INVALID,
|
||||
NVDIMM_FWA_CAP_NONE,
|
||||
NVDIMM_FWA_CAP_QUIESCE,
|
||||
NVDIMM_FWA_CAP_LIVE,
|
||||
};
|
||||
|
||||
enum nvdimm_fwa_result {
|
||||
NVDIMM_FWA_RESULT_INVALID,
|
||||
NVDIMM_FWA_RESULT_NONE,
|
||||
NVDIMM_FWA_RESULT_SUCCESS,
|
||||
NVDIMM_FWA_RESULT_NOTSTAGED,
|
||||
NVDIMM_FWA_RESULT_NEEDRESET,
|
||||
NVDIMM_FWA_RESULT_FAIL,
|
||||
};
|
||||
|
||||
struct nvdimm_bus_fw_ops {
|
||||
enum nvdimm_fwa_state (*activate_state)
|
||||
(struct nvdimm_bus_descriptor *nd_desc);
|
||||
enum nvdimm_fwa_capability (*capability)
|
||||
(struct nvdimm_bus_descriptor *nd_desc);
|
||||
int (*activate)(struct nvdimm_bus_descriptor *nd_desc);
|
||||
};
|
||||
|
||||
struct nvdimm_fw_ops {
|
||||
enum nvdimm_fwa_state (*activate_state)(struct nvdimm *nvdimm);
|
||||
enum nvdimm_fwa_result (*activate_result)(struct nvdimm *nvdimm);
|
||||
int (*arm)(struct nvdimm *nvdimm, enum nvdimm_fwa_trigger arg);
|
||||
};
|
||||
|
||||
void badrange_init(struct badrange *badrange);
|
||||
int badrange_add(struct badrange *badrange, u64 addr, u64 length);
|
||||
void badrange_forget(struct badrange *badrange, phys_addr_t start,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue