cxl/mem: Account for partitionable space in ram/pmem ranges
authorIra Weiny <ira.weiny@intel.com>
Tue, 10 Aug 2021 18:57:59 +0000 (11:57 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 10 Aug 2021 18:57:59 +0000 (11:57 -0700)
commitf847502ad8e3299e7ad256aa0bd7eaf184646117
treec36f2992630f1d6ec8bd6c12ccd926af02e00a41
parent0b9159d0ff21bc281dbb9ede06ad566330ac0943
cxl/mem: Account for partitionable space in ram/pmem ranges

Memory devices may specify volatile only, persistent only, and
partitionable space which when added together result in a total capacity.

If Identify Memory Device.Partition Alignment != 0 the device supports
partitionable space.  This partitionable space can be split between
volatile and persistent space.  The total volatile and persistent sizes
are reported in Get Partition Info.  ie

active volatile memory = volatile only + partitionable volatile
active persistent memory = persistent only + partitionable persistent

Define cxl_mem_get_partition(), check for partitionable support, and use
cxl_mem_get_partition() if applicable.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/cxlmem.h
drivers/cxl/pci.c