Skip to content

Commit dbc8fc9

Browse files
ShivaprasadGBhatweiny2
authored andcommitted
powerpc/papr_scm: Move duplicate definitions to common header files
papr_scm and ndtest share common PDSM payload structs like nd_papr_pdsm_health. Presently these structs are duplicated across papr_pdsm.h and ndtest.h header files. Since 'ndtest' is essentially arch independent and can run on platforms other than PPC64, a way needs to be deviced to avoid redundancy and duplication of PDSM structs in future. So the patch proposes moving the PDSM header from arch/powerpc/include- -/uapi/ to the generic include/uapi/linux directory. Also, there are some #defines common between papr_scm and ndtest which are not exported to the user space. So, move them to a header file which can be shared across ndtest and papr_scm via newly introduced include/linux/papr_scm.h. Signed-off-by: Shivaprasad G Bhat <[email protected]> Signed-off-by: Vaibhav Jain <[email protected]> Suggested-by: Aneesh Kumar K.V <[email protected]> Link: https://lore.kernel.org/r/170638176942.112443.2937254675538057083.stgit@ltcd48-lp2.aus.stglab.ibm.com Signed-off-by: Ira Weiny <[email protected]>
1 parent ed30a4a commit dbc8fc9

File tree

6 files changed

+55
-72
lines changed

6 files changed

+55
-72
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12497,6 +12497,8 @@ F: drivers/rtc/rtc-opal.c
1249712497
F: drivers/scsi/ibmvscsi/
1249812498
F: drivers/tty/hvc/hvc_opal.c
1249912499
F: drivers/watchdog/wdrtas.c
12500+
F: include/linux/papr_scm.h
12501+
F: include/uapi/linux/papr_pdsm.h
1250012502
F: tools/testing/selftests/powerpc
1250112503
N: /pmac
1250212504
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];

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: 2 additions & 0 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"

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)