Re: [RFC PATCH 4/4] cxl/region: Introduce cxl_memdev_attach_region

From: Alejandro Lucero Palau

Date: Wed Apr 15 2026 - 08:57:27 EST



On 4/14/26 16:41, Alejandro Lucero Palau wrote:

<snip>

Also, if the cxl_mem unbinding happens after the type2 driver has invoked ioremap, the driver will be using something it should not. Won't it? I do not think that is correct and the type2 driver should somehow get a notification for stopping using such a range, some sort of detach function the cxl core can invoke. That is something I unsuccessfully tried to add in the past:


https://lore.kernel.org/linux-cxl/20250624141355.269056-19-alejandro.lucero-palau@xxxxxxx/



FWIW, in that v17 I add the callback function in here:


https://lore.kernel.org/linux-cxl/20250624141355.269056-21-alejandro.lucero-palau@xxxxxxx/


which gets completed in the last patch for integrating the sfc driver cxl pio buffers unwinding.


I think that is necessary. About this patch, I think it should be part of Type2 series with changes for adding the ioremap to the protected cxl region "attachment". After that the CXL region can be safely used ... until the sfc driver explicitly exits or until the callback is invoked triggered by cxl_acpi removal or cxl_mem unbinding. The sfc driver will safely stop using pio buffers keeping the normal packet sending using DMA.


I'll work on a v26 with these changes.