diff options
-rw-r--r-- | Documentation/filesystems/Locking | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/axonram.c | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/pmem.h | 41 | ||||
-rw-r--r-- | drivers/acpi/nfit.h | 2 | ||||
-rw-r--r-- | drivers/block/brd.c | 4 | ||||
-rw-r--r-- | drivers/nvdimm/pmem.c | 6 | ||||
-rw-r--r-- | drivers/nvdimm/pmem.h | 4 | ||||
-rw-r--r-- | drivers/s390/block/dcssblk.c | 6 | ||||
-rw-r--r-- | fs/dax.c | 6 | ||||
-rw-r--r-- | include/linux/blkdev.h | 6 | ||||
-rw-r--r-- | include/linux/compiler.h | 2 | ||||
-rw-r--r-- | include/linux/nd.h | 2 | ||||
-rw-r--r-- | include/linux/pmem.h | 70 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 1 | ||||
-rw-r--r-- | tools/testing/nvdimm/pmem-dax.c | 2 |
15 files changed, 56 insertions, 102 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 75eea7ce3d7c..d9c37ec4c760 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -395,7 +395,7 @@ prototypes: | |||
395 | int (*release) (struct gendisk *, fmode_t); | 395 | int (*release) (struct gendisk *, fmode_t); |
396 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 396 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
397 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 397 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
398 | int (*direct_access) (struct block_device *, sector_t, void __pmem **, | 398 | int (*direct_access) (struct block_device *, sector_t, void **, |
399 | unsigned long *); | 399 | unsigned long *); |
400 | int (*media_changed) (struct gendisk *); | 400 | int (*media_changed) (struct gendisk *); |
401 | void (*unlock_native_capacity) (struct gendisk *); | 401 | void (*unlock_native_capacity) (struct gendisk *); |
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c index ff75d70f7285..a87489d007dc 100644 --- a/arch/powerpc/sysdev/axonram.c +++ b/arch/powerpc/sysdev/axonram.c | |||
@@ -143,12 +143,12 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio) | |||
143 | */ | 143 | */ |
144 | static long | 144 | static long |
145 | axon_ram_direct_access(struct block_device *device, sector_t sector, | 145 | axon_ram_direct_access(struct block_device *device, sector_t sector, |
146 | void __pmem **kaddr, pfn_t *pfn, long size) | 146 | void **kaddr, pfn_t *pfn, long size) |
147 | { | 147 | { |
148 | struct axon_ram_bank *bank = device->bd_disk->private_data; | 148 | struct axon_ram_bank *bank = device->bd_disk->private_data; |
149 | loff_t offset = (loff_t)sector << AXON_RAM_SECTOR_SHIFT; | 149 | loff_t offset = (loff_t)sector << AXON_RAM_SECTOR_SHIFT; |
150 | 150 | ||
151 | *kaddr = (void __pmem __force *) bank->io_addr + offset; | 151 | *kaddr = (void *) bank->io_addr + offset; |
152 | *pfn = phys_to_pfn_t(bank->ph_addr + offset, PFN_DEV); | 152 | *pfn = phys_to_pfn_t(bank->ph_addr + offset, PFN_DEV); |
153 | return bank->size - offset; | 153 | return bank->size - offset; |
154 | } | 154 | } |
diff --git a/arch/x86/include/asm/pmem.h b/arch/x86/include/asm/pmem.h index a8cf2a6b14d9..643eba42d620 100644 --- a/arch/x86/include/asm/pmem.h +++ b/arch/x86/include/asm/pmem.h | |||
@@ -28,10 +28,9 @@ | |||
28 | * Copy data to persistent memory media via non-temporal stores so that | 28 | * Copy data to persistent memory media via non-temporal stores so that |
29 | * a subsequent pmem driver flush operation will drain posted write queues. | 29 | * a subsequent pmem driver flush operation will drain posted write queues. |
30 | */ | 30 | */ |
31 | static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, | 31 | static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n) |
32 | size_t n) | ||
33 | { | 32 | { |
34 | int unwritten; | 33 | int rem; |
35 | 34 | ||
36 | /* | 35 | /* |
37 | * We are copying between two kernel buffers, if | 36 | * We are copying between two kernel buffers, if |
@@ -39,19 +38,17 @@ static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, | |||
39 | * fault) we would have already reported a general protection fault | 38 | * fault) we would have already reported a general protection fault |
40 | * before the WARN+BUG. | 39 | * before the WARN+BUG. |
41 | */ | 40 | */ |
42 | unwritten = __copy_from_user_inatomic_nocache((void __force *) dst, | 41 | rem = __copy_from_user_inatomic_nocache(dst, (void __user *) src, n); |
43 | (void __user *) src, n); | 42 | if (WARN(rem, "%s: fault copying %p <- %p unwritten: %d\n", |
44 | if (WARN(unwritten, "%s: fault copying %p <- %p unwritten: %d\n", | 43 | __func__, dst, src, rem)) |
45 | __func__, dst, src, unwritten)) | ||
46 | BUG(); | 44 | BUG(); |
47 | } | 45 | } |
48 | 46 | ||
49 | static inline int arch_memcpy_from_pmem(void *dst, const void __pmem *src, | 47 | static inline int arch_memcpy_from_pmem(void *dst, const void *src, size_t n) |
50 | size_t n) | ||
51 | { | 48 | { |
52 | if (static_cpu_has(X86_FEATURE_MCE_RECOVERY)) | 49 | if (static_cpu_has(X86_FEATURE_MCE_RECOVERY)) |
53 | return memcpy_mcsafe(dst, (void __force *) src, n); | 50 | return memcpy_mcsafe(dst, src, n); |
54 | memcpy(dst, (void __force *) src, n); | 51 | memcpy(dst, src, n); |
55 | return 0; | 52 | return 0; |
56 | } | 53 | } |
57 | 54 | ||
@@ -63,15 +60,14 @@ static inline int arch_memcpy_from_pmem(void *dst, const void __pmem *src, | |||
63 | * Write back a cache range using the CLWB (cache line write back) | 60 | * Write back a cache range using the CLWB (cache line write back) |
64 | * instruction. | 61 | * instruction. |
65 | */ | 62 | */ |
66 | static inline void arch_wb_cache_pmem(void __pmem *addr, size_t size) | 63 | static inline void arch_wb_cache_pmem(void *addr, size_t size) |
67 | { | 64 | { |
68 | u16 x86_clflush_size = boot_cpu_data.x86_clflush_size; | 65 | u16 x86_clflush_size = boot_cpu_data.x86_clflush_size; |
69 | unsigned long clflush_mask = x86_clflush_size - 1; | 66 | unsigned long clflush_mask = x86_clflush_size - 1; |
70 | void *vaddr = (void __force *)addr; | 67 | void *vend = addr + size; |
71 | void *vend = vaddr + size; | ||
72 | void *p; | 68 | void *p; |
73 | 69 | ||
74 | for (p = (void *)((unsigned long)vaddr & ~clflush_mask); | 70 | for (p = (void *)((unsigned long)addr & ~clflush_mask); |
75 | p < vend; p += x86_clflush_size) | 71 | p < vend; p += x86_clflush_size) |
76 | clwb(p); | 72 | clwb(p); |
77 | } | 73 | } |
@@ -93,14 +89,13 @@ static inline bool __iter_needs_pmem_wb(struct iov_iter *i) | |||
93 | * | 89 | * |
94 | * Copy data from the iterator 'i' to the PMEM buffer starting at 'addr'. | 90 | * Copy data from the iterator 'i' to the PMEM buffer starting at 'addr'. |
95 | */ | 91 | */ |
96 | static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes, | 92 | static inline size_t arch_copy_from_iter_pmem(void *addr, size_t bytes, |
97 | struct iov_iter *i) | 93 | struct iov_iter *i) |
98 | { | 94 | { |
99 | void *vaddr = (void __force *)addr; | ||
100 | size_t len; | 95 | size_t len; |
101 | 96 | ||
102 | /* TODO: skip the write-back by always using non-temporal stores */ | 97 | /* TODO: skip the write-back by always using non-temporal stores */ |
103 | len = copy_from_iter_nocache(vaddr, bytes, i); | 98 | len = copy_from_iter_nocache(addr, bytes, i); |
104 | 99 | ||
105 | if (__iter_needs_pmem_wb(i)) | 100 | if (__iter_needs_pmem_wb(i)) |
106 | arch_wb_cache_pmem(addr, bytes); | 101 | arch_wb_cache_pmem(addr, bytes); |
@@ -115,17 +110,15 @@ static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes, | |||
115 | * | 110 | * |
116 | * Write zeros into the memory range starting at 'addr' for 'size' bytes. | 111 | * Write zeros into the memory range starting at 'addr' for 'size' bytes. |
117 | */ | 112 | */ |
118 | static inline void arch_clear_pmem(void __pmem *addr, size_t size) | 113 | static inline void arch_clear_pmem(void *addr, size_t size) |
119 | { | 114 | { |
120 | void *vaddr = (void __force *)addr; | 115 | memset(addr, 0, size); |
121 | |||
122 | memset(vaddr, 0, size); | ||
123 | arch_wb_cache_pmem(addr, size); | 116 | arch_wb_cache_pmem(addr, size); |
124 | } | 117 | } |
125 | 118 | ||
126 | static inline void arch_invalidate_pmem(void __pmem *addr, size_t size) | 119 | static inline void arch_invalidate_pmem(void *addr, size_t size) |
127 | { | 120 | { |
128 | clflush_cache_range((void __force *) addr, size); | 121 | clflush_cache_range(addr, size); |
129 | } | 122 | } |
130 | #endif /* CONFIG_ARCH_HAS_PMEM_API */ | 123 | #endif /* CONFIG_ARCH_HAS_PMEM_API */ |
131 | #endif /* __ASM_X86_PMEM_H__ */ | 124 | #endif /* __ASM_X86_PMEM_H__ */ |
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h index 9fda77cf81da..80fb2c0ac8bf 100644 --- a/drivers/acpi/nfit.h +++ b/drivers/acpi/nfit.h | |||
@@ -164,7 +164,7 @@ enum nd_blk_mmio_selector { | |||
164 | struct nd_blk_addr { | 164 | struct nd_blk_addr { |
165 | union { | 165 | union { |
166 | void __iomem *base; | 166 | void __iomem *base; |
167 | void __pmem *aperture; | 167 | void *aperture; |
168 | }; | 168 | }; |
169 | }; | 169 | }; |
170 | 170 | ||
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index c04bd9bc39fd..5f1fe4e6208d 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -381,7 +381,7 @@ static int brd_rw_page(struct block_device *bdev, sector_t sector, | |||
381 | 381 | ||
382 | #ifdef CONFIG_BLK_DEV_RAM_DAX | 382 | #ifdef CONFIG_BLK_DEV_RAM_DAX |
383 | static long brd_direct_access(struct block_device *bdev, sector_t sector, | 383 | static long brd_direct_access(struct block_device *bdev, sector_t sector, |
384 | void __pmem **kaddr, pfn_t *pfn, long size) | 384 | void **kaddr, pfn_t *pfn, long size) |
385 | { | 385 | { |
386 | struct brd_device *brd = bdev->bd_disk->private_data; | 386 | struct brd_device *brd = bdev->bd_disk->private_data; |
387 | struct page *page; | 387 | struct page *page; |
@@ -391,7 +391,7 @@ static long brd_direct_access(struct block_device *bdev, sector_t sector, | |||
391 | page = brd_insert_page(brd, sector); | 391 | page = brd_insert_page(brd, sector); |
392 | if (!page) | 392 | if (!page) |
393 | return -ENOSPC; | 393 | return -ENOSPC; |
394 | *kaddr = (void __pmem *)page_address(page); | 394 | *kaddr = page_address(page); |
395 | *pfn = page_to_pfn_t(page); | 395 | *pfn = page_to_pfn_t(page); |
396 | 396 | ||
397 | return PAGE_SIZE; | 397 | return PAGE_SIZE; |
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 8bfc6acc2e43..7251b4b6da84 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c | |||
@@ -74,7 +74,7 @@ static int pmem_do_bvec(struct pmem_device *pmem, struct page *page, | |||
74 | bool bad_pmem = false; | 74 | bool bad_pmem = false; |
75 | void *mem = kmap_atomic(page); | 75 | void *mem = kmap_atomic(page); |
76 | phys_addr_t pmem_off = sector * 512 + pmem->data_offset; | 76 | phys_addr_t pmem_off = sector * 512 + pmem->data_offset; |
77 | void __pmem *pmem_addr = pmem->virt_addr + pmem_off; | 77 | void *pmem_addr = pmem->virt_addr + pmem_off; |
78 | 78 | ||
79 | if (unlikely(is_bad_pmem(&pmem->bb, sector, len))) | 79 | if (unlikely(is_bad_pmem(&pmem->bb, sector, len))) |
80 | bad_pmem = true; | 80 | bad_pmem = true; |
@@ -173,7 +173,7 @@ static int pmem_rw_page(struct block_device *bdev, sector_t sector, | |||
173 | 173 | ||
174 | /* see "strong" declaration in tools/testing/nvdimm/pmem-dax.c */ | 174 | /* see "strong" declaration in tools/testing/nvdimm/pmem-dax.c */ |
175 | __weak long pmem_direct_access(struct block_device *bdev, sector_t sector, | 175 | __weak long pmem_direct_access(struct block_device *bdev, sector_t sector, |
176 | void __pmem **kaddr, pfn_t *pfn, long size) | 176 | void **kaddr, pfn_t *pfn, long size) |
177 | { | 177 | { |
178 | struct pmem_device *pmem = bdev->bd_queue->queuedata; | 178 | struct pmem_device *pmem = bdev->bd_queue->queuedata; |
179 | resource_size_t offset = sector * 512 + pmem->data_offset; | 179 | resource_size_t offset = sector * 512 + pmem->data_offset; |
@@ -284,7 +284,7 @@ static int pmem_attach_disk(struct device *dev, | |||
284 | 284 | ||
285 | if (IS_ERR(addr)) | 285 | if (IS_ERR(addr)) |
286 | return PTR_ERR(addr); | 286 | return PTR_ERR(addr); |
287 | pmem->virt_addr = (void __pmem *) addr; | 287 | pmem->virt_addr = addr; |
288 | 288 | ||
289 | blk_queue_write_cache(q, true, true); | 289 | blk_queue_write_cache(q, true, true); |
290 | blk_queue_make_request(q, pmem_make_request); | 290 | blk_queue_make_request(q, pmem_make_request); |
diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h index c48d4e3aa346..b4ee4f71b4a1 100644 --- a/drivers/nvdimm/pmem.h +++ b/drivers/nvdimm/pmem.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
7 | 7 | ||
8 | long pmem_direct_access(struct block_device *bdev, sector_t sector, | 8 | long pmem_direct_access(struct block_device *bdev, sector_t sector, |
9 | void __pmem **kaddr, pfn_t *pfn, long size); | 9 | void **kaddr, pfn_t *pfn, long size); |
10 | /* this definition is in it's own header for tools/testing/nvdimm to consume */ | 10 | /* this definition is in it's own header for tools/testing/nvdimm to consume */ |
11 | struct pmem_device { | 11 | struct pmem_device { |
12 | /* One contiguous memory region per device */ | 12 | /* One contiguous memory region per device */ |
@@ -14,7 +14,7 @@ struct pmem_device { | |||
14 | /* when non-zero this device is hosting a 'pfn' instance */ | 14 | /* when non-zero this device is hosting a 'pfn' instance */ |
15 | phys_addr_t data_offset; | 15 | phys_addr_t data_offset; |
16 | u64 pfn_flags; | 16 | u64 pfn_flags; |
17 | void __pmem *virt_addr; | 17 | void *virt_addr; |
18 | /* immutable base size of the namespace */ | 18 | /* immutable base size of the namespace */ |
19 | size_t size; | 19 | size_t size; |
20 | /* trim size when namespace capacity has been section aligned */ | 20 | /* trim size when namespace capacity has been section aligned */ |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index bed53c46dd90..023c5c975dc0 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -31,7 +31,7 @@ static void dcssblk_release(struct gendisk *disk, fmode_t mode); | |||
31 | static blk_qc_t dcssblk_make_request(struct request_queue *q, | 31 | static blk_qc_t dcssblk_make_request(struct request_queue *q, |
32 | struct bio *bio); | 32 | struct bio *bio); |
33 | static long dcssblk_direct_access(struct block_device *bdev, sector_t secnum, | 33 | static long dcssblk_direct_access(struct block_device *bdev, sector_t secnum, |
34 | void __pmem **kaddr, pfn_t *pfn, long size); | 34 | void **kaddr, pfn_t *pfn, long size); |
35 | 35 | ||
36 | static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; | 36 | static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; |
37 | 37 | ||
@@ -884,7 +884,7 @@ fail: | |||
884 | 884 | ||
885 | static long | 885 | static long |
886 | dcssblk_direct_access (struct block_device *bdev, sector_t secnum, | 886 | dcssblk_direct_access (struct block_device *bdev, sector_t secnum, |
887 | void __pmem **kaddr, pfn_t *pfn, long size) | 887 | void **kaddr, pfn_t *pfn, long size) |
888 | { | 888 | { |
889 | struct dcssblk_dev_info *dev_info; | 889 | struct dcssblk_dev_info *dev_info; |
890 | unsigned long offset, dev_sz; | 890 | unsigned long offset, dev_sz; |
@@ -894,7 +894,7 @@ dcssblk_direct_access (struct block_device *bdev, sector_t secnum, | |||
894 | return -ENODEV; | 894 | return -ENODEV; |
895 | dev_sz = dev_info->end - dev_info->start; | 895 | dev_sz = dev_info->end - dev_info->start; |
896 | offset = secnum * 512; | 896 | offset = secnum * 512; |
897 | *kaddr = (void __pmem *) (dev_info->start + offset); | 897 | *kaddr = (void *) dev_info->start + offset; |
898 | *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), PFN_DEV); | 898 | *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), PFN_DEV); |
899 | 899 | ||
900 | return dev_sz - offset; | 900 | return dev_sz - offset; |
@@ -75,13 +75,13 @@ static long dax_map_atomic(struct block_device *bdev, struct blk_dax_ctl *dax) | |||
75 | struct request_queue *q = bdev->bd_queue; | 75 | struct request_queue *q = bdev->bd_queue; |
76 | long rc = -EIO; | 76 | long rc = -EIO; |
77 | 77 | ||
78 | dax->addr = (void __pmem *) ERR_PTR(-EIO); | 78 | dax->addr = ERR_PTR(-EIO); |
79 | if (blk_queue_enter(q, true) != 0) | 79 | if (blk_queue_enter(q, true) != 0) |
80 | return rc; | 80 | return rc; |
81 | 81 | ||
82 | rc = bdev_direct_access(bdev, dax); | 82 | rc = bdev_direct_access(bdev, dax); |
83 | if (rc < 0) { | 83 | if (rc < 0) { |
84 | dax->addr = (void __pmem *) ERR_PTR(rc); | 84 | dax->addr = ERR_PTR(rc); |
85 | blk_queue_exit(q); | 85 | blk_queue_exit(q); |
86 | return rc; | 86 | return rc; |
87 | } | 87 | } |
@@ -152,7 +152,7 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, | |||
152 | int rw = iov_iter_rw(iter), rc; | 152 | int rw = iov_iter_rw(iter), rc; |
153 | long map_len = 0; | 153 | long map_len = 0; |
154 | struct blk_dax_ctl dax = { | 154 | struct blk_dax_ctl dax = { |
155 | .addr = (void __pmem *) ERR_PTR(-EIO), | 155 | .addr = ERR_PTR(-EIO), |
156 | }; | 156 | }; |
157 | unsigned blkbits = inode->i_blkbits; | 157 | unsigned blkbits = inode->i_blkbits; |
158 | sector_t file_blks = (i_size_read(inode) + (1 << blkbits) - 1) | 158 | sector_t file_blks = (i_size_read(inode) + (1 << blkbits) - 1) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3d9cf326574f..fde908b2836b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1659,7 +1659,7 @@ static inline bool integrity_req_gap_front_merge(struct request *req, | |||
1659 | */ | 1659 | */ |
1660 | struct blk_dax_ctl { | 1660 | struct blk_dax_ctl { |
1661 | sector_t sector; | 1661 | sector_t sector; |
1662 | void __pmem *addr; | 1662 | void *addr; |
1663 | long size; | 1663 | long size; |
1664 | pfn_t pfn; | 1664 | pfn_t pfn; |
1665 | }; | 1665 | }; |
@@ -1670,8 +1670,8 @@ struct block_device_operations { | |||
1670 | int (*rw_page)(struct block_device *, sector_t, struct page *, int rw); | 1670 | int (*rw_page)(struct block_device *, sector_t, struct page *, int rw); |
1671 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1671 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1672 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1672 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1673 | long (*direct_access)(struct block_device *, sector_t, void __pmem **, | 1673 | long (*direct_access)(struct block_device *, sector_t, void **, pfn_t *, |
1674 | pfn_t *, long); | 1674 | long); |
1675 | unsigned int (*check_events) (struct gendisk *disk, | 1675 | unsigned int (*check_events) (struct gendisk *disk, |
1676 | unsigned int clearing); | 1676 | unsigned int clearing); |
1677 | /* ->media_changed() is DEPRECATED, use ->check_events() instead */ | 1677 | /* ->media_changed() is DEPRECATED, use ->check_events() instead */ |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 793c0829e3a3..b966974938ed 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -17,7 +17,6 @@ | |||
17 | # define __release(x) __context__(x,-1) | 17 | # define __release(x) __context__(x,-1) |
18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) | 18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
19 | # define __percpu __attribute__((noderef, address_space(3))) | 19 | # define __percpu __attribute__((noderef, address_space(3))) |
20 | # define __pmem __attribute__((noderef, address_space(5))) | ||
21 | #ifdef CONFIG_SPARSE_RCU_POINTER | 20 | #ifdef CONFIG_SPARSE_RCU_POINTER |
22 | # define __rcu __attribute__((noderef, address_space(4))) | 21 | # define __rcu __attribute__((noderef, address_space(4))) |
23 | #else /* CONFIG_SPARSE_RCU_POINTER */ | 22 | #else /* CONFIG_SPARSE_RCU_POINTER */ |
@@ -45,7 +44,6 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
45 | # define __cond_lock(x,c) (c) | 44 | # define __cond_lock(x,c) (c) |
46 | # define __percpu | 45 | # define __percpu |
47 | # define __rcu | 46 | # define __rcu |
48 | # define __pmem | ||
49 | # define __private | 47 | # define __private |
50 | # define ACCESS_PRIVATE(p, member) ((p)->member) | 48 | # define ACCESS_PRIVATE(p, member) ((p)->member) |
51 | #endif /* __CHECKER__ */ | 49 | #endif /* __CHECKER__ */ |
diff --git a/include/linux/nd.h b/include/linux/nd.h index 1ecd64643512..f1ea426d6a5e 100644 --- a/include/linux/nd.h +++ b/include/linux/nd.h | |||
@@ -68,7 +68,7 @@ struct nd_namespace_io { | |||
68 | struct nd_namespace_common common; | 68 | struct nd_namespace_common common; |
69 | struct resource res; | 69 | struct resource res; |
70 | resource_size_t size; | 70 | resource_size_t size; |
71 | void __pmem *addr; | 71 | void *addr; |
72 | struct badblocks bb; | 72 | struct badblocks bb; |
73 | }; | 73 | }; |
74 | 74 | ||
diff --git a/include/linux/pmem.h b/include/linux/pmem.h index 9e3ea94b8157..e856c2cb0fe8 100644 --- a/include/linux/pmem.h +++ b/include/linux/pmem.h | |||
@@ -26,37 +26,35 @@ | |||
26 | * calling these symbols with arch_has_pmem_api() and redirect to the | 26 | * calling these symbols with arch_has_pmem_api() and redirect to the |
27 | * implementation in asm/pmem.h. | 27 | * implementation in asm/pmem.h. |
28 | */ | 28 | */ |
29 | static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, | 29 | static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n) |
30 | size_t n) | ||
31 | { | 30 | { |
32 | BUG(); | 31 | BUG(); |
33 | } | 32 | } |
34 | 33 | ||
35 | static inline int arch_memcpy_from_pmem(void *dst, const void __pmem *src, | 34 | static inline int arch_memcpy_from_pmem(void *dst, const void *src, size_t n) |
36 | size_t n) | ||
37 | { | 35 | { |
38 | BUG(); | 36 | BUG(); |
39 | return -EFAULT; | 37 | return -EFAULT; |
40 | } | 38 | } |
41 | 39 | ||
42 | static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes, | 40 | static inline size_t arch_copy_from_iter_pmem(void *addr, size_t bytes, |
43 | struct iov_iter *i) | 41 | struct iov_iter *i) |
44 | { | 42 | { |
45 | BUG(); | 43 | BUG(); |
46 | return 0; | 44 | return 0; |
47 | } | 45 | } |
48 | 46 | ||
49 | static inline void arch_clear_pmem(void __pmem *addr, size_t size) | 47 | static inline void arch_clear_pmem(void *addr, size_t size) |
50 | { | 48 | { |
51 | BUG(); | 49 | BUG(); |
52 | } | 50 | } |
53 | 51 | ||
54 | static inline void arch_wb_cache_pmem(void __pmem *addr, size_t size) | 52 | static inline void arch_wb_cache_pmem(void *addr, size_t size) |
55 | { | 53 | { |
56 | BUG(); | 54 | BUG(); |
57 | } | 55 | } |
58 | 56 | ||
59 | static inline void arch_invalidate_pmem(void __pmem *addr, size_t size) | 57 | static inline void arch_invalidate_pmem(void *addr, size_t size) |
60 | { | 58 | { |
61 | BUG(); | 59 | BUG(); |
62 | } | 60 | } |
@@ -67,13 +65,6 @@ static inline bool arch_has_pmem_api(void) | |||
67 | return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); | 65 | return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API); |
68 | } | 66 | } |
69 | 67 | ||
70 | static inline int default_memcpy_from_pmem(void *dst, void __pmem const *src, | ||
71 | size_t size) | ||
72 | { | ||
73 | memcpy(dst, (void __force *) src, size); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | /* | 68 | /* |
78 | * memcpy_from_pmem - read from persistent memory with error handling | 69 | * memcpy_from_pmem - read from persistent memory with error handling |
79 | * @dst: destination buffer | 70 | * @dst: destination buffer |
@@ -82,40 +73,13 @@ static inline int default_memcpy_from_pmem(void *dst, void __pmem const *src, | |||
82 | * | 73 | * |
83 | * Returns 0 on success negative error code on failure. | 74 | * Returns 0 on success negative error code on failure. |
84 | */ | 75 | */ |
85 | static inline int memcpy_from_pmem(void *dst, void __pmem const *src, | 76 | static inline int memcpy_from_pmem(void *dst, void const *src, size_t size) |
86 | size_t size) | ||
87 | { | 77 | { |
88 | if (arch_has_pmem_api()) | 78 | if (arch_has_pmem_api()) |
89 | return arch_memcpy_from_pmem(dst, src, size); | 79 | return arch_memcpy_from_pmem(dst, src, size); |
90 | else | 80 | else |
91 | return default_memcpy_from_pmem(dst, src, size); | 81 | memcpy(dst, src, size); |
92 | } | 82 | return 0; |
93 | |||
94 | /* | ||
95 | * These defaults seek to offer decent performance and minimize the | ||
96 | * window between i/o completion and writes being durable on media. | ||
97 | * However, it is undefined / architecture specific whether | ||
98 | * ARCH_MEMREMAP_PMEM + default_memcpy_to_pmem is sufficient for | ||
99 | * making data durable relative to i/o completion. | ||
100 | */ | ||
101 | static inline void default_memcpy_to_pmem(void __pmem *dst, const void *src, | ||
102 | size_t size) | ||
103 | { | ||
104 | memcpy((void __force *) dst, src, size); | ||
105 | } | ||
106 | |||
107 | static inline size_t default_copy_from_iter_pmem(void __pmem *addr, | ||
108 | size_t bytes, struct iov_iter *i) | ||
109 | { | ||
110 | return copy_from_iter_nocache((void __force *)addr, bytes, i); | ||
111 | } | ||
112 | |||
113 | static inline void default_clear_pmem(void __pmem *addr, size_t size) | ||
114 | { | ||
115 | if (size == PAGE_SIZE && ((unsigned long)addr & ~PAGE_MASK) == 0) | ||
116 | clear_page((void __force *)addr); | ||
117 | else | ||
118 | memset((void __force *)addr, 0, size); | ||
119 | } | 83 | } |
120 | 84 | ||
121 | /** | 85 | /** |
@@ -130,12 +94,12 @@ static inline void default_clear_pmem(void __pmem *addr, size_t size) | |||
130 | * data may still reside in cpu or platform buffers, so this operation | 94 | * data may still reside in cpu or platform buffers, so this operation |
131 | * must be followed by a blkdev_issue_flush() on the pmem block device. | 95 | * must be followed by a blkdev_issue_flush() on the pmem block device. |
132 | */ | 96 | */ |
133 | static inline void memcpy_to_pmem(void __pmem *dst, const void *src, size_t n) | 97 | static inline void memcpy_to_pmem(void *dst, const void *src, size_t n) |
134 | { | 98 | { |
135 | if (arch_has_pmem_api()) | 99 | if (arch_has_pmem_api()) |
136 | arch_memcpy_to_pmem(dst, src, n); | 100 | arch_memcpy_to_pmem(dst, src, n); |
137 | else | 101 | else |
138 | default_memcpy_to_pmem(dst, src, n); | 102 | memcpy(dst, src, n); |
139 | } | 103 | } |
140 | 104 | ||
141 | /** | 105 | /** |
@@ -147,12 +111,12 @@ static inline void memcpy_to_pmem(void __pmem *dst, const void *src, size_t n) | |||
147 | * Copy data from the iterator 'i' to the PMEM buffer starting at 'addr'. | 111 | * Copy data from the iterator 'i' to the PMEM buffer starting at 'addr'. |
148 | * See blkdev_issue_flush() note for memcpy_to_pmem(). | 112 | * See blkdev_issue_flush() note for memcpy_to_pmem(). |
149 | */ | 113 | */ |
150 | static inline size_t copy_from_iter_pmem(void __pmem *addr, size_t bytes, | 114 | static inline size_t copy_from_iter_pmem(void *addr, size_t bytes, |
151 | struct iov_iter *i) | 115 | struct iov_iter *i) |
152 | { | 116 | { |
153 | if (arch_has_pmem_api()) | 117 | if (arch_has_pmem_api()) |
154 | return arch_copy_from_iter_pmem(addr, bytes, i); | 118 | return arch_copy_from_iter_pmem(addr, bytes, i); |
155 | return default_copy_from_iter_pmem(addr, bytes, i); | 119 | return copy_from_iter_nocache(addr, bytes, i); |
156 | } | 120 | } |
157 | 121 | ||
158 | /** | 122 | /** |
@@ -163,12 +127,12 @@ static inline size_t copy_from_iter_pmem(void __pmem *addr, size_t bytes, | |||
163 | * Write zeros into the memory range starting at 'addr' for 'size' bytes. | 127 | * Write zeros into the memory range starting at 'addr' for 'size' bytes. |
164 | * See blkdev_issue_flush() note for memcpy_to_pmem(). | 128 | * See blkdev_issue_flush() note for memcpy_to_pmem(). |
165 | */ | 129 | */ |
166 | static inline void clear_pmem(void __pmem *addr, size_t size) | 130 | static inline void clear_pmem(void *addr, size_t size) |
167 | { | 131 | { |
168 | if (arch_has_pmem_api()) | 132 | if (arch_has_pmem_api()) |
169 | arch_clear_pmem(addr, size); | 133 | arch_clear_pmem(addr, size); |
170 | else | 134 | else |
171 | default_clear_pmem(addr, size); | 135 | memset(addr, 0, size); |
172 | } | 136 | } |
173 | 137 | ||
174 | /** | 138 | /** |
@@ -179,7 +143,7 @@ static inline void clear_pmem(void __pmem *addr, size_t size) | |||
179 | * For platforms that support clearing poison this flushes any poisoned | 143 | * For platforms that support clearing poison this flushes any poisoned |
180 | * ranges out of the cache | 144 | * ranges out of the cache |
181 | */ | 145 | */ |
182 | static inline void invalidate_pmem(void __pmem *addr, size_t size) | 146 | static inline void invalidate_pmem(void *addr, size_t size) |
183 | { | 147 | { |
184 | if (arch_has_pmem_api()) | 148 | if (arch_has_pmem_api()) |
185 | arch_invalidate_pmem(addr, size); | 149 | arch_invalidate_pmem(addr, size); |
@@ -193,7 +157,7 @@ static inline void invalidate_pmem(void __pmem *addr, size_t size) | |||
193 | * Write back the processor cache range starting at 'addr' for 'size' bytes. | 157 | * Write back the processor cache range starting at 'addr' for 'size' bytes. |
194 | * See blkdev_issue_flush() note for memcpy_to_pmem(). | 158 | * See blkdev_issue_flush() note for memcpy_to_pmem(). |
195 | */ | 159 | */ |
196 | static inline void wb_cache_pmem(void __pmem *addr, size_t size) | 160 | static inline void wb_cache_pmem(void *addr, size_t size) |
197 | { | 161 | { |
198 | if (arch_has_pmem_api()) | 162 | if (arch_has_pmem_api()) |
199 | arch_wb_cache_pmem(addr, size); | 163 | arch_wb_cache_pmem(addr, size); |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4904ced676d4..24a08363995a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -313,7 +313,6 @@ our $Sparse = qr{ | |||
313 | __kernel| | 313 | __kernel| |
314 | __force| | 314 | __force| |
315 | __iomem| | 315 | __iomem| |
316 | __pmem| | ||
317 | __must_check| | 316 | __must_check| |
318 | __init_refok| | 317 | __init_refok| |
319 | __kprobes| | 318 | __kprobes| |
diff --git a/tools/testing/nvdimm/pmem-dax.c b/tools/testing/nvdimm/pmem-dax.c index 1e0218ce6a8b..c9b8c48f85fc 100644 --- a/tools/testing/nvdimm/pmem-dax.c +++ b/tools/testing/nvdimm/pmem-dax.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <nd.h> | 16 | #include <nd.h> |
17 | 17 | ||
18 | long pmem_direct_access(struct block_device *bdev, sector_t sector, | 18 | long pmem_direct_access(struct block_device *bdev, sector_t sector, |
19 | void __pmem **kaddr, pfn_t *pfn, long size) | 19 | void **kaddr, pfn_t *pfn, long size) |
20 | { | 20 | { |
21 | struct pmem_device *pmem = bdev->bd_queue->queuedata; | 21 | struct pmem_device *pmem = bdev->bd_queue->queuedata; |
22 | resource_size_t offset = sector * 512 + pmem->data_offset; | 22 | resource_size_t offset = sector * 512 + pmem->data_offset; |