]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cxl: Make cxl_dpa_alloc() DPA partition number agnostic
authorDan Williams <dan.j.williams@intel.com>
Tue, 4 Feb 2025 04:24:24 +0000 (20:24 -0800)
committerDave Jiang <dave.jiang@intel.com>
Tue, 4 Feb 2025 20:48:19 +0000 (13:48 -0700)
commit991d98f17d31644826977e49477544987000a08a
tree7f3a80e16cf13203f3ca6f8bac36e3534c76ac55
parent8e4c411c533f79407bbc970011aaa73ac602a9d1
cxl: Make cxl_dpa_alloc() DPA partition number agnostic

cxl_dpa_alloc() is a hard coded nest of assumptions around PMEM
allocations being distinct from RAM allocations in specific ways when in
practice the allocation rules are only relative to DPA partition index.

The rules for cxl_dpa_alloc() are:

- allocations can only come from 1 partition

- if allocating at partition-index-N, all free space in partitions less
  than partition-index-N must be skipped over

Use the new 'struct cxl_dpa_partition' array to support allocation with
an arbitrary number of DPA partitions on the device.

A follow-on patch can go further to cleanup 'enum cxl_decoder_mode'
concept and supersede it with looking up the memory properties from
partition metadata. Until then cxl_part_mode() temporarily bridges code
that looks up partitions by @cxled->mode.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Tested-by: Alejandro Lucero <alucerop@amd.com>
Link: https://patch.msgid.link/173864306400.668823.12143134425285426523.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/hdm.c
drivers/cxl/cxlmem.h