Dan Williams wrote: > Region autodiscovery is the process of kernel creating 'struct > cxl_region' object to represent active CXL memory ranges it finds > already active in hardware when the driver loads. Typically this happens > when platform firmware establishes CXL memory regions and then publishes > them in the memory map. However, this can also happen in the case of > kexec-reboot after the kernel has created regions. > > In the autodiscovery case the region creation process starts with a > known endpoint decoder. Refactor attach_target() into a helper that is > suitable to be called from either sysfs, for runtime region creation, or > from cxl_port_probe() after it has enumerated all endpoint decoders. > > The cxl_port_probe() context is an async device-core probing context, so > it is not appropriate to allow SIGTERM to interrupt the assembly > process. Refactor attach_target() to take @cxled and @state as arguments > where @state indicates whether waiting from the region rwsem is > interruptible or not. > > No behavior change is intended. > > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>