Introduce support for PAPR NVDIMM Specific Methods (PDSM) in papr_scm module and add the command family NVDIMM_FAMILY_PAPR to the white list of NVDIMM command sets. Also advertise support for ND_CMD_CALL for the nvdimm command mask and implement necessary scaffolding in the module to handle ND_CMD_CALL ioctl and PDSM requests that we receive. The layout of the PDSM request as we expect from libnvdimm/libndctl is described in newly introduced uapi header 'papr_pdsm.h' which defines a 'struct nd_pkg_pdsm' and a maximal union named 'nd_pdsm_payload'. These new structs together with 'struct nd_cmd_pkg' for a pdsm envelop thats sent by libndctl to libnvdimm and serviced by papr_scm in 'papr_scm_service_pdsm()'. The PDSM request is communicated by member 'struct nd_cmd_pkg.nd_command' together with other information on the pdsm payload (size-in, size-out). The patch also introduces 'struct pdsm_cmd_desc' instances of which are stored in an array __pdsm_cmd_descriptors[] indexed with PDSM cmd and corresponding access function pdsm_cmd_desc() is introduced. 'struct pdsm_cdm_desc' holds the service function for a given PDSM and corresponding payload in/out sizes. A new function papr_scm_service_pdsm() is introduced and is called from papr_scm_ndctl() in case of a PDSM request is received via ND_CMD_CALL command from libnvdimm. The function performs validation on the PDSM payload based on info present in corresponding PDSM descriptor and if valid calls the 'struct pdcm_cmd_desc.service' function to service the PDSM.
Showing the changes to include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -244,6 +244,7 @@ struct nd_cmd_pkg { · 243 unmodified lines | ||
| 244 | 244 | #define NVDIMM_FAMILY_HPE2 2 |
| 245 | 245 | #define NVDIMM_FAMILY_MSFT 3 |
| 246 | 246 | #define NVDIMM_FAMILY_HYPERV 4 |
| 247 | +#define NVDIMM_FAMILY_PAPR 5 | |
| 247 | 248 | |
| 248 | 249 | #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL,\ |
| 249 | 250 | struct nd_cmd_pkg) |