On 19/11/25 02:33PM, Dave Jiang wrote:


On 11/19/25 12:52 AM, Neeraj Kumar wrote:
devm_cxl_pmem_add_region() is used to create cxl region based on region
information scanned from LSA.

devm_cxl_add_region() is used to just allocate cxlr and its fields are
filled later by userspace tool using device attributes (*_store()).

Inspiration for devm_cxl_pmem_add_region() is taken from these device
attributes (_store*) calls. It allocates cxlr and fills information
parsed from LSA and calls device_add(&cxlr->dev) to initiate further
region creation porbes

Rename __create_region() to cxl_create_region(), which will be used
in later patch to create cxl region after fetching region information
from LSA.

Signed-off-by: Neeraj Kumar <[email protected]>

small comment below, otherwise
Reviewed-by: Dave Jiang <[email protected]>

Thanks Dave for RB tag.


---
 drivers/cxl/core/core.h   |  12 ++++
 drivers/cxl/core/region.c | 124 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 131 insertions(+), 5 deletions(-)

--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c

+static ssize_t alloc_region_hpa(struct cxl_region *cxlr, u64 size)
+{
+       int rc;
+
+       ACQUIRE(rwsem_write_kill, rwsem)(&cxl_rwsem.region);
+       if ((rc = ACQUIRE_ERR(rwsem_write_kill, &rwsem)))
+               return rc;
+
+       if (!size)
+               return -EINVAL;

Why not do this check before acquiring the lock?

DJ

Fixed it in V5.


Regards,
Neeraj


Reply via email to