Messages in this thread | | | Date | Tue, 9 Apr 2024 21:35:40 -0700 | From | Ira Weiny <> | Subject | Re: [PATCH 09/26] cxl/region: Add Dynamic Capacity CXL region support |
| |
Dave Jiang wrote: > > > On 3/24/24 4:18 PM, ira.weiny@intel.com wrote: > > From: Navneet Singh <navneet.singh@intel.com> > >
[snip]
> > > > -What: /sys/bus/cxl/devices/decoderX.Y/create_{pmem,ram}_region > > -Date: May, 2022, January, 2023 > > -KernelVersion: v6.0 (pmem), v6.3 (ram) > > +What: /sys/bus/cxl/devices/decoderX.Y/create_{pmem,ram,dc}_region > > +Date: May, 2022, January, 2023, June 2024 > > +KernelVersion: v6.0 (pmem), v6.3 (ram), v6.10 (dc) > > Contact: linux-cxl@vger.kernel.org > > Description: > > (RW) Write a string in the form 'regionZ' to start the process > > - of defining a new persistent, or volatile memory region > > - (interleave-set) within the decode range bounded by root decoder > > - 'decoderX.Y'. The value written must match the current value > > - returned from reading this attribute. An atomic compare exchange > > - operation is done on write to assign the requested id to a > > - region and allocate the region-id for the next creation attempt. > > - EBUSY is returned if the region name written does not match the > > - current cached value. > > + of defining a new persistent, volatile, or Dynamic Capacity > > + (DC) memory region (interleave-set) within the decode range > > + bounded by root decoder 'decoderX.Y'. The value written must > > + match the current value returned from reading this attribute. > > + An atomic compare exchange operation is done on write to assign > > + the requested id to a region and allocate the region-id for the > > + next creation attempt. EBUSY is returned if the region name > > -EBUSY? >
To match the other documentation I would say no. The other docs show ENXIO/EBUSY/EINVAL without the negative indicator.
[snip]
> > diff --git a/drivers/dax/cxl.c b/drivers/dax/cxl.c > > index c696837ab23c..415d03fbf9b6 100644 > > --- a/drivers/dax/cxl.c > > +++ b/drivers/dax/cxl.c > > @@ -13,19 +13,30 @@ static int cxl_dax_region_probe(struct device *dev) > > struct cxl_region *cxlr = cxlr_dax->cxlr; > > struct dax_region *dax_region; > > struct dev_dax_data data; > > + resource_size_t dev_size; > > + unsigned long flags; > > > > if (nid == NUMA_NO_NODE) > > nid = memory_add_physaddr_to_nid(cxlr_dax->hpa_range.start); > > > > + flags = IORESOURCE_DAX_KMEM; > > + if (cxlr->mode == CXL_REGION_DC) > > + flags |= IORESOURCE_DAX_SPARSE_CAP; > > + > > dax_region = alloc_dax_region(dev, cxlr->id, &cxlr_dax->hpa_range, nid, > > - PMD_SIZE, IORESOURCE_DAX_KMEM); > > + PMD_SIZE, flags); > > if (!dax_region) > > return -ENOMEM; > > > > + dev_size = range_len(&cxlr_dax->hpa_range); > > + /* Add empty seed dax device */ > > + if (cxlr->mode == CXL_REGION_DC) > > + dev_size = 0; > > Nit. Just do if/else so dev_size isn't set twice if mode is DC.
Ok yea.
Ira
| |