18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_cimenuconfig LIBNVDIMM
38c2ecf20Sopenharmony_ci	tristate "NVDIMM (Non-Volatile Memory Device) Support"
48c2ecf20Sopenharmony_ci	depends on PHYS_ADDR_T_64BIT
58c2ecf20Sopenharmony_ci	depends on HAS_IOMEM
68c2ecf20Sopenharmony_ci	depends on BLK_DEV
78c2ecf20Sopenharmony_ci	select MEMREGION
88c2ecf20Sopenharmony_ci	help
98c2ecf20Sopenharmony_ci	  Generic support for non-volatile memory devices including
108c2ecf20Sopenharmony_ci	  ACPI-6-NFIT defined resources.  On platforms that define an
118c2ecf20Sopenharmony_ci	  NFIT, or otherwise can discover NVDIMM resources, a libnvdimm
128c2ecf20Sopenharmony_ci	  bus is registered to advertise PMEM (persistent memory)
138c2ecf20Sopenharmony_ci	  namespaces (/dev/pmemX) and BLK (sliding mmio window(s))
148c2ecf20Sopenharmony_ci	  namespaces (/dev/ndblkX.Y). A PMEM namespace refers to a
158c2ecf20Sopenharmony_ci	  memory resource that may span multiple DIMMs and support DAX
168c2ecf20Sopenharmony_ci	  (see CONFIG_DAX).  A BLK namespace refers to an NVDIMM control
178c2ecf20Sopenharmony_ci	  region which exposes an mmio register set for windowed access
188c2ecf20Sopenharmony_ci	  mode to non-volatile memory.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciif LIBNVDIMM
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciconfig BLK_DEV_PMEM
238c2ecf20Sopenharmony_ci	tristate "PMEM: Persistent memory block device support"
248c2ecf20Sopenharmony_ci	default LIBNVDIMM
258c2ecf20Sopenharmony_ci	select DAX_DRIVER
268c2ecf20Sopenharmony_ci	select ND_BTT if BTT
278c2ecf20Sopenharmony_ci	select ND_PFN if NVDIMM_PFN
288c2ecf20Sopenharmony_ci	help
298c2ecf20Sopenharmony_ci	  Memory ranges for PMEM are described by either an NFIT
308c2ecf20Sopenharmony_ci	  (NVDIMM Firmware Interface Table, see CONFIG_NFIT_ACPI), a
318c2ecf20Sopenharmony_ci	  non-standard OEM-specific E820 memory type (type-12, see
328c2ecf20Sopenharmony_ci	  CONFIG_X86_PMEM_LEGACY), or it is manually specified by the
338c2ecf20Sopenharmony_ci	  'memmap=nn[KMG]!ss[KMG]' kernel command line (see
348c2ecf20Sopenharmony_ci	  Documentation/admin-guide/kernel-parameters.rst).  This driver converts
358c2ecf20Sopenharmony_ci	  these persistent memory ranges into block devices that are
368c2ecf20Sopenharmony_ci	  capable of DAX (direct-access) file system mappings.  See
378c2ecf20Sopenharmony_ci	  Documentation/driver-api/nvdimm/nvdimm.rst for more details.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	  Say Y if you want to use an NVDIMM
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciconfig ND_BLK
428c2ecf20Sopenharmony_ci	tristate "BLK: Block data window (aperture) device support"
438c2ecf20Sopenharmony_ci	default LIBNVDIMM
448c2ecf20Sopenharmony_ci	select ND_BTT if BTT
458c2ecf20Sopenharmony_ci	help
468c2ecf20Sopenharmony_ci	  Support NVDIMMs, or other devices, that implement a BLK-mode
478c2ecf20Sopenharmony_ci	  access capability.  BLK-mode access uses memory-mapped-i/o
488c2ecf20Sopenharmony_ci	  apertures to access persistent media.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	  Say Y if your platform firmware emits an ACPI.NFIT table
518c2ecf20Sopenharmony_ci	  (CONFIG_ACPI_NFIT), or otherwise exposes BLK-mode
528c2ecf20Sopenharmony_ci	  capabilities.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciconfig ND_CLAIM
558c2ecf20Sopenharmony_ci	bool
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciconfig ND_BTT
588c2ecf20Sopenharmony_ci	tristate
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciconfig BTT
618c2ecf20Sopenharmony_ci	bool "BTT: Block Translation Table (atomic sector updates)"
628c2ecf20Sopenharmony_ci	default y if LIBNVDIMM
638c2ecf20Sopenharmony_ci	select ND_CLAIM
648c2ecf20Sopenharmony_ci	help
658c2ecf20Sopenharmony_ci	  The Block Translation Table (BTT) provides atomic sector
668c2ecf20Sopenharmony_ci	  update semantics for persistent memory devices, so that
678c2ecf20Sopenharmony_ci	  applications that rely on sector writes not being torn (a
688c2ecf20Sopenharmony_ci	  guarantee that typical disks provide) can continue to do so.
698c2ecf20Sopenharmony_ci	  The BTT manifests itself as an alternate personality for an
708c2ecf20Sopenharmony_ci	  NVDIMM namespace, i.e. a namespace can be in raw mode (pmemX,
718c2ecf20Sopenharmony_ci	  ndblkX.Y, etc...), or 'sectored' mode, (pmemXs, ndblkX.Ys,
728c2ecf20Sopenharmony_ci	  etc...).
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	  Select Y if unsure
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciconfig ND_PFN
778c2ecf20Sopenharmony_ci	tristate
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciconfig NVDIMM_PFN
808c2ecf20Sopenharmony_ci	bool "PFN: Map persistent (device) memory"
818c2ecf20Sopenharmony_ci	default LIBNVDIMM
828c2ecf20Sopenharmony_ci	depends on ZONE_DEVICE
838c2ecf20Sopenharmony_ci	select ND_CLAIM
848c2ecf20Sopenharmony_ci	help
858c2ecf20Sopenharmony_ci	  Map persistent memory, i.e. advertise it to the memory
868c2ecf20Sopenharmony_ci	  management sub-system.  By default persistent memory does
878c2ecf20Sopenharmony_ci	  not support direct I/O, RDMA, or any other usage that
888c2ecf20Sopenharmony_ci	  requires a 'struct page' to mediate an I/O request.  This
898c2ecf20Sopenharmony_ci	  driver allocates and initializes the infrastructure needed
908c2ecf20Sopenharmony_ci	  to support those use cases.
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	  Select Y if unsure
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciconfig NVDIMM_DAX
958c2ecf20Sopenharmony_ci	bool "NVDIMM DAX: Raw access to persistent memory"
968c2ecf20Sopenharmony_ci	default LIBNVDIMM
978c2ecf20Sopenharmony_ci	depends on NVDIMM_PFN
988c2ecf20Sopenharmony_ci	help
998c2ecf20Sopenharmony_ci	  Support raw device dax access to a persistent memory
1008c2ecf20Sopenharmony_ci	  namespace.  For environments that want to hard partition
1018c2ecf20Sopenharmony_ci	  persistent memory, this capability provides a mechanism to
1028c2ecf20Sopenharmony_ci	  sub-divide a namespace into character devices that can only be
1038c2ecf20Sopenharmony_ci	  accessed via DAX (mmap(2)).
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	  Select Y if unsure
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciconfig OF_PMEM
1088c2ecf20Sopenharmony_ci	tristate "Device-tree support for persistent memory regions"
1098c2ecf20Sopenharmony_ci	depends on OF
1108c2ecf20Sopenharmony_ci	default LIBNVDIMM
1118c2ecf20Sopenharmony_ci	help
1128c2ecf20Sopenharmony_ci	  Allows regions of persistent memory to be described in the
1138c2ecf20Sopenharmony_ci	  device-tree.
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci	  Select Y if unsure.
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ciconfig NVDIMM_KEYS
1188c2ecf20Sopenharmony_ci	def_bool y
1198c2ecf20Sopenharmony_ci	depends on ENCRYPTED_KEYS
1208c2ecf20Sopenharmony_ci	depends on (LIBNVDIMM=ENCRYPTED_KEYS) || LIBNVDIMM=m
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ciconfig NVDIMM_TEST_BUILD
1238c2ecf20Sopenharmony_ci	tristate "Build the unit test core"
1248c2ecf20Sopenharmony_ci	depends on m
1258c2ecf20Sopenharmony_ci	depends on COMPILE_TEST && X86_64
1268c2ecf20Sopenharmony_ci	default m if COMPILE_TEST
1278c2ecf20Sopenharmony_ci	help
1288c2ecf20Sopenharmony_ci	  Build the core of the unit test infrastructure. The result of
1298c2ecf20Sopenharmony_ci	  this build is non-functional for unit test execution, but it
1308c2ecf20Sopenharmony_ci	  otherwise helps catch build errors induced by changes to the
1318c2ecf20Sopenharmony_ci	  core devm_memremap_pages() implementation and other
1328c2ecf20Sopenharmony_ci	  infrastructure.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ciendif
135