powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH
This patch implements support for PDSM request 'PAPR_PDSM_HEALTH' that returns a newly introduced 'struct nd_papr_pdsm_health' instance containing dimm health information back to user space in response to ND_CMD_CALL. This functionality is implemented in newly introduced papr_pdsm_health() that queries the nvdimm health information and then copies this information to the package payload whose layout is defined by 'struct nd_papr_pdsm_health'. Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20200615124407.32596-7-vaibhav@linux.ibm.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
committed by
Dan Williams
parent
f517f7925b
commit
d35f18b554
@@ -66,17 +66,54 @@
|
||||
#define ND_PDSM_HDR_SIZE \
|
||||
(sizeof(struct nd_pkg_pdsm) - ND_PDSM_PAYLOAD_MAX_SIZE)
|
||||
|
||||
/* Various nvdimm health indicators */
|
||||
#define PAPR_PDSM_DIMM_HEALTHY 0
|
||||
#define PAPR_PDSM_DIMM_UNHEALTHY 1
|
||||
#define PAPR_PDSM_DIMM_CRITICAL 2
|
||||
#define PAPR_PDSM_DIMM_FATAL 3
|
||||
|
||||
/*
|
||||
* Struct exchanged between kernel & ndctl in for PAPR_PDSM_HEALTH
|
||||
* Various flags indicate the health status of the dimm.
|
||||
*
|
||||
* extension_flags : Any extension fields present in the struct.
|
||||
* dimm_unarmed : Dimm not armed. So contents wont persist.
|
||||
* dimm_bad_shutdown : Previous shutdown did not persist contents.
|
||||
* dimm_bad_restore : Contents from previous shutdown werent restored.
|
||||
* dimm_scrubbed : Contents of the dimm have been scrubbed.
|
||||
* dimm_locked : Contents of the dimm cant be modified until CEC reboot
|
||||
* dimm_encrypted : Contents of dimm are encrypted.
|
||||
* dimm_health : Dimm health indicator. One of PAPR_PDSM_DIMM_XXXX
|
||||
*/
|
||||
struct nd_papr_pdsm_health {
|
||||
union {
|
||||
struct {
|
||||
__u32 extension_flags;
|
||||
__u8 dimm_unarmed;
|
||||
__u8 dimm_bad_shutdown;
|
||||
__u8 dimm_bad_restore;
|
||||
__u8 dimm_scrubbed;
|
||||
__u8 dimm_locked;
|
||||
__u8 dimm_encrypted;
|
||||
__u16 dimm_health;
|
||||
};
|
||||
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE];
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Methods to be embedded in ND_CMD_CALL request. These are sent to the kernel
|
||||
* via 'nd_cmd_pkg.nd_command' member of the ioctl struct
|
||||
*/
|
||||
enum papr_pdsm {
|
||||
PAPR_PDSM_MIN = 0x0,
|
||||
PAPR_PDSM_HEALTH,
|
||||
PAPR_PDSM_MAX,
|
||||
};
|
||||
|
||||
/* Maximal union that can hold all possible payload types */
|
||||
union nd_pdsm_payload {
|
||||
struct nd_papr_pdsm_health health;
|
||||
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE];
|
||||
} __packed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user