Message ID | 20240222210612.15689-1-hongjian.fan@seagate.com |
---|---|
State | New |
Headers | show |
Series | Defer dax when CXL window is the child of the soft reserve region | expand |
On Thu, Feb 22, 2024 at 03:06:12PM -0600, Hongjian Fan wrote: > On some platforms, UEFI would present a single soft reserved entry in BIOS-e820 for multiple CXL deivces. cxl_acpi would add the CXL windows as the children of the soft reserved region. > This change would allow proper deffering dax device creation to cxl region when CXL window is the child of the soft reserved region. Can you explain more about how this appears as an issue. The word 'defer' is typically used to say that we are postponing something and will do it later. Is that the case here? Thanks for helping me understand, Alison > > > Signed-off-by: Hongjian Fan <hongjian.fan@seagate.com> > --- > drivers/dax/hmem/hmem.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c > index 5d2ddef0f..a57b6ae09 100644 > --- a/drivers/dax/hmem/hmem.c > +++ b/drivers/dax/hmem/hmem.c > @@ -58,6 +58,11 @@ static void release_hmem(void *pdev) > platform_device_unregister(pdev); > } > > +static int is_cxl_window(struct resource *res, void *arg) > +{ > + return 1; > +} > + > static int hmem_register_device(struct device *host, int target_nid, > const struct resource *res) > { > @@ -67,8 +72,8 @@ static int hmem_register_device(struct device *host, int target_nid, > int rc; > > if (IS_ENABLED(CONFIG_CXL_REGION) && > - region_intersects(res->start, resource_size(res), IORESOURCE_MEM, > - IORES_DESC_CXL) != REGION_DISJOINT) { > + walk_iomem_res_desc(IORES_DESC_CXL,IORESOURCE_MEM, res->start, > + res->end, NULL, is_cxl_window)) { > dev_dbg(host, "deferring range to CXL: %pr\n", res); > return 0; > } > -- > 2.34.1 >
Hi Alison, > Seagate Internal > On Thu, Feb 22, 2024 at 03:06:12PM -0600, Hongjian Fan wrote: > > On some platforms, UEFI would present a single soft reserved entry in BIOS-e820 for multiple CXL deivces. cxl_acpi would add the CXL windows as the children of the soft reserved region. > > This change would allow proper deffering dax device creation to cxl region when CXL window is the child of the soft reserved region. > > > Can you explain more about how this appears as an issue. > > The word 'defer' is typically used to say that we are postponing > something and will do it later. Is that the case here? Normally dax region is created by hmem module. But when CONFIG_CXL_REGION is enabled, cxl module creates and manages the dax region if it is marked as a CXL window. This means that the hmem module needs to skip the CXL window, and let the cxl_pci module to do it later. The issue here is when multiple CXL devices are attached to the host server, the CXL window resource might be inserted as a child of the soft reserved region in IO resource map. In this case, the original code will not skip ( defer ) it. The dax region is still created, by hmem module, but not the cxl module. The CXL module will not be able to manage this dax region. Thanks, Hongjian > > Thanks for helping me understand, > Alison
diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c index 5d2ddef0f..a57b6ae09 100644 --- a/drivers/dax/hmem/hmem.c +++ b/drivers/dax/hmem/hmem.c @@ -58,6 +58,11 @@ static void release_hmem(void *pdev) platform_device_unregister(pdev); } +static int is_cxl_window(struct resource *res, void *arg) +{ + return 1; +} + static int hmem_register_device(struct device *host, int target_nid, const struct resource *res) { @@ -67,8 +72,8 @@ static int hmem_register_device(struct device *host, int target_nid, int rc; if (IS_ENABLED(CONFIG_CXL_REGION) && - region_intersects(res->start, resource_size(res), IORESOURCE_MEM, - IORES_DESC_CXL) != REGION_DISJOINT) { + walk_iomem_res_desc(IORES_DESC_CXL,IORESOURCE_MEM, res->start, + res->end, NULL, is_cxl_window)) { dev_dbg(host, "deferring range to CXL: %pr\n", res); return 0; }
On some platforms, UEFI would present a single soft reserved entry in BIOS-e820 for multiple CXL deivces. cxl_acpi would add the CXL windows as the children of the soft reserved region. This change would allow proper deffering dax device creation to cxl region when CXL window is the child of the soft reserved region. Signed-off-by: Hongjian Fan <hongjian.fan@seagate.com> --- drivers/dax/hmem/hmem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)