Skip to content

Commit c405aa3

Browse files
committed
Merge tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull nvdimm updates from Ira Weiny: "The changes include removing duplicate code and updating the nvdimm tree to the current kernel interfaces such as using const for struct device_type and changing the platform remove callback signature" * tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: dax: remove redundant assignment to variable rc ndtest: Convert to platform remove callback returning void nvdimm/btt: always set max_integrity_segments nvdimm: remove nd_integrity_init dax: constify the struct device_type usage powerpc/papr_scm: Move duplicate definitions to common header files
2 parents a494682 + 41147b0 commit c405aa3

File tree

10 files changed

+66
-112
lines changed

10 files changed

+66
-112
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12633,6 +12633,8 @@ F: drivers/rtc/rtc-opal.c
1263312633
F: drivers/scsi/ibmvscsi/
1263412634
F: drivers/tty/hvc/hvc_opal.c
1263512635
F: drivers/watchdog/wdrtas.c
12636+
F: include/linux/papr_scm.h
12637+
F: include/uapi/linux/papr_pdsm.h
1263612638
F: tools/testing/selftests/powerpc
1263712639
N: /pmac
1263812640
N: powermac

arch/powerpc/platforms/pseries/papr_scm.c

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#include <linux/nd.h>
1717

1818
#include <asm/plpar_wrappers.h>
19-
#include <asm/papr_pdsm.h>
19+
#include <uapi/linux/papr_pdsm.h>
20+
#include <linux/papr_scm.h>
2021
#include <asm/mce.h>
2122
#include <asm/unaligned.h>
2223
#include <linux/perf_event.h>
@@ -29,46 +30,6 @@
2930
(1ul << ND_CMD_SET_CONFIG_DATA) | \
3031
(1ul << ND_CMD_CALL))
3132

32-
/* DIMM health bitmap indicators */
33-
/* SCM device is unable to persist memory contents */
34-
#define PAPR_PMEM_UNARMED (1ULL << (63 - 0))
35-
/* SCM device failed to persist memory contents */
36-
#define PAPR_PMEM_SHUTDOWN_DIRTY (1ULL << (63 - 1))
37-
/* SCM device contents are persisted from previous IPL */
38-
#define PAPR_PMEM_SHUTDOWN_CLEAN (1ULL << (63 - 2))
39-
/* SCM device contents are not persisted from previous IPL */
40-
#define PAPR_PMEM_EMPTY (1ULL << (63 - 3))
41-
/* SCM device memory life remaining is critically low */
42-
#define PAPR_PMEM_HEALTH_CRITICAL (1ULL << (63 - 4))
43-
/* SCM device will be garded off next IPL due to failure */
44-
#define PAPR_PMEM_HEALTH_FATAL (1ULL << (63 - 5))
45-
/* SCM contents cannot persist due to current platform health status */
46-
#define PAPR_PMEM_HEALTH_UNHEALTHY (1ULL << (63 - 6))
47-
/* SCM device is unable to persist memory contents in certain conditions */
48-
#define PAPR_PMEM_HEALTH_NON_CRITICAL (1ULL << (63 - 7))
49-
/* SCM device is encrypted */
50-
#define PAPR_PMEM_ENCRYPTED (1ULL << (63 - 8))
51-
/* SCM device has been scrubbed and locked */
52-
#define PAPR_PMEM_SCRUBBED_AND_LOCKED (1ULL << (63 - 9))
53-
54-
/* Bits status indicators for health bitmap indicating unarmed dimm */
55-
#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \
56-
PAPR_PMEM_HEALTH_UNHEALTHY)
57-
58-
/* Bits status indicators for health bitmap indicating unflushed dimm */
59-
#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)
60-
61-
/* Bits status indicators for health bitmap indicating unrestored dimm */
62-
#define PAPR_PMEM_BAD_RESTORE_MASK (PAPR_PMEM_EMPTY)
63-
64-
/* Bit status indicators for smart event notification */
65-
#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
66-
PAPR_PMEM_HEALTH_FATAL | \
67-
PAPR_PMEM_HEALTH_UNHEALTHY)
68-
69-
#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)
70-
#define PAPR_SCM_PERF_STATS_VERSION 0x1
71-
7233
/* Struct holding a single performance metric */
7334
struct papr_scm_perf_stat {
7435
u8 stat_id[8];

drivers/dax/bus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static const struct attribute_group *dax_mapping_attribute_groups[] = {
818818
NULL,
819819
};
820820

821-
static struct device_type dax_mapping_type = {
821+
static const struct device_type dax_mapping_type = {
822822
.release = dax_mapping_release,
823823
.groups = dax_mapping_attribute_groups,
824824
};
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
12041204
if (rc)
12051205
return rc;
12061206

1207-
rc = -ENXIO;
12081207
rc = down_write_killable(&dax_region_rwsem);
12091208
if (rc)
12101209
return rc;

drivers/nvdimm/btt.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/highmem.h>
77
#include <linux/debugfs.h>
88
#include <linux/blkdev.h>
9+
#include <linux/blk-integrity.h>
910
#include <linux/pagemap.h>
1011
#include <linux/module.h>
1112
#include <linux/device.h>
@@ -1499,6 +1500,7 @@ static int btt_blk_init(struct btt *btt)
14991500
struct queue_limits lim = {
15001501
.logical_block_size = btt->sector_size,
15011502
.max_hw_sectors = UINT_MAX,
1503+
.max_integrity_segments = 1,
15021504
};
15031505
int rc;
15041506

@@ -1514,10 +1516,12 @@ static int btt_blk_init(struct btt *btt)
15141516
blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
15151517
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
15161518

1517-
if (btt_meta_size(btt)) {
1518-
rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
1519-
if (rc)
1520-
goto out_cleanup_disk;
1519+
if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
1520+
struct blk_integrity bi = {
1521+
.tuple_size = btt_meta_size(btt),
1522+
.tag_size = btt_meta_size(btt),
1523+
};
1524+
blk_integrity_register(btt->btt_disk, &bi);
15211525
}
15221526

15231527
set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);

drivers/nvdimm/core.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <linux/export.h>
88
#include <linux/module.h>
99
#include <linux/blkdev.h>
10-
#include <linux/blk-integrity.h>
1110
#include <linux/device.h>
1211
#include <linux/ctype.h>
1312
#include <linux/ndctl.h>
@@ -508,35 +507,6 @@ int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length)
508507
}
509508
EXPORT_SYMBOL_GPL(nvdimm_bus_add_badrange);
510509

511-
#ifdef CONFIG_BLK_DEV_INTEGRITY
512-
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
513-
{
514-
struct blk_integrity bi;
515-
516-
if (meta_size == 0)
517-
return 0;
518-
519-
memset(&bi, 0, sizeof(bi));
520-
521-
bi.tuple_size = meta_size;
522-
bi.tag_size = meta_size;
523-
524-
blk_integrity_register(disk, &bi);
525-
blk_queue_max_integrity_segments(disk->queue, 1);
526-
527-
return 0;
528-
}
529-
EXPORT_SYMBOL(nd_integrity_init);
530-
531-
#else /* CONFIG_BLK_DEV_INTEGRITY */
532-
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
533-
{
534-
return 0;
535-
}
536-
EXPORT_SYMBOL(nd_integrity_init);
537-
538-
#endif
539-
540510
static __init int libnvdimm_init(void)
541511
{
542512
int rc;

drivers/nvdimm/nd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ enum nd_async_mode {
489489
ND_ASYNC,
490490
};
491491

492-
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size);
493492
void wait_nvdimm_bus_probe_idle(struct device *dev);
494493
void nd_device_register(struct device *dev);
495494
void nd_device_unregister(struct device *dev, enum nd_async_mode mode);

include/linux/papr_scm.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#ifndef __LINUX_PAPR_SCM_H
3+
#define __LINUX_PAPR_SCM_H
4+
5+
/* DIMM health bitmap indicators */
6+
/* SCM device is unable to persist memory contents */
7+
#define PAPR_PMEM_UNARMED (1ULL << (63 - 0))
8+
/* SCM device failed to persist memory contents */
9+
#define PAPR_PMEM_SHUTDOWN_DIRTY (1ULL << (63 - 1))
10+
/* SCM device contents are persisted from previous IPL */
11+
#define PAPR_PMEM_SHUTDOWN_CLEAN (1ULL << (63 - 2))
12+
/* SCM device contents are not persisted from previous IPL */
13+
#define PAPR_PMEM_EMPTY (1ULL << (63 - 3))
14+
/* SCM device memory life remaining is critically low */
15+
#define PAPR_PMEM_HEALTH_CRITICAL (1ULL << (63 - 4))
16+
/* SCM device will be garded off next IPL due to failure */
17+
#define PAPR_PMEM_HEALTH_FATAL (1ULL << (63 - 5))
18+
/* SCM contents cannot persist due to current platform health status */
19+
#define PAPR_PMEM_HEALTH_UNHEALTHY (1ULL << (63 - 6))
20+
/* SCM device is unable to persist memory contents in certain conditions */
21+
#define PAPR_PMEM_HEALTH_NON_CRITICAL (1ULL << (63 - 7))
22+
/* SCM device is encrypted */
23+
#define PAPR_PMEM_ENCRYPTED (1ULL << (63 - 8))
24+
/* SCM device has been scrubbed and locked */
25+
#define PAPR_PMEM_SCRUBBED_AND_LOCKED (1ULL << (63 - 9))
26+
27+
#define PAPR_PMEM_SAVE_FAILED (1ULL << (63 - 10))
28+
29+
/* Bits status indicators for health bitmap indicating unarmed dimm */
30+
#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \
31+
PAPR_PMEM_HEALTH_UNHEALTHY)
32+
33+
/* Bits status indicators for health bitmap indicating unflushed dimm */
34+
#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)
35+
36+
/* Bits status indicators for health bitmap indicating unrestored dimm */
37+
#define PAPR_PMEM_BAD_RESTORE_MASK (PAPR_PMEM_EMPTY)
38+
39+
/* Bit status indicators for smart event notification */
40+
#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
41+
PAPR_PMEM_HEALTH_FATAL | \
42+
PAPR_PMEM_HEALTH_UNHEALTHY)
43+
44+
#define PAPR_PMEM_SAVE_MASK (PAPR_PMEM_SAVE_FAILED)
45+
46+
#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)
47+
#define PAPR_SCM_PERF_STATS_VERSION 0x1
48+
49+
#endif /* __LINUX_PAPR_SCM_H */

tools/testing/nvdimm/test/ndtest.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <nd-core.h>
1414
#include <linux/printk.h>
1515
#include <linux/seq_buf.h>
16+
#include <linux/papr_scm.h>
17+
#include <uapi/linux/papr_pdsm.h>
1618

1719
#include "../watermark.h"
1820
#include "nfit_test.h"
@@ -830,12 +832,11 @@ static int ndtest_bus_register(struct ndtest_priv *p)
830832
return 0;
831833
}
832834

833-
static int ndtest_remove(struct platform_device *pdev)
835+
static void ndtest_remove(struct platform_device *pdev)
834836
{
835837
struct ndtest_priv *p = to_ndtest_priv(&pdev->dev);
836838

837839
nvdimm_bus_unregister(p->bus);
838-
return 0;
839840
}
840841

841842
static int ndtest_probe(struct platform_device *pdev)
@@ -882,7 +883,7 @@ static const struct platform_device_id ndtest_id[] = {
882883

883884
static struct platform_driver ndtest_driver = {
884885
.probe = ndtest_probe,
885-
.remove = ndtest_remove,
886+
.remove_new = ndtest_remove,
886887
.driver = {
887888
.name = KBUILD_MODNAME,
888889
},

tools/testing/nvdimm/test/ndtest.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,6 @@
55
#include <linux/platform_device.h>
66
#include <linux/libnvdimm.h>
77

8-
/* SCM device is unable to persist memory contents */
9-
#define PAPR_PMEM_UNARMED (1ULL << (63 - 0))
10-
/* SCM device failed to persist memory contents */
11-
#define PAPR_PMEM_SHUTDOWN_DIRTY (1ULL << (63 - 1))
12-
/* SCM device contents are not persisted from previous IPL */
13-
#define PAPR_PMEM_EMPTY (1ULL << (63 - 3))
14-
#define PAPR_PMEM_HEALTH_CRITICAL (1ULL << (63 - 4))
15-
/* SCM device will be garded off next IPL due to failure */
16-
#define PAPR_PMEM_HEALTH_FATAL (1ULL << (63 - 5))
17-
/* SCM contents cannot persist due to current platform health status */
18-
#define PAPR_PMEM_HEALTH_UNHEALTHY (1ULL << (63 - 6))
19-
20-
/* Bits status indicators for health bitmap indicating unarmed dimm */
21-
#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \
22-
PAPR_PMEM_HEALTH_UNHEALTHY)
23-
24-
#define PAPR_PMEM_SAVE_FAILED (1ULL << (63 - 10))
25-
26-
/* Bits status indicators for health bitmap indicating unflushed dimm */
27-
#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)
28-
29-
/* Bits status indicators for health bitmap indicating unrestored dimm */
30-
#define PAPR_PMEM_BAD_RESTORE_MASK (PAPR_PMEM_EMPTY)
31-
32-
/* Bit status indicators for smart event notification */
33-
#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
34-
PAPR_PMEM_HEALTH_FATAL | \
35-
PAPR_PMEM_HEALTH_UNHEALTHY)
36-
37-
#define PAPR_PMEM_SAVE_MASK (PAPR_PMEM_SAVE_FAILED)
38-
398
struct ndtest_config;
409

4110
struct ndtest_priv {

0 commit comments

Comments
 (0)