The libnvdimm sub-system introduces, in addition to the libnvdimm-core,
4 drivers / enabling modules:

Instantiates an "nvdimm bus" with the core and registers memory devices
(NVDIMMs) enumerated by the ACPI 6.0 NFIT (NVDIMM Firmware Interface
table).  After registering NVDIMMs the NFIT driver then registers
"region" devices.  A libnvdimm-region defines an access mode and the
boundaries of persistent memory media.  A region may span multiple
NVDIMMs that are interleaved by the hardware memory controller.  In
turn, a libnvdimm-region can be carved into a "namespace" device and
bound to the PMEM or BLK driver which will attach a Linux block device
(disk) interface to the memory.

Initially merged in v4.1 this driver for contiguous spans of persistent
memory address ranges is re-worked to drive PMEM-namespaces emitted by
the libnvdimm-core.  In this update the PMEM driver, on x86, gains the
ability to assert that writes to persistent memory have been flushed all
the way through the caches and buffers in the platform to persistent
media.  See memcpy_to_pmem() and wmb_pmem().

This new driver enables access to persistent memory media through "Block
Data Windows" as defined by the NFIT.  The primary difference of this
driver to PMEM is that only a small window of persistent memory is
mapped into system address space at any given point in time.  Per-NVDIMM
windows are reprogrammed at run time, per-I/O, to access different
portions of the media.  BLK-mode, by definition, does not support DAX.

This is a library, optionally consumed by either PMEM or BLK, that
converts a byte-accessible namespace into a disk with atomic sector
update semantics (prevents sector tearing on crash or power loss).  The
sinister aspect of sector tearing is that most applications do not know
they have a atomic sector dependency.  At least today's disk's rarely
ever tear sectors and if they do one almost certainly gets a CRC error
on access.  NVDIMMs will always tear and always silently.  Until an
application is audited to be robust in the presence of sector-tearing
the usage of BTT is recommended.

Thanks to: Ross Zwisler, Jeff Moyer, Vishal Verma, Christoph Hellwig,
Ingo Molnar, Neil Brown, Boaz Harrosh, Robert Elliott, Matthew Wilcox,
Andy Rudoff, Linda Knippers, Toshi Kani, Nicholas Moulin, Rafael
Wysocki, and Bob Moore.
Version: GnuPG v1

arch, x86: pmem api for ensuring durability of persistent memory updates

Based on an original patch by Ross Zwisler [1].

Writes to persistent memory have the potential to be posted to cpu
cache, cpu write buffers, and platform write buffers (memory controller)
before being committed to persistent media.  Provide apis,
memcpy_to_pmem(), wmb_pmem(), and memremap_pmem(), to write data to
pmem and assert that it is durable in PMEM (a persistent linear address
range).  A '__pmem' attribute is added so sparse can track proper usage
of pointers to pmem.

This continues the status quo of pmem being x86 only for 4.2, but
reworks to ioremap, and wider implementation of memremap() will enable
other archs in 4.3.


Cc: Thomas Gleixner <>
Cc: Ingo Molnar <>
Cc: "H. Peter Anvin" <>
Signed-off-by: Ross Zwisler <>
[djbw: various reworks]
Signed-off-by: Dan Williams <>
7 files changed