]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxl: Make region type based on endpoint type
authorAlejandro Lucero <alucerop@amd.com>
Sat, 28 Feb 2026 17:36:01 +0000 (17:36 +0000)
committerDave Jiang <dave.jiang@intel.com>
Mon, 16 Mar 2026 23:31:56 +0000 (16:31 -0700)
Current code is expecting Type3 or CXL_DECODER_HOSTONLYMEM devices only.
Support for Type2 implies region type needs to be based on the endpoint
type HDM-D[B] instead.

Signed-off-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Davidlohr Bueso <daves@stgolabs.net>
Reviewed-by: Gregory Price <gourry@gourry.net>
Tested-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://patch.msgid.link/20260228173603.1125109-2-alejandro.lucero-palau@amd.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c

index 42874948b589b95a498230a93f5951f30317c0eb..d1ce4deae4996e22f7dc7db86ef73cd688cd5121 100644 (file)
@@ -2650,7 +2650,8 @@ static ssize_t create_ram_region_show(struct device *dev,
 }
 
 static struct cxl_region *__create_region(struct cxl_root_decoder *cxlrd,
-                                         enum cxl_partition_mode mode, int id)
+                                         enum cxl_partition_mode mode, int id,
+                                         enum cxl_decoder_type target_type)
 {
        int rc;
 
@@ -2672,7 +2673,7 @@ static struct cxl_region *__create_region(struct cxl_root_decoder *cxlrd,
                return ERR_PTR(-EBUSY);
        }
 
-       return devm_cxl_add_region(cxlrd, id, mode, CXL_DECODER_HOSTONLYMEM);
+       return devm_cxl_add_region(cxlrd, id, mode, target_type);
 }
 
 static ssize_t create_region_store(struct device *dev, const char *buf,
@@ -2686,7 +2687,7 @@ static ssize_t create_region_store(struct device *dev, const char *buf,
        if (rc != 1)
                return -EINVAL;
 
-       cxlr = __create_region(cxlrd, mode, id);
+       cxlr = __create_region(cxlrd, mode, id, CXL_DECODER_HOSTONLYMEM);
        if (IS_ERR(cxlr))
                return PTR_ERR(cxlr);
 
@@ -3902,7 +3903,8 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
 
        do {
                cxlr = __create_region(cxlrd, cxlds->part[part].mode,
-                                      atomic_read(&cxlrd->region_id));
+                                      atomic_read(&cxlrd->region_id),
+                                      cxled->cxld.target_type);
        } while (IS_ERR(cxlr) && PTR_ERR(cxlr) == -EBUSY);
 
        if (IS_ERR(cxlr)) {