162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_cimenuconfig LIBNVDIMM 362306a36Sopenharmony_ci tristate "NVDIMM (Non-Volatile Memory Device) Support" 462306a36Sopenharmony_ci depends on PHYS_ADDR_T_64BIT 562306a36Sopenharmony_ci depends on HAS_IOMEM 662306a36Sopenharmony_ci depends on BLK_DEV 762306a36Sopenharmony_ci select MEMREGION 862306a36Sopenharmony_ci help 962306a36Sopenharmony_ci Generic support for non-volatile memory devices including 1062306a36Sopenharmony_ci ACPI-6-NFIT defined resources. On platforms that define an 1162306a36Sopenharmony_ci NFIT, or otherwise can discover NVDIMM resources, a libnvdimm 1262306a36Sopenharmony_ci bus is registered to advertise PMEM (persistent memory) 1362306a36Sopenharmony_ci namespaces (/dev/pmemX). A PMEM namespace refers to a 1462306a36Sopenharmony_ci memory resource that may span multiple DIMMs and support DAX 1562306a36Sopenharmony_ci (see CONFIG_DAX). 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciif LIBNVDIMM 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciconfig BLK_DEV_PMEM 2062306a36Sopenharmony_ci tristate "PMEM: Persistent memory block device support" 2162306a36Sopenharmony_ci default LIBNVDIMM 2262306a36Sopenharmony_ci select DAX 2362306a36Sopenharmony_ci select ND_BTT if BTT 2462306a36Sopenharmony_ci select ND_PFN if NVDIMM_PFN 2562306a36Sopenharmony_ci help 2662306a36Sopenharmony_ci Memory ranges for PMEM are described by either an NFIT 2762306a36Sopenharmony_ci (NVDIMM Firmware Interface Table, see CONFIG_NFIT_ACPI), a 2862306a36Sopenharmony_ci non-standard OEM-specific E820 memory type (type-12, see 2962306a36Sopenharmony_ci CONFIG_X86_PMEM_LEGACY), or it is manually specified by the 3062306a36Sopenharmony_ci 'memmap=nn[KMG]!ss[KMG]' kernel command line (see 3162306a36Sopenharmony_ci Documentation/admin-guide/kernel-parameters.rst). This driver converts 3262306a36Sopenharmony_ci these persistent memory ranges into block devices that are 3362306a36Sopenharmony_ci capable of DAX (direct-access) file system mappings. See 3462306a36Sopenharmony_ci Documentation/driver-api/nvdimm/nvdimm.rst for more details. 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci Say Y if you want to use an NVDIMM 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciconfig ND_CLAIM 3962306a36Sopenharmony_ci bool 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciconfig ND_BTT 4262306a36Sopenharmony_ci tristate 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciconfig BTT 4562306a36Sopenharmony_ci bool "BTT: Block Translation Table (atomic sector updates)" 4662306a36Sopenharmony_ci default y if LIBNVDIMM 4762306a36Sopenharmony_ci select ND_CLAIM 4862306a36Sopenharmony_ci help 4962306a36Sopenharmony_ci The Block Translation Table (BTT) provides atomic sector 5062306a36Sopenharmony_ci update semantics for persistent memory devices, so that 5162306a36Sopenharmony_ci applications that rely on sector writes not being torn (a 5262306a36Sopenharmony_ci guarantee that typical disks provide) can continue to do so. 5362306a36Sopenharmony_ci The BTT manifests itself as an alternate personality for an 5462306a36Sopenharmony_ci NVDIMM namespace, i.e. a namespace can be in raw mode pmemX, 5562306a36Sopenharmony_ci or 'sectored' mode. 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci Select Y if unsure 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ciconfig ND_PFN 6062306a36Sopenharmony_ci tristate 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ciconfig NVDIMM_PFN 6362306a36Sopenharmony_ci bool "PFN: Map persistent (device) memory" 6462306a36Sopenharmony_ci default LIBNVDIMM 6562306a36Sopenharmony_ci depends on ZONE_DEVICE 6662306a36Sopenharmony_ci select ND_CLAIM 6762306a36Sopenharmony_ci help 6862306a36Sopenharmony_ci Map persistent memory, i.e. advertise it to the memory 6962306a36Sopenharmony_ci management sub-system. By default persistent memory does 7062306a36Sopenharmony_ci not support direct I/O, RDMA, or any other usage that 7162306a36Sopenharmony_ci requires a 'struct page' to mediate an I/O request. This 7262306a36Sopenharmony_ci driver allocates and initializes the infrastructure needed 7362306a36Sopenharmony_ci to support those use cases. 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci Select Y if unsure 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ciconfig NVDIMM_DAX 7862306a36Sopenharmony_ci bool "NVDIMM DAX: Raw access to persistent memory" 7962306a36Sopenharmony_ci default LIBNVDIMM 8062306a36Sopenharmony_ci depends on NVDIMM_PFN 8162306a36Sopenharmony_ci help 8262306a36Sopenharmony_ci Support raw device dax access to a persistent memory 8362306a36Sopenharmony_ci namespace. For environments that want to hard partition 8462306a36Sopenharmony_ci persistent memory, this capability provides a mechanism to 8562306a36Sopenharmony_ci sub-divide a namespace into character devices that can only be 8662306a36Sopenharmony_ci accessed via DAX (mmap(2)). 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci Select Y if unsure 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ciconfig OF_PMEM 9162306a36Sopenharmony_ci tristate "Device-tree support for persistent memory regions" 9262306a36Sopenharmony_ci depends on OF 9362306a36Sopenharmony_ci default LIBNVDIMM 9462306a36Sopenharmony_ci help 9562306a36Sopenharmony_ci Allows regions of persistent memory to be described in the 9662306a36Sopenharmony_ci device-tree. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci Select Y if unsure. 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciconfig NVDIMM_KEYS 10162306a36Sopenharmony_ci def_bool y 10262306a36Sopenharmony_ci depends on ENCRYPTED_KEYS 10362306a36Sopenharmony_ci depends on (LIBNVDIMM=ENCRYPTED_KEYS) || LIBNVDIMM=m 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ciconfig NVDIMM_KMSAN 10662306a36Sopenharmony_ci bool 10762306a36Sopenharmony_ci depends on KMSAN 10862306a36Sopenharmony_ci help 10962306a36Sopenharmony_ci KMSAN, and other memory debug facilities, increase the size of 11062306a36Sopenharmony_ci 'struct page' to contain extra metadata. This collides with 11162306a36Sopenharmony_ci the NVDIMM capability to store a potentially 11262306a36Sopenharmony_ci larger-than-"System RAM" size 'struct page' array in a 11362306a36Sopenharmony_ci reservation of persistent memory rather than limited / 11462306a36Sopenharmony_ci precious DRAM. However, that reservation needs to persist for 11562306a36Sopenharmony_ci the life of the given NVDIMM namespace. If you are using KMSAN 11662306a36Sopenharmony_ci to debug an issue unrelated to NVDIMMs or DAX then say N to this 11762306a36Sopenharmony_ci option. Otherwise, say Y but understand that any namespaces 11862306a36Sopenharmony_ci (with the page array stored pmem) created with this build of 11962306a36Sopenharmony_ci the kernel will permanently reserve and strand excess 12062306a36Sopenharmony_ci capacity compared to the CONFIG_KMSAN=n case. 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci Select N if unsure. 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ciconfig NVDIMM_TEST_BUILD 12562306a36Sopenharmony_ci tristate "Build the unit test core" 12662306a36Sopenharmony_ci depends on m 12762306a36Sopenharmony_ci depends on COMPILE_TEST && X86_64 12862306a36Sopenharmony_ci default m if COMPILE_TEST 12962306a36Sopenharmony_ci help 13062306a36Sopenharmony_ci Build the core of the unit test infrastructure. The result of 13162306a36Sopenharmony_ci this build is non-functional for unit test execution, but it 13262306a36Sopenharmony_ci otherwise helps catch build errors induced by changes to the 13362306a36Sopenharmony_ci core devm_memremap_pages() implementation and other 13462306a36Sopenharmony_ci infrastructure. 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ciconfig NVDIMM_SECURITY_TEST 13762306a36Sopenharmony_ci bool "Enable NVDIMM security unit tests" 13862306a36Sopenharmony_ci depends on NVDIMM_KEYS 13962306a36Sopenharmony_ci help 14062306a36Sopenharmony_ci The NVDIMM and CXL subsystems support unit testing of their device 14162306a36Sopenharmony_ci security state machines. The NVDIMM_SECURITY_TEST option disables CPU 14262306a36Sopenharmony_ci cache maintenance operations around events like secure erase and 14362306a36Sopenharmony_ci overwrite. Also, when enabled, the NVDIMM subsystem core helps the unit 14462306a36Sopenharmony_ci test implement a mock state machine. 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci Select N if unsure. 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ciendif 149