dan.j.williams@ wrote:
[..]
> If the goal is: "I want to give device-dax a point at which it can make
> a go / no-go decision about whether the CXL subsystem has properly
> assembled all CXL regions implied by Soft Reserved instersecting with
> CXL Windows." Then that is something like the below, only lightly tested
> and likely regresses the non-CXL case.
> 
> -- 8< --
> From 48b25461eca050504cf5678afd7837307b2dd14f Mon Sep 17 00:00:00 2001
> From: Dan Williams <dan.j.willi...@intel.com>
> Date: Tue, 22 Jul 2025 16:11:08 -0700
> Subject: [RFC PATCH] dax/cxl: Defer Soft Reserved registration

Likely needs this incremental change to prevent DEV_DAX_HMEM from being
built-in when CXL is not. This still leaves the awkward scenario of CXL
enabled, DEV_DAX_CXL disabled, and DEV_DAX_HMEM built-in. I believe that
safely fails in devdax only / fallback mode, but something to
investigate when respinning on top of this.

-- 8< --
diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig
index d656e4c0eb84..3683bb3f2311 100644
--- a/drivers/dax/Kconfig
+++ b/drivers/dax/Kconfig
@@ -48,6 +48,8 @@ config DEV_DAX_CXL
        tristate "CXL DAX: direct access to CXL RAM regions"
        depends on CXL_BUS && CXL_REGION && DEV_DAX
        default CXL_REGION && DEV_DAX
+       depends on CXL_ACPI >= DEV_DAX_HMEM
+       depends on CXL_PCI >= DEV_DAX_HMEM
        help
          CXL RAM regions are either mapped by platform-firmware
          and published in the initial system-memory map as "System RAM", mapped
diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c
index 0916478e3817..8bcd104111a8 100644
--- a/drivers/dax/hmem/hmem.c
+++ b/drivers/dax/hmem/hmem.c
@@ -103,7 +103,7 @@ static int hmem_register_device(struct device *host, int 
target_nid,
        long id;
        int rc;
 
-       if (IS_ENABLED(CONFIG_CXL_REGION) &&
+       if (IS_ENABLED(CONFIG_DEV_DAX_CXL) &&
            region_intersects(res->start, resource_size(res), IORESOURCE_MEM,
                              IORES_DESC_CXL) != REGION_DISJOINT) {
                switch (dax_cxl_mode) {
@@ -209,7 +209,7 @@ static __init int dax_hmem_init(void)
         * CXL topology discovery at least once before scanning the
         * iomem resource tree for IORES_DESC_CXL resources.
         */
-       if (IS_ENABLED(CONFIG_CXL_REGION)) {
+       if (IS_ENABLED(CONFIG_DEV_DAX_CXL)) {
                request_module("cxl_acpi");
                request_module("cxl_pci");
        }

Reply via email to