Gregory Price wrote: > On Sun, Feb 05, 2023 at 05:02:56PM -0800, Dan Williams wrote: > > Expand the region creation infrastructure to enable 'ram' > > (volatile-memory) regions. The internals of create_pmem_region_store() > > and create_pmem_region_show() are factored out into helpers > > __create_region() and __create_region_show() for the 'ram' case to > > reuse. > > > > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> > > --- > > [..] > > @@ -305,6 +306,13 @@ static bool can_create_pmem(struct cxl_root_decoder *cxlrd) > > return (cxlrd->cxlsd.cxld.flags & flags) == flags; > > } > > > > +static bool can_create_ram(struct cxl_root_decoder *cxlrd) > > +{ > > + unsigned long flags = CXL_DECODER_F_TYPE3 | CXL_DECODER_F_RAM; > > + > > + return (cxlrd->cxlsd.cxld.flags & flags) == flags; > > +} > > + > > does this collide with either CXL_DECODE_F_ENABLE or CXL_DECODER_F_AUTO? > > I think obviously if it's already enabled creating new regions in a > decoder doesn't make sense, but if F_AUTO is set, does that imply > the region settings cannot be changed? That just cares if the root decoder supports TYPE3 and RAM independent of ENABLE or AUTO. Root decoders are always enabled. The AUTO flag, which is not applicable to root decoders, is just there to hold off userspace racing the attachment of endpoint decoders to a region until the autodiscovery process has completed. Once that completes and the region has been enabled then it can be destroyed to clear AUTO.