diff options
author | Hari Bathini <hbathini@linux.ibm.com> | 2019-09-11 10:50:12 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2019-09-13 10:04:43 -0400 |
commit | 6f5f193e84d3d7b55d406ecc7ac4ea1ef1d1876f (patch) | |
tree | 220a2f5b70fae35ffa584b9848780b8668a29d8b | |
parent | 1679b96e69ec2e10ccd9d82b691ade0b16cb64d1 (diff) |
powerpc/opal: add MPIPL interface definitions
MPIPL is Memory Preserving IPL supported from POWER9. This enables the
kernel to reset the system with memory 'preserved'. Also, it supports
copying memory from a source address to some destination address during
MPIPL boot. Add MPIPL interface definitions here to leverage these f/w
features in adding FADump support for PowerNV platform.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/156821340710.5656.10071829040515662624.stgit@hbathini.in.ibm.com
-rw-r--r-- | arch/powerpc/include/asm/opal-api.h | 44 | ||||
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-call.c | 3 |
3 files changed, 51 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 1cad413e1e0e..378e3997845a 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h | |||
@@ -208,7 +208,10 @@ | |||
208 | #define OPAL_HANDLE_HMI2 166 | 208 | #define OPAL_HANDLE_HMI2 166 |
209 | #define OPAL_NX_COPROC_INIT 167 | 209 | #define OPAL_NX_COPROC_INIT 167 |
210 | #define OPAL_XIVE_GET_VP_STATE 170 | 210 | #define OPAL_XIVE_GET_VP_STATE 170 |
211 | #define OPAL_LAST 170 | 211 | #define OPAL_MPIPL_UPDATE 173 |
212 | #define OPAL_MPIPL_REGISTER_TAG 174 | ||
213 | #define OPAL_MPIPL_QUERY_TAG 175 | ||
214 | #define OPAL_LAST 175 | ||
212 | 215 | ||
213 | #define QUIESCE_HOLD 1 /* Spin all calls at entry */ | 216 | #define QUIESCE_HOLD 1 /* Spin all calls at entry */ |
214 | #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ | 217 | #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ |
@@ -1060,6 +1063,7 @@ enum { | |||
1060 | OPAL_REBOOT_NORMAL = 0, | 1063 | OPAL_REBOOT_NORMAL = 0, |
1061 | OPAL_REBOOT_PLATFORM_ERROR = 1, | 1064 | OPAL_REBOOT_PLATFORM_ERROR = 1, |
1062 | OPAL_REBOOT_FULL_IPL = 2, | 1065 | OPAL_REBOOT_FULL_IPL = 2, |
1066 | OPAL_REBOOT_MPIPL = 3, | ||
1063 | }; | 1067 | }; |
1064 | 1068 | ||
1065 | /* Argument to OPAL_PCI_TCE_KILL */ | 1069 | /* Argument to OPAL_PCI_TCE_KILL */ |
@@ -1136,6 +1140,44 @@ enum { | |||
1136 | #define OPAL_PCI_P2P_LOAD 0x2 | 1140 | #define OPAL_PCI_P2P_LOAD 0x2 |
1137 | #define OPAL_PCI_P2P_STORE 0x4 | 1141 | #define OPAL_PCI_P2P_STORE 0x4 |
1138 | 1142 | ||
1143 | /* MPIPL update operations */ | ||
1144 | enum opal_mpipl_ops { | ||
1145 | OPAL_MPIPL_ADD_RANGE = 0, | ||
1146 | OPAL_MPIPL_REMOVE_RANGE = 1, | ||
1147 | OPAL_MPIPL_REMOVE_ALL = 2, | ||
1148 | OPAL_MPIPL_FREE_PRESERVED_MEMORY = 3, | ||
1149 | }; | ||
1150 | |||
1151 | /* Tag will point to various metadata area. Kernel will | ||
1152 | * use tag to get metadata value. | ||
1153 | */ | ||
1154 | enum opal_mpipl_tags { | ||
1155 | OPAL_MPIPL_TAG_CPU = 0, | ||
1156 | OPAL_MPIPL_TAG_OPAL = 1, | ||
1157 | OPAL_MPIPL_TAG_KERNEL = 2, | ||
1158 | OPAL_MPIPL_TAG_BOOT_MEM = 3, | ||
1159 | }; | ||
1160 | |||
1161 | /* Preserved memory details */ | ||
1162 | struct opal_mpipl_region { | ||
1163 | __be64 src; | ||
1164 | __be64 dest; | ||
1165 | __be64 size; | ||
1166 | }; | ||
1167 | |||
1168 | /* Structure version */ | ||
1169 | #define OPAL_MPIPL_VERSION 0x01 | ||
1170 | |||
1171 | struct opal_mpipl_fadump { | ||
1172 | u8 version; | ||
1173 | u8 reserved[7]; | ||
1174 | __be32 crashing_pir; /* OPAL crashing CPU PIR */ | ||
1175 | __be32 cpu_data_version; | ||
1176 | __be32 cpu_data_size; | ||
1177 | __be32 region_cnt; | ||
1178 | struct opal_mpipl_region region[]; | ||
1179 | } __packed; | ||
1180 | |||
1139 | #endif /* __ASSEMBLY__ */ | 1181 | #endif /* __ASSEMBLY__ */ |
1140 | 1182 | ||
1141 | #endif /* __OPAL_API_H */ | 1183 | #endif /* __OPAL_API_H */ |
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index d5a0807d21db..a0cf8fba4d12 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -39,6 +39,7 @@ int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn, | |||
39 | uint64_t PE_handle); | 39 | uint64_t PE_handle); |
40 | int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap, | 40 | int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap, |
41 | uint64_t rate_phys, uint32_t size); | 41 | uint64_t rate_phys, uint32_t size); |
42 | |||
42 | int64_t opal_console_write(int64_t term_number, __be64 *length, | 43 | int64_t opal_console_write(int64_t term_number, __be64 *length, |
43 | const uint8_t *buffer); | 44 | const uint8_t *buffer); |
44 | int64_t opal_console_read(int64_t term_number, __be64 *length, | 45 | int64_t opal_console_read(int64_t term_number, __be64 *length, |
@@ -297,6 +298,10 @@ int opal_sensor_group_clear(u32 group_hndl, int token); | |||
297 | int opal_sensor_group_enable(u32 group_hndl, int token, bool enable); | 298 | int opal_sensor_group_enable(u32 group_hndl, int token, bool enable); |
298 | int opal_nx_coproc_init(uint32_t chip_id, uint32_t ct); | 299 | int opal_nx_coproc_init(uint32_t chip_id, uint32_t ct); |
299 | 300 | ||
301 | s64 opal_mpipl_update(enum opal_mpipl_ops op, u64 src, u64 dest, u64 size); | ||
302 | s64 opal_mpipl_register_tag(enum opal_mpipl_tags tag, u64 addr); | ||
303 | s64 opal_mpipl_query_tag(enum opal_mpipl_tags tag, u64 *addr); | ||
304 | |||
300 | s64 opal_signal_system_reset(s32 cpu); | 305 | s64 opal_signal_system_reset(s32 cpu); |
301 | s64 opal_quiesce(u64 shutdown_type, s32 cpu); | 306 | s64 opal_quiesce(u64 shutdown_type, s32 cpu); |
302 | 307 | ||
diff --git a/arch/powerpc/platforms/powernv/opal-call.c b/arch/powerpc/platforms/powernv/opal-call.c index dccdc9df5213..a2aa5e433ac8 100644 --- a/arch/powerpc/platforms/powernv/opal-call.c +++ b/arch/powerpc/platforms/powernv/opal-call.c | |||
@@ -287,3 +287,6 @@ OPAL_CALL(opal_pci_set_pbcq_tunnel_bar, OPAL_PCI_SET_PBCQ_TUNNEL_BAR); | |||
287 | OPAL_CALL(opal_sensor_read_u64, OPAL_SENSOR_READ_U64); | 287 | OPAL_CALL(opal_sensor_read_u64, OPAL_SENSOR_READ_U64); |
288 | OPAL_CALL(opal_sensor_group_enable, OPAL_SENSOR_GROUP_ENABLE); | 288 | OPAL_CALL(opal_sensor_group_enable, OPAL_SENSOR_GROUP_ENABLE); |
289 | OPAL_CALL(opal_nx_coproc_init, OPAL_NX_COPROC_INIT); | 289 | OPAL_CALL(opal_nx_coproc_init, OPAL_NX_COPROC_INIT); |
290 | OPAL_CALL(opal_mpipl_update, OPAL_MPIPL_UPDATE); | ||
291 | OPAL_CALL(opal_mpipl_register_tag, OPAL_MPIPL_REGISTER_TAG); | ||
292 | OPAL_CALL(opal_mpipl_query_tag, OPAL_MPIPL_QUERY_TAG); | ||