[RFC PATCH 09/11] nvdimm/ramdax: support binding extmem platform devices

Suseendran Bhaskaran suseendranb at google.com
Tue Dec 1 16:19:44 PST 2026


Block-backed fsdax filesystems (such as XFS or ext4 mounted with -o dax)
need /dev/pmemX block devices on the libnvdimm bus rather than character
drivers/dax devices.

Allow CONFIG_RAMDAX when CONFIG_EXTMEM is enabled (including x86_64
configs without X86_PMEM_LEGACY or OF) and match "extmem" platform
devices via driver_override alongside OF pmem-region and e820_pmem (also
enabling ACPI arm64 hosts), registering each IORESOURCE_MEM range as a
labeled NVDIMM DIMM.

Signed-off-by: Suseendran Bhaskaran <suseendranb at google.com>
---
 Documentation/admin-guide/kernel-parameters.txt |  4 +++-
 drivers/nvdimm/Kconfig                          | 14 +++++++-------
 drivers/nvdimm/ramdax.c                         |  7 ++++---
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index e75b35d9a66b..d25265bb0095 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1704,7 +1704,9 @@ Kernel parameters
 			dax_hmem matches "extmem" devices by default, exposing
 			device_dax instances at PUD or PMD alignment (configurable
 			via daxctl, or left idle at boot with
-			dax_hmem.region_idle=1).
+			dax_hmem.region_idle=1). Regions can also be bound to the
+			ramdax driver via driver_override to expose libnvdimm
+			/dev/pmemX block devices for fsdax filesystems.
 			<align> defaults to and must be at least the sparsemem
 			section size (128 MiB on 4K/16K pages, 512 MiB on 64K
 			pages), and <size> must be a multiple of <align>.
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 33d83623bfc0..2a094ed1dba0 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -99,21 +99,21 @@ config OF_PMEM
 
 config RAMDAX
 	tristate "Support persistent memory interfaces on RAM carveouts"
-	depends on X86_PMEM_LEGACY || OF || COMPILE_TEST
+	depends on X86_PMEM_LEGACY || OF || EXTMEM || COMPILE_TEST
 	select NUMA_KEEP_MEMINFO if NUMA_MEMBLKS
 	default LIBNVDIMM
 	help
 	  Allows creation of DAX devices on RAM carveouts.
 
 	  Memory ranges that are manually specified by the
-	  'memmap=nn[KMG]!ss[KMG]' kernel command line or defined by dummy
-	  pmem-region device tree nodes would be managed by this driver as DIMM
-	  devices with support for dynamic layout of namespaces.
-	  The driver steals 128K in the end of the memmap range for the
+	  'memmap=nn[KMG]!ss[KMG]' or 'extmem=' kernel command line or defined
+	  by dummy pmem-region device tree nodes would be managed by this driver
+	  as DIMM devices with support for dynamic layout of namespaces.
+	  The driver steals 128K in the end of the range for the
 	  namespace management. This allows supporting up to 509 namespaces
 	  (see 'ndctl create-namespace --help').
-	  The driver should be force bound to e820_pmem or pmem-region platform
-	  devices using 'driver_override' device attribute.
+	  The driver should be force bound to e820_pmem, extmem, or pmem-region
+	  platform devices using 'driver_override' device attribute.
 
 	  Select N if unsure.
 
diff --git a/drivers/nvdimm/ramdax.c b/drivers/nvdimm/ramdax.c
index 4efffc3ee5a0..4fb90e8cc018 100644
--- a/drivers/nvdimm/ramdax.c
+++ b/drivers/nvdimm/ramdax.c
@@ -206,7 +206,8 @@ static int ramdax_probe(struct platform_device *pdev)
 	if (np) {
 		if (!of_match_node(ramdax_of_matches, np))
 			return -ENODEV;
-	} else if (strcmp(pdev->name, "e820_pmem") != 0) {
+	} else if (strcmp(pdev->name, "extmem") != 0 &&
+		   strcmp(pdev->name, "e820_pmem") != 0) {
 		return -ENODEV;
 	}
 
@@ -224,7 +225,7 @@ static int ramdax_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, nvdimm_bus);
 
-	if (np) {
+	if (np || strcmp(pdev->name, "extmem") == 0) {
 		for (unsigned int i = 0; i < pdev->num_resources; i++) {
 			if (resource_type(&pdev->resource[i]) != IORESOURCE_MEM)
 				continue;
@@ -253,6 +254,6 @@ static struct platform_driver ramdax_driver = {
 
 module_platform_driver(ramdax_driver);
 
-MODULE_DESCRIPTION("NVDIMM support for e820 type-12 memory and OF pmem-region");
+MODULE_DESCRIPTION("NVDIMM support for e820 type-12, OF pmem-region, and extmem");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Microsoft Corporation");



More information about the linux-arm-kernel mailing list