^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) menuconfig LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) tristate "NVDIMM (Non-Volatile Memory Device) Support"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) depends on PHYS_ADDR_T_64BIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) depends on HAS_IOMEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) depends on BLK_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) select MEMREGION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) Generic support for non-volatile memory devices including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) ACPI-6-NFIT defined resources. On platforms that define an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) NFIT, or otherwise can discover NVDIMM resources, a libnvdimm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) bus is registered to advertise PMEM (persistent memory)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) namespaces (/dev/pmemX) and BLK (sliding mmio window(s))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) namespaces (/dev/ndblkX.Y). A PMEM namespace refers to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) memory resource that may span multiple DIMMs and support DAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) (see CONFIG_DAX). A BLK namespace refers to an NVDIMM control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) region which exposes an mmio register set for windowed access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) mode to non-volatile memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) if LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) config BLK_DEV_PMEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) tristate "PMEM: Persistent memory block device support"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) default LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) select DAX_DRIVER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) select ND_BTT if BTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) select ND_PFN if NVDIMM_PFN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Memory ranges for PMEM are described by either an NFIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) (NVDIMM Firmware Interface Table, see CONFIG_NFIT_ACPI), a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) non-standard OEM-specific E820 memory type (type-12, see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) CONFIG_X86_PMEM_LEGACY), or it is manually specified by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 'memmap=nn[KMG]!ss[KMG]' kernel command line (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) Documentation/admin-guide/kernel-parameters.rst). This driver converts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) these persistent memory ranges into block devices that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) capable of DAX (direct-access) file system mappings. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) Documentation/driver-api/nvdimm/nvdimm.rst for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Say Y if you want to use an NVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) config ND_BLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) tristate "BLK: Block data window (aperture) device support"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) default LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) select ND_BTT if BTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Support NVDIMMs, or other devices, that implement a BLK-mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) access capability. BLK-mode access uses memory-mapped-i/o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) apertures to access persistent media.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Say Y if your platform firmware emits an ACPI.NFIT table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) (CONFIG_ACPI_NFIT), or otherwise exposes BLK-mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) capabilities.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) config ND_CLAIM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) config ND_BTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) tristate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) config BTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) bool "BTT: Block Translation Table (atomic sector updates)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) default y if LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) select ND_CLAIM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) The Block Translation Table (BTT) provides atomic sector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) update semantics for persistent memory devices, so that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) applications that rely on sector writes not being torn (a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) guarantee that typical disks provide) can continue to do so.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) The BTT manifests itself as an alternate personality for an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) NVDIMM namespace, i.e. a namespace can be in raw mode (pmemX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ndblkX.Y, etc...), or 'sectored' mode, (pmemXs, ndblkX.Ys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) etc...).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) Select Y if unsure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) config ND_PFN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) tristate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) config NVDIMM_PFN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) bool "PFN: Map persistent (device) memory"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) default LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) depends on ZONE_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) select ND_CLAIM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) Map persistent memory, i.e. advertise it to the memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) management sub-system. By default persistent memory does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) not support direct I/O, RDMA, or any other usage that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) requires a 'struct page' to mediate an I/O request. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) driver allocates and initializes the infrastructure needed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) to support those use cases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) Select Y if unsure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) config NVDIMM_DAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) bool "NVDIMM DAX: Raw access to persistent memory"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) default LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) depends on NVDIMM_PFN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) Support raw device dax access to a persistent memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) namespace. For environments that want to hard partition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) persistent memory, this capability provides a mechanism to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) sub-divide a namespace into character devices that can only be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) accessed via DAX (mmap(2)).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) Select Y if unsure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) config OF_PMEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) tristate "Device-tree support for persistent memory regions"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) depends on OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) default LIBNVDIMM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) Allows regions of persistent memory to be described in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) device-tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) Select Y if unsure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) config NVDIMM_KEYS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) def_bool y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) depends on ENCRYPTED_KEYS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) depends on (LIBNVDIMM=ENCRYPTED_KEYS) || LIBNVDIMM=m
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) config NVDIMM_TEST_BUILD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) tristate "Build the unit test core"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) depends on m
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) depends on COMPILE_TEST && X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) default m if COMPILE_TEST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Build the core of the unit test infrastructure. The result of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) this build is non-functional for unit test execution, but it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) otherwise helps catch build errors induced by changes to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) core devm_memremap_pages() implementation and other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) infrastructure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) endif