Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:

- Fix for the nd_blk (NVDIMM Block Window Aperture) driver.

A spec clarification requires the driver to mask off reserved bits in
status register. This is tagged for -stable back to the v4.2 kernel.

- Fix for a kernel crash in the nvdimm unit tests when module loading
is interrupted with SIGTERM. Tagged for -stable since validation
efforts external to Intel use the unit tests for qualifying
backports.

- Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
Translation Table) driver to make it symmetric with the other
namespace personality drivers (PFN and DAX) that provide a size
attribute for indicating how much namespace capacity is lost to
metadata.

The BTT change arrived at the start of the merge window and has
appeared in a -next release. It can technically wait for 4.9, but it
is small, fixes asymmetry in the libnvdimm-sysfs interface, and
something I would have squeezed into the v4.8 pull request had it
arrived a few days earlier.

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
tools/testing/nvdimm: fix SIGTERM vs hotplug crash
nvdimm, btt: add a size attribute for BTTs
libnvdimm, nd_blk: mask off reserved status bits

+26 -1
+2 -1
drivers/acpi/nfit/core.c
··· 1527 1527 { 1528 1528 struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; 1529 1529 u64 offset = nfit_blk->stat_offset + mmio->size * bw; 1530 + const u32 STATUS_MASK = 0x80000037; 1530 1531 1531 1532 if (mmio->num_lines) 1532 1533 offset = to_interleave_offset(offset, mmio); 1533 1534 1534 - return readl(mmio->addr.base + offset); 1535 + return readl(mmio->addr.base + offset) & STATUS_MASK; 1535 1536 } 1536 1537 1537 1538 static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
+1
drivers/nvdimm/btt.c
··· 1269 1269 } 1270 1270 } 1271 1271 set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); 1272 + btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; 1272 1273 revalidate_disk(btt->btt_disk); 1273 1274 1274 1275 return 0;
+20
drivers/nvdimm/btt_devs.c
··· 140 140 } 141 141 static DEVICE_ATTR_RW(namespace); 142 142 143 + static ssize_t size_show(struct device *dev, 144 + struct device_attribute *attr, char *buf) 145 + { 146 + struct nd_btt *nd_btt = to_nd_btt(dev); 147 + ssize_t rc; 148 + 149 + device_lock(dev); 150 + if (dev->driver) 151 + rc = sprintf(buf, "%llu\n", nd_btt->size); 152 + else { 153 + /* no size to convey if the btt instance is disabled */ 154 + rc = -ENXIO; 155 + } 156 + device_unlock(dev); 157 + 158 + return rc; 159 + } 160 + static DEVICE_ATTR_RO(size); 161 + 143 162 static struct attribute *nd_btt_attributes[] = { 144 163 &dev_attr_sector_size.attr, 145 164 &dev_attr_namespace.attr, 146 165 &dev_attr_uuid.attr, 166 + &dev_attr_size.attr, 147 167 NULL, 148 168 }; 149 169
+1
drivers/nvdimm/nd.h
··· 143 143 struct nd_namespace_common *ndns; 144 144 struct btt *btt; 145 145 unsigned long lbasize; 146 + u64 size; 146 147 u8 *uuid; 147 148 int id; 148 149 };
+2
tools/testing/nvdimm/test/nfit.c
··· 13 13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 14 #include <linux/platform_device.h> 15 15 #include <linux/dma-mapping.h> 16 + #include <linux/workqueue.h> 16 17 #include <linux/libnvdimm.h> 17 18 #include <linux/vmalloc.h> 18 19 #include <linux/device.h> ··· 1475 1474 if (nfit_test->setup != nfit_test0_setup) 1476 1475 return 0; 1477 1476 1477 + flush_work(&acpi_desc->work); 1478 1478 nfit_test->setup_hotplug = 1; 1479 1479 nfit_test->setup(nfit_test); 1480 1480