cxl/pmem: Translate NVDIMM label commands to CXL label commands
authorDan Williams <dan.j.williams@intel.com>
Thu, 9 Sep 2021 22:08:15 +0000 (15:08 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 21 Sep 2021 20:47:09 +0000 (13:47 -0700)
commit60b8f17215de1e6551fec4e942494c3832c3e98b
tree802c833e9e63a97976a225baf50b660509c1e9fd
parent12f3856ad42d6ce0dbd4266e105c04ae999f908c
cxl/pmem: Translate NVDIMM label commands to CXL label commands

The LIBNVDIMM IOCTL UAPI calls back to the nvdimm-bus-provider to
translate the Linux command payload to the device native command format.
The LIBNVDIMM commands get-config-size, get-config-data, and
set-config-data, map to the CXL memory device commands device-identify,
get-lsa, and set-lsa. Recall that the label-storage-area (LSA) on an
NVDIMM device arranges for the provisioning of namespaces. Additionally
for CXL the LSA is used for provisioning regions as well.

The data from device-identify is already cached in the 'struct cxl_mem'
instance associated with @cxl_nvd, so that payload return is simply
crafted and no CXL command is issued. The conversion for get-lsa is
straightforward, but the conversion for set-lsa requires an allocation
to append the set-lsa header in front of the payload.

Reviewed-by: Ben Widawsky <ben.widawsky@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163122524923.2534512.9431316965424264864.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/pmem.c