Skip to content

Commit 89fd915

Browse files
committed
Merge tag 'libnvdimm-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm from Dan Williams: "A rework of media error handling in the BTT driver and other updates. It has appeared in a few -next releases and collected some late- breaking build-error and warning fixups as a result. Summary: - Media error handling support in the Block Translation Table (BTT) driver is reworked to address sleeping-while-atomic locking and memory-allocation-context conflicts. - The dax_device lookup overhead for xfs and ext4 is moved out of the iomap hot-path to a mount-time lookup. - A new 'ecc_unit_size' sysfs attribute is added to advertise the read-modify-write boundary property of a persistent memory range. - Preparatory fix-ups for arm and powerpc pmem support are included along with other miscellaneous fixes" * tag 'libnvdimm-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (26 commits) libnvdimm, btt: fix format string warnings libnvdimm, btt: clean up warning and error messages ext4: fix null pointer dereference on sbi libnvdimm, nfit: move the check on nd_reserved2 to the endpoint dax: fix FS_DAX=n BLOCK=y compilation libnvdimm: fix integer overflow static analysis warning libnvdimm, nd_blk: remove mmio_flush_range() libnvdimm, btt: rework error clearing libnvdimm: fix potential deadlock while clearing errors libnvdimm, btt: cache sector_size in arena_info libnvdimm, btt: ensure that flags were also unchanged during a map_read libnvdimm, btt: refactor map entry operations with macros libnvdimm, btt: fix a missed NVDIMM_IO_ATOMIC case in the write path libnvdimm, nfit: export an 'ecc_unit_size' sysfs attribute ext4: perform dax_device lookup at mount ext2: perform dax_device lookup at mount xfs: perform dax_device lookup at mount dax: introduce a fs_dax_get_by_bdev() helper libnvdimm, btt: check memory allocation failure libnvdimm, label: fix index block size calculation ...
2 parents 66c9457 + 04c3c98 commit 89fd915

File tree

33 files changed

+397
-170
lines changed

33 files changed

+397
-170
lines changed

arch/x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ config X86
5353
select ARCH_HAS_FORTIFY_SOURCE
5454
select ARCH_HAS_GCOV_PROFILE_ALL
5555
select ARCH_HAS_KCOV if X86_64
56-
select ARCH_HAS_MMIO_FLUSH
5756
select ARCH_HAS_PMEM_API if X86_64
5857
# Causing hangs/crashes, see the commit that added this change for details.
5958
select ARCH_HAS_REFCOUNT if BROKEN

arch/x86/include/asm/cacheflush.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77

88
void clflush_cache_range(void *addr, unsigned int size);
99

10-
#define mmio_flush_range(addr, size) clflush_cache_range(addr, size)
11-
1210
#endif /* _ASM_X86_CACHEFLUSH_H */

drivers/acpi/nfit/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ config ACPI_NFIT
22
tristate "ACPI NVDIMM Firmware Interface Table (NFIT)"
33
depends on PHYS_ADDR_T_64BIT
44
depends on BLK_DEV
5-
depends on ARCH_HAS_MMIO_FLUSH
5+
depends on ARCH_HAS_PMEM_API
66
select LIBNVDIMM
77
help
88
Infrastructure to probe ACPI 6 compliant platforms for

drivers/acpi/nfit/core.c

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
228228
if (cmd == ND_CMD_CALL) {
229229
call_pkg = buf;
230230
func = call_pkg->nd_command;
231+
232+
for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++)
233+
if (call_pkg->nd_reserved2[i])
234+
return -EINVAL;
231235
}
232236

233237
if (nvdimm) {
@@ -1674,8 +1678,19 @@ static ssize_t range_index_show(struct device *dev,
16741678
}
16751679
static DEVICE_ATTR_RO(range_index);
16761680

1681+
static ssize_t ecc_unit_size_show(struct device *dev,
1682+
struct device_attribute *attr, char *buf)
1683+
{
1684+
struct nd_region *nd_region = to_nd_region(dev);
1685+
struct nfit_spa *nfit_spa = nd_region_provider_data(nd_region);
1686+
1687+
return sprintf(buf, "%d\n", nfit_spa->clear_err_unit);
1688+
}
1689+
static DEVICE_ATTR_RO(ecc_unit_size);
1690+
16771691
static struct attribute *acpi_nfit_region_attributes[] = {
16781692
&dev_attr_range_index.attr,
1693+
&dev_attr_ecc_unit_size.attr,
16791694
NULL,
16801695
};
16811696

@@ -1804,20 +1819,21 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
18041819
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
18051820
struct acpi_nfit_memory_map *memdev = memdev_from_spa(acpi_desc,
18061821
spa->range_index, i);
1822+
struct acpi_nfit_control_region *dcr = nfit_mem->dcr;
18071823

18081824
if (!memdev || !nfit_mem->dcr) {
18091825
dev_err(dev, "%s: failed to find DCR\n", __func__);
18101826
return -ENODEV;
18111827
}
18121828

18131829
map->region_offset = memdev->region_offset;
1814-
map->serial_number = nfit_mem->dcr->serial_number;
1830+
map->serial_number = dcr->serial_number;
18151831

18161832
map2->region_offset = memdev->region_offset;
1817-
map2->serial_number = nfit_mem->dcr->serial_number;
1818-
map2->vendor_id = nfit_mem->dcr->vendor_id;
1819-
map2->manufacturing_date = nfit_mem->dcr->manufacturing_date;
1820-
map2->manufacturing_location = nfit_mem->dcr->manufacturing_location;
1833+
map2->serial_number = dcr->serial_number;
1834+
map2->vendor_id = dcr->vendor_id;
1835+
map2->manufacturing_date = dcr->manufacturing_date;
1836+
map2->manufacturing_location = dcr->manufacturing_location;
18211837
}
18221838

18231839
/* v1.1 namespaces */
@@ -1835,6 +1851,28 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
18351851
cmp_map_compat, NULL);
18361852
nd_set->altcookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);
18371853

1854+
/* record the result of the sort for the mapping position */
1855+
for (i = 0; i < nr; i++) {
1856+
struct nfit_set_info_map2 *map2 = &info2->mapping[i];
1857+
int j;
1858+
1859+
for (j = 0; j < nr; j++) {
1860+
struct nd_mapping_desc *mapping = &ndr_desc->mapping[j];
1861+
struct nvdimm *nvdimm = mapping->nvdimm;
1862+
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
1863+
struct acpi_nfit_control_region *dcr = nfit_mem->dcr;
1864+
1865+
if (map2->serial_number == dcr->serial_number &&
1866+
map2->vendor_id == dcr->vendor_id &&
1867+
map2->manufacturing_date == dcr->manufacturing_date &&
1868+
map2->manufacturing_location
1869+
== dcr->manufacturing_location) {
1870+
mapping->position = i;
1871+
break;
1872+
}
1873+
}
1874+
}
1875+
18381876
ndr_desc->nd_set = nd_set;
18391877
devm_kfree(dev, info);
18401878
devm_kfree(dev, info2);
@@ -1930,7 +1968,7 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk,
19301968
memcpy_flushcache(mmio->addr.aperture + offset, iobuf + copied, c);
19311969
else {
19321970
if (nfit_blk->dimm_flags & NFIT_BLK_READ_FLUSH)
1933-
mmio_flush_range((void __force *)
1971+
arch_invalidate_pmem((void __force *)
19341972
mmio->addr.aperture + offset, c);
19351973

19361974
memcpy(iobuf + copied, mmio->addr.aperture + offset, c);

drivers/dax/super.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void dax_read_unlock(int id)
4646
EXPORT_SYMBOL_GPL(dax_read_unlock);
4747

4848
#ifdef CONFIG_BLOCK
49+
#include <linux/blkdev.h>
50+
4951
int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
5052
pgoff_t *pgoff)
5153
{
@@ -59,6 +61,16 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
5961
}
6062
EXPORT_SYMBOL(bdev_dax_pgoff);
6163

64+
#if IS_ENABLED(CONFIG_FS_DAX)
65+
struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
66+
{
67+
if (!blk_queue_dax(bdev->bd_queue))
68+
return NULL;
69+
return fs_dax_get_by_host(bdev->bd_disk->disk_name);
70+
}
71+
EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
72+
#endif
73+
6274
/**
6375
* __bdev_dax_supported() - Check if the device supports dax for filesystem
6476
* @sb: The superblock of the device

0 commit comments

Comments
 (0)