On Fri, Jul 31, 2026 at 01:48:13AM -0700, Anisa Su wrote:
> From: Ira Weiny <[email protected]>
>
> Device partitions have an implied order which is made more complex by
> the addition of a dynamic partition
>
> Remove the ram special case information calls in favor of generic calls
> with a check ahead of time to ensure the preservation of the implied
> partition order.
Hi Anisa,
I think the changelog needs more explanation here. It says there is an
"implied partition order", that is made "more complex by the addition
of a dynamic partition" but never explains what that order is, where it
comes from, or that this patch starts enforcing it.
I jumped to the diff thinking it must be there, but nope. If I
am remembering correctly we've had ascii art for this layouts
so I'm surprised that's not here.
After this patch, the code relies on the numeric ordering of
enum cxl_partition_mode. That seems worth documenting, perhaps alongside
the enum itself.
A bit more below-
skip
> @@ -457,6 +457,7 @@ static const char *cxl_mode_name(enum cxl_partition_mode
> mode)
> int cxl_dpa_setup(struct cxl_dev_state *cxlds, const struct cxl_dpa_info
> *info)
> {
> struct device *dev = cxlds->dev;
> + int i;
>
> guard(rwsem_write)(&cxl_rwsem.dpa);
>
> @@ -469,9 +470,17 @@ int cxl_dpa_setup(struct cxl_dev_state *cxlds, const
> struct cxl_dpa_info *info)
> return 0;
> }
>
> + /* Verify partitions are in expected order. */
> + for (i = 1; i < info->nr_partitions; i++) {
Just 'int i' above. Sharing that index is not worth the extra diff.
> + if (info->part[i].mode < info->part[i - 1].mode) {
> + dev_err(dev, "Partition order mismatch\n");
A bit minimalist err message. Do we have more useful info to add?
> + return -EINVAL;
> + }
> + }
> +
> cxlds->dpa_res = DEFINE_RES_MEM(0, info->size);
>
> - for (int i = 0; i < info->nr_partitions; i++) {
> + for (i = 0; i < info->nr_partitions; i++) {
> const struct cxl_dpa_part_info *part = &info->part[i];
> int rc;
snip