• Vaibhav Jain's avatar
    ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods · f517f792
    Vaibhav Jain authored
    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.
    Signed-off-by: default avatarVaibhav 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-6-vaibhav@linux.ibm.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    f517f792
papr_pdsm.h 3.55 KB