Skip to content

Commit 53ef7d0

Browse files
committed
Merge tag 'libnvdimm-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dan Williams: "The bulk of this has been in multiple -next releases. There were a few late breaking fixes and small features that got added in the last couple days, but the whole set has received a build success notification from the kbuild robot. Change summary: - Region media error reporting: A libnvdimm region device is the parent to one or more namespaces. To date, media errors have been reported via the "badblocks" attribute attached to pmem block devices for namespaces in "raw" or "memory" mode. Given that namespaces can be in "device-dax" or "btt-sector" mode this new interface reports media errors generically, i.e. independent of namespace modes or state. This subsequently allows userspace tooling to craft "ACPI 6.1 Section 9.20.7.6 Function Index 4 - Clear Uncorrectable Error" requests and submit them via the ioctl path for NVDIMM root bus devices. - Introduce 'struct dax_device' and 'struct dax_operations': Prompted by a request from Linus and feedback from Christoph this allows for dax capable drivers to publish their own custom dax operations. This fixes the broken assumption that all dax operations are related to a persistent memory device, and makes it easier for other architectures and platforms to add customized persistent memory support. - 'libnvdimm' core updates: A new "deep_flush" sysfs attribute is available for storage appliance applications to manually trigger memory controllers to drain write-pending buffers that would otherwise be flushed automatically by the platform ADR (asynchronous-DRAM-refresh) mechanism at a power loss event. Support for "locked" DIMMs is included to prevent namespaces from surfacing when the namespace label data area is locked. Finally, fixes for various reported deadlocks and crashes, also tagged for -stable. - ACPI / nfit driver updates: General updates of the nfit driver to add DSM command overrides, ACPI 6.1 health state flags support, DSM payload debug available by default, and various fixes. Acknowledgements that came after the branch was pushed: - commmit 565851c "device-dax: fix sysfs attribute deadlock": Tested-by: Yi Zhang <yizhan@redhat.com> - commit 23f4984 "libnvdimm: rework region badblocks clearing" Tested-by: Toshi Kani <toshi.kani@hpe.com>" * tag 'libnvdimm-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (52 commits) libnvdimm, pfn: fix 'npfns' vs section alignment libnvdimm: handle locked label storage areas libnvdimm: convert NDD_ flags to use bitops, introduce NDD_LOCKED brd: fix uninitialized use of brd->dax_dev block, dax: use correct format string in bdev_dax_supported device-dax: fix sysfs attribute deadlock libnvdimm: restore "libnvdimm: band aid btt vs clear poison locking" libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering libnvdimm: rework region badblocks clearing acpi, nfit: kill ACPI_NFIT_DEBUG libnvdimm: fix clear length of nvdimm_forget_poison() libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify libnvdimm, region: sysfs trigger for nvdimm_flush() libnvdimm: fix phys_addr for nvdimm_clear_poison x86, dax, pmem: remove indirection around memcpy_from_pmem() block: remove block_device_operations ->direct_access() block, dax: convert bdev_dax_supported() to dax_direct_access() filesystem-dax: convert to dax_direct_access() Revert "block: use DAX for partition table reads" ext2, ext4, xfs: retrieve dax_device for iomap operations ...
2 parents c6a677c + 7361636 commit 53ef7d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1807
-944
lines changed

arch/powerpc/platforms/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ config CPM2
284284
config AXON_RAM
285285
tristate "Axon DDR2 memory device driver"
286286
depends on PPC_IBM_CELL_BLADE && BLOCK
287+
select DAX
287288
default m
288289
help
289290
It registers one block device per Axon's DDR2 memory bank found

arch/powerpc/sysdev/axonram.c

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <linux/bio.h>
2727
#include <linux/blkdev.h>
28+
#include <linux/dax.h>
2829
#include <linux/device.h>
2930
#include <linux/errno.h>
3031
#include <linux/fs.h>
@@ -62,6 +63,7 @@ static int azfs_major, azfs_minor;
6263
struct axon_ram_bank {
6364
struct platform_device *device;
6465
struct gendisk *disk;
66+
struct dax_device *dax_dev;
6567
unsigned int irq_id;
6668
unsigned long ph_addr;
6769
unsigned long io_addr;
@@ -137,25 +139,32 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio)
137139
return BLK_QC_T_NONE;
138140
}
139141

140-
/**
141-
* axon_ram_direct_access - direct_access() method for block device
142-
* @device, @sector, @data: see block_device_operations method
143-
*/
142+
static const struct block_device_operations axon_ram_devops = {
143+
.owner = THIS_MODULE,
144+
};
145+
144146
static long
145-
axon_ram_direct_access(struct block_device *device, sector_t sector,
146-
void **kaddr, pfn_t *pfn, long size)
147+
__axon_ram_direct_access(struct axon_ram_bank *bank, pgoff_t pgoff, long nr_pages,
148+
void **kaddr, pfn_t *pfn)
147149
{
148-
struct axon_ram_bank *bank = device->bd_disk->private_data;
149-
loff_t offset = (loff_t)sector << AXON_RAM_SECTOR_SHIFT;
150+
resource_size_t offset = pgoff * PAGE_SIZE;
150151

151152
*kaddr = (void *) bank->io_addr + offset;
152153
*pfn = phys_to_pfn_t(bank->ph_addr + offset, PFN_DEV);
153-
return bank->size - offset;
154+
return (bank->size - offset) / PAGE_SIZE;
154155
}
155156

156-
static const struct block_device_operations axon_ram_devops = {
157-
.owner = THIS_MODULE,
158-
.direct_access = axon_ram_direct_access
157+
static long
158+
axon_ram_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
159+
void **kaddr, pfn_t *pfn)
160+
{
161+
struct axon_ram_bank *bank = dax_get_private(dax_dev);
162+
163+
return __axon_ram_direct_access(bank, pgoff, nr_pages, kaddr, pfn);
164+
}
165+
166+
static const struct dax_operations axon_ram_dax_ops = {
167+
.direct_access = axon_ram_dax_direct_access,
159168
};
160169

161170
/**
@@ -219,6 +228,7 @@ static int axon_ram_probe(struct platform_device *device)
219228
goto failed;
220229
}
221230

231+
222232
bank->disk->major = azfs_major;
223233
bank->disk->first_minor = azfs_minor;
224234
bank->disk->fops = &axon_ram_devops;
@@ -227,6 +237,13 @@ static int axon_ram_probe(struct platform_device *device)
227237
sprintf(bank->disk->disk_name, "%s%d",
228238
AXON_RAM_DEVICE_NAME, axon_ram_bank_id);
229239

240+
bank->dax_dev = alloc_dax(bank, bank->disk->disk_name,
241+
&axon_ram_dax_ops);
242+
if (!bank->dax_dev) {
243+
rc = -ENOMEM;
244+
goto failed;
245+
}
246+
230247
bank->disk->queue = blk_alloc_queue(GFP_KERNEL);
231248
if (bank->disk->queue == NULL) {
232249
dev_err(&device->dev, "Cannot register disk queue\n");
@@ -278,6 +295,8 @@ static int axon_ram_probe(struct platform_device *device)
278295
del_gendisk(bank->disk);
279296
put_disk(bank->disk);
280297
}
298+
kill_dax(bank->dax_dev);
299+
put_dax(bank->dax_dev);
281300
device->dev.platform_data = NULL;
282301
if (bank->io_addr != 0)
283302
iounmap((void __iomem *) bank->io_addr);
@@ -300,6 +319,8 @@ axon_ram_remove(struct platform_device *device)
300319

301320
device_remove_file(&device->dev, &dev_attr_ecc);
302321
free_irq(bank->irq_id, device);
322+
kill_dax(bank->dax_dev);
323+
put_dax(bank->dax_dev);
303324
del_gendisk(bank->disk);
304325
put_disk(bank->disk);
305326
iounmap((void __iomem *) bank->io_addr);

arch/x86/include/asm/pmem.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n)
4444
BUG();
4545
}
4646

47-
static inline int arch_memcpy_from_pmem(void *dst, const void *src, size_t n)
48-
{
49-
return memcpy_mcsafe(dst, src, n);
50-
}
51-
5247
/**
5348
* arch_wb_cache_pmem - write back a cache range with CLWB
5449
* @vaddr: virtual start address

arch/x86/include/asm/string_64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ int strcmp(const char *cs, const char *ct);
7979
#define memset(s, c, n) __memset(s, c, n)
8080
#endif
8181

82+
#define __HAVE_ARCH_MEMCPY_MCSAFE 1
8283
__must_check int memcpy_mcsafe_unrolled(void *dst, const void *src, size_t cnt);
8384
DECLARE_STATIC_KEY_FALSE(mcsafe_key);
8485

block/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ menuconfig BLOCK
66
default y
77
select SBITMAP
88
select SRCU
9+
select DAX
910
help
1011
Provide block layer support for the kernel.
1112

block/partition-generic.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/kmod.h>
1717
#include <linux/ctype.h>
1818
#include <linux/genhd.h>
19-
#include <linux/dax.h>
2019
#include <linux/blktrace_api.h>
2120

2221
#include "partitions/check.h"
@@ -630,24 +629,12 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
630629
return 0;
631630
}
632631

633-
static struct page *read_pagecache_sector(struct block_device *bdev, sector_t n)
634-
{
635-
struct address_space *mapping = bdev->bd_inode->i_mapping;
636-
637-
return read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)),
638-
NULL);
639-
}
640-
641632
unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
642633
{
634+
struct address_space *mapping = bdev->bd_inode->i_mapping;
643635
struct page *page;
644636

645-
/* don't populate page cache for dax capable devices */
646-
if (IS_DAX(bdev->bd_inode))
647-
page = read_dax_sector(bdev, n);
648-
else
649-
page = read_pagecache_sector(bdev, n);
650-
637+
page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)), NULL);
651638
if (!IS_ERR(page)) {
652639
if (PageError(page))
653640
goto fail;

drivers/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ obj-$(CONFIG_PARPORT) += parport/
7171
obj-$(CONFIG_NVM) += lightnvm/
7272
obj-y += base/ block/ misc/ mfd/ nfc/
7373
obj-$(CONFIG_LIBNVDIMM) += nvdimm/
74-
obj-$(CONFIG_DEV_DAX) += dax/
74+
obj-$(CONFIG_DAX) += dax/
7575
obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
7676
obj-$(CONFIG_NUBUS) += nubus/
7777
obj-y += macintosh/

drivers/acpi/nfit/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,3 @@ config ACPI_NFIT
1212

1313
To compile this driver as a module, choose M here:
1414
the module will be called nfit.
15-
16-
config ACPI_NFIT_DEBUG
17-
bool "NFIT DSM debug"
18-
depends on ACPI_NFIT
19-
depends on DYNAMIC_DEBUG
20-
default n
21-
help
22-
Enabling this option causes the nfit driver to dump the
23-
input and output buffers of _DSM operations on the ACPI0012
24-
device and its children. This can be very verbose, so leave
25-
it disabled unless you are debugging a hardware / firmware
26-
issue.

0 commit comments

Comments
 (0)