Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <sbhat@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Link: https://lore.kernel.org/r/170638176942.112443.2937254675538057083.stgit@ltcd48-lp2.aus.stglab.ibm.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

authored by

Shivaprasad G Bhat and committed by
Ira Weiny
dbc8fc9d ed30a4a5

+55 -72
+2
MAINTAINERS
··· 12497 12497 F: drivers/scsi/ibmvscsi/ 12498 12498 F: drivers/tty/hvc/hvc_opal.c 12499 12499 F: drivers/watchdog/wdrtas.c 12500 + F: include/linux/papr_scm.h 12501 + F: include/uapi/linux/papr_pdsm.h 12500 12502 F: tools/testing/selftests/powerpc 12501 12503 N: /pmac 12502 12504 N: powermac
arch/powerpc/include/uapi/asm/papr_pdsm.h include/uapi/linux/papr_pdsm.h
+2 -41
arch/powerpc/platforms/pseries/papr_scm.c
··· 16 16 #include <linux/nd.h> 17 17 18 18 #include <asm/plpar_wrappers.h> 19 - #include <asm/papr_pdsm.h> 19 + #include <uapi/linux/papr_pdsm.h> 20 + #include <linux/papr_scm.h> 20 21 #include <asm/mce.h> 21 22 #include <asm/unaligned.h> 22 23 #include <linux/perf_event.h> ··· 29 28 (1ul << ND_CMD_GET_CONFIG_DATA) | \ 30 29 (1ul << ND_CMD_SET_CONFIG_DATA) | \ 31 30 (1ul << ND_CMD_CALL)) 32 - 33 - /* DIMM health bitmap indicators */ 34 - /* SCM device is unable to persist memory contents */ 35 - #define PAPR_PMEM_UNARMED (1ULL << (63 - 0)) 36 - /* SCM device failed to persist memory contents */ 37 - #define PAPR_PMEM_SHUTDOWN_DIRTY (1ULL << (63 - 1)) 38 - /* SCM device contents are persisted from previous IPL */ 39 - #define PAPR_PMEM_SHUTDOWN_CLEAN (1ULL << (63 - 2)) 40 - /* SCM device contents are not persisted from previous IPL */ 41 - #define PAPR_PMEM_EMPTY (1ULL << (63 - 3)) 42 - /* SCM device memory life remaining is critically low */ 43 - #define PAPR_PMEM_HEALTH_CRITICAL (1ULL << (63 - 4)) 44 - /* SCM device will be garded off next IPL due to failure */ 45 - #define PAPR_PMEM_HEALTH_FATAL (1ULL << (63 - 5)) 46 - /* SCM contents cannot persist due to current platform health status */ 47 - #define PAPR_PMEM_HEALTH_UNHEALTHY (1ULL << (63 - 6)) 48 - /* SCM device is unable to persist memory contents in certain conditions */ 49 - #define PAPR_PMEM_HEALTH_NON_CRITICAL (1ULL << (63 - 7)) 50 - /* SCM device is encrypted */ 51 - #define PAPR_PMEM_ENCRYPTED (1ULL << (63 - 8)) 52 - /* SCM device has been scrubbed and locked */ 53 - #define PAPR_PMEM_SCRUBBED_AND_LOCKED (1ULL << (63 - 9)) 54 - 55 - /* Bits status indicators for health bitmap indicating unarmed dimm */ 56 - #define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \ 57 - PAPR_PMEM_HEALTH_UNHEALTHY) 58 - 59 - /* Bits status indicators for health bitmap indicating unflushed dimm */ 60 - #define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY) 61 - 62 - /* Bits status indicators for health bitmap indicating unrestored dimm */ 63 - #define PAPR_PMEM_BAD_RESTORE_MASK (PAPR_PMEM_EMPTY) 64 - 65 - /* Bit status indicators for smart event notification */ 66 - #define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \ 67 - PAPR_PMEM_HEALTH_FATAL | \ 68 - PAPR_PMEM_HEALTH_UNHEALTHY) 69 - 70 - #define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS) 71 - #define PAPR_SCM_PERF_STATS_VERSION 0x1 72 31 73 32 /* Struct holding a single performance metric */ 74 33 struct papr_scm_perf_stat {
+49
include/linux/papr_scm.h
··· 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 */
+2
tools/testing/nvdimm/test/ndtest.c
··· 13 13 #include <nd-core.h> 14 14 #include <linux/printk.h> 15 15 #include <linux/seq_buf.h> 16 + #include <linux/papr_scm.h> 17 + #include <uapi/linux/papr_pdsm.h> 16 18 17 19 #include "../watermark.h" 18 20 #include "nfit_test.h"
-31
tools/testing/nvdimm/test/ndtest.h
··· 5 5 #include <linux/platform_device.h> 6 6 #include <linux/libnvdimm.h> 7 7 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 - 39 8 struct ndtest_config; 40 9 41 10 struct ndtest_priv {