| .. | .. |
|---|
| 29 | 29 | #include <asm/checksum.h> |
|---|
| 30 | 30 | #include <asm/debug.h> |
|---|
| 31 | 31 | #include <asm/os_info.h> |
|---|
| 32 | +#include <asm/sections.h> |
|---|
| 33 | +#include <asm/boot_data.h> |
|---|
| 32 | 34 | #include "entry.h" |
|---|
| 33 | 35 | |
|---|
| 34 | 36 | #define IPL_PARM_BLOCK_VERSION 0 |
|---|
| .. | .. |
|---|
| 37 | 39 | #define IPL_CCW_STR "ccw" |
|---|
| 38 | 40 | #define IPL_FCP_STR "fcp" |
|---|
| 39 | 41 | #define IPL_FCP_DUMP_STR "fcp_dump" |
|---|
| 42 | +#define IPL_NVME_STR "nvme" |
|---|
| 43 | +#define IPL_NVME_DUMP_STR "nvme_dump" |
|---|
| 40 | 44 | #define IPL_NSS_STR "nss" |
|---|
| 41 | 45 | |
|---|
| 42 | 46 | #define DUMP_CCW_STR "ccw" |
|---|
| 43 | 47 | #define DUMP_FCP_STR "fcp" |
|---|
| 48 | +#define DUMP_NVME_STR "nvme" |
|---|
| 44 | 49 | #define DUMP_NONE_STR "none" |
|---|
| 45 | 50 | |
|---|
| 46 | 51 | /* |
|---|
| .. | .. |
|---|
| 91 | 96 | return IPL_FCP_DUMP_STR; |
|---|
| 92 | 97 | case IPL_TYPE_NSS: |
|---|
| 93 | 98 | return IPL_NSS_STR; |
|---|
| 99 | + case IPL_TYPE_NVME: |
|---|
| 100 | + return IPL_NVME_STR; |
|---|
| 101 | + case IPL_TYPE_NVME_DUMP: |
|---|
| 102 | + return IPL_NVME_DUMP_STR; |
|---|
| 94 | 103 | case IPL_TYPE_UNKNOWN: |
|---|
| 95 | 104 | default: |
|---|
| 96 | 105 | return IPL_UNKNOWN_STR; |
|---|
| .. | .. |
|---|
| 101 | 110 | DUMP_TYPE_NONE = 1, |
|---|
| 102 | 111 | DUMP_TYPE_CCW = 2, |
|---|
| 103 | 112 | DUMP_TYPE_FCP = 4, |
|---|
| 113 | + DUMP_TYPE_NVME = 8, |
|---|
| 104 | 114 | }; |
|---|
| 105 | 115 | |
|---|
| 106 | 116 | static char *dump_type_str(enum dump_type type) |
|---|
| .. | .. |
|---|
| 112 | 122 | return DUMP_CCW_STR; |
|---|
| 113 | 123 | case DUMP_TYPE_FCP: |
|---|
| 114 | 124 | return DUMP_FCP_STR; |
|---|
| 125 | + case DUMP_TYPE_NVME: |
|---|
| 126 | + return DUMP_NVME_STR; |
|---|
| 115 | 127 | default: |
|---|
| 116 | 128 | return NULL; |
|---|
| 117 | 129 | } |
|---|
| 118 | 130 | } |
|---|
| 119 | 131 | |
|---|
| 120 | | -static int ipl_block_valid; |
|---|
| 121 | | -static struct ipl_parameter_block ipl_block; |
|---|
| 132 | +int __bootdata_preserved(ipl_block_valid); |
|---|
| 133 | +struct ipl_parameter_block __bootdata_preserved(ipl_block); |
|---|
| 134 | +int __bootdata_preserved(ipl_secure_flag); |
|---|
| 135 | + |
|---|
| 136 | +unsigned long __bootdata_preserved(ipl_cert_list_addr); |
|---|
| 137 | +unsigned long __bootdata_preserved(ipl_cert_list_size); |
|---|
| 138 | + |
|---|
| 139 | +unsigned long __bootdata(early_ipl_comp_list_addr); |
|---|
| 140 | +unsigned long __bootdata(early_ipl_comp_list_size); |
|---|
| 122 | 141 | |
|---|
| 123 | 142 | static int reipl_capabilities = IPL_TYPE_UNKNOWN; |
|---|
| 124 | 143 | |
|---|
| 125 | 144 | static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; |
|---|
| 126 | 145 | static struct ipl_parameter_block *reipl_block_fcp; |
|---|
| 146 | +static struct ipl_parameter_block *reipl_block_nvme; |
|---|
| 127 | 147 | static struct ipl_parameter_block *reipl_block_ccw; |
|---|
| 128 | 148 | static struct ipl_parameter_block *reipl_block_nss; |
|---|
| 129 | 149 | static struct ipl_parameter_block *reipl_block_actual; |
|---|
| .. | .. |
|---|
| 131 | 151 | static int dump_capabilities = DUMP_TYPE_NONE; |
|---|
| 132 | 152 | static enum dump_type dump_type = DUMP_TYPE_NONE; |
|---|
| 133 | 153 | static struct ipl_parameter_block *dump_block_fcp; |
|---|
| 154 | +static struct ipl_parameter_block *dump_block_nvme; |
|---|
| 134 | 155 | static struct ipl_parameter_block *dump_block_ccw; |
|---|
| 135 | 156 | |
|---|
| 136 | 157 | static struct sclp_ipl_info sclp_ipl_info; |
|---|
| 158 | + |
|---|
| 159 | +static bool reipl_nvme_clear; |
|---|
| 160 | +static bool reipl_fcp_clear; |
|---|
| 161 | +static bool reipl_ccw_clear; |
|---|
| 137 | 162 | |
|---|
| 138 | 163 | static inline int __diag308(unsigned long subcode, void *addr) |
|---|
| 139 | 164 | { |
|---|
| .. | .. |
|---|
| 151 | 176 | |
|---|
| 152 | 177 | int diag308(unsigned long subcode, void *addr) |
|---|
| 153 | 178 | { |
|---|
| 179 | + if (IS_ENABLED(CONFIG_KASAN)) |
|---|
| 180 | + __arch_local_irq_stosm(0x04); /* enable DAT */ |
|---|
| 154 | 181 | diag_stat_inc(DIAG_STAT_X308); |
|---|
| 155 | 182 | return __diag308(subcode, addr); |
|---|
| 156 | 183 | } |
|---|
| .. | .. |
|---|
| 163 | 190 | struct kobj_attribute *attr, \ |
|---|
| 164 | 191 | char *page) \ |
|---|
| 165 | 192 | { \ |
|---|
| 166 | | - return snprintf(page, PAGE_SIZE, _format, ##args); \ |
|---|
| 193 | + return scnprintf(page, PAGE_SIZE, _format, ##args); \ |
|---|
| 167 | 194 | } |
|---|
| 168 | 195 | |
|---|
| 169 | 196 | #define IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk) \ |
|---|
| .. | .. |
|---|
| 239 | 266 | if (!ipl_block_valid) |
|---|
| 240 | 267 | return IPL_TYPE_UNKNOWN; |
|---|
| 241 | 268 | |
|---|
| 242 | | - switch (ipl_block.hdr.pbt) { |
|---|
| 243 | | - case DIAG308_IPL_TYPE_CCW: |
|---|
| 269 | + switch (ipl_block.pb0_hdr.pbt) { |
|---|
| 270 | + case IPL_PBT_CCW: |
|---|
| 244 | 271 | return IPL_TYPE_CCW; |
|---|
| 245 | | - case DIAG308_IPL_TYPE_FCP: |
|---|
| 246 | | - if (ipl_block.ipl_info.fcp.opt == DIAG308_IPL_OPT_DUMP) |
|---|
| 272 | + case IPL_PBT_FCP: |
|---|
| 273 | + if (ipl_block.fcp.opt == IPL_PB0_FCP_OPT_DUMP) |
|---|
| 247 | 274 | return IPL_TYPE_FCP_DUMP; |
|---|
| 248 | 275 | else |
|---|
| 249 | 276 | return IPL_TYPE_FCP; |
|---|
| 277 | + case IPL_PBT_NVME: |
|---|
| 278 | + if (ipl_block.nvme.opt == IPL_PB0_NVME_OPT_DUMP) |
|---|
| 279 | + return IPL_TYPE_NVME_DUMP; |
|---|
| 280 | + else |
|---|
| 281 | + return IPL_TYPE_NVME; |
|---|
| 250 | 282 | } |
|---|
| 251 | 283 | return IPL_TYPE_UNKNOWN; |
|---|
| 252 | 284 | } |
|---|
| .. | .. |
|---|
| 262 | 294 | |
|---|
| 263 | 295 | static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); |
|---|
| 264 | 296 | |
|---|
| 265 | | -/* VM IPL PARM routines */ |
|---|
| 266 | | -static size_t reipl_get_ascii_vmparm(char *dest, size_t size, |
|---|
| 267 | | - const struct ipl_parameter_block *ipb) |
|---|
| 297 | +static ssize_t ipl_secure_show(struct kobject *kobj, |
|---|
| 298 | + struct kobj_attribute *attr, char *page) |
|---|
| 268 | 299 | { |
|---|
| 269 | | - int i; |
|---|
| 270 | | - size_t len; |
|---|
| 271 | | - char has_lowercase = 0; |
|---|
| 272 | | - |
|---|
| 273 | | - len = 0; |
|---|
| 274 | | - if ((ipb->ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID) && |
|---|
| 275 | | - (ipb->ipl_info.ccw.vm_parm_len > 0)) { |
|---|
| 276 | | - |
|---|
| 277 | | - len = min_t(size_t, size - 1, ipb->ipl_info.ccw.vm_parm_len); |
|---|
| 278 | | - memcpy(dest, ipb->ipl_info.ccw.vm_parm, len); |
|---|
| 279 | | - /* If at least one character is lowercase, we assume mixed |
|---|
| 280 | | - * case; otherwise we convert everything to lowercase. |
|---|
| 281 | | - */ |
|---|
| 282 | | - for (i = 0; i < len; i++) |
|---|
| 283 | | - if ((dest[i] > 0x80 && dest[i] < 0x8a) || /* a-i */ |
|---|
| 284 | | - (dest[i] > 0x90 && dest[i] < 0x9a) || /* j-r */ |
|---|
| 285 | | - (dest[i] > 0xa1 && dest[i] < 0xaa)) { /* s-z */ |
|---|
| 286 | | - has_lowercase = 1; |
|---|
| 287 | | - break; |
|---|
| 288 | | - } |
|---|
| 289 | | - if (!has_lowercase) |
|---|
| 290 | | - EBC_TOLOWER(dest, len); |
|---|
| 291 | | - EBCASC(dest, len); |
|---|
| 292 | | - } |
|---|
| 293 | | - dest[len] = 0; |
|---|
| 294 | | - |
|---|
| 295 | | - return len; |
|---|
| 300 | + return sprintf(page, "%i\n", !!ipl_secure_flag); |
|---|
| 296 | 301 | } |
|---|
| 297 | 302 | |
|---|
| 298 | | -size_t append_ipl_vmparm(char *dest, size_t size) |
|---|
| 299 | | -{ |
|---|
| 300 | | - size_t rc; |
|---|
| 303 | +static struct kobj_attribute sys_ipl_secure_attr = |
|---|
| 304 | + __ATTR(secure, 0444, ipl_secure_show, NULL); |
|---|
| 301 | 305 | |
|---|
| 302 | | - rc = 0; |
|---|
| 303 | | - if (ipl_block_valid && ipl_block.hdr.pbt == DIAG308_IPL_TYPE_CCW) |
|---|
| 304 | | - rc = reipl_get_ascii_vmparm(dest, size, &ipl_block); |
|---|
| 305 | | - else |
|---|
| 306 | | - dest[0] = 0; |
|---|
| 307 | | - return rc; |
|---|
| 306 | +static ssize_t ipl_has_secure_show(struct kobject *kobj, |
|---|
| 307 | + struct kobj_attribute *attr, char *page) |
|---|
| 308 | +{ |
|---|
| 309 | + return sprintf(page, "%i\n", !!sclp.has_sipl); |
|---|
| 308 | 310 | } |
|---|
| 311 | + |
|---|
| 312 | +static struct kobj_attribute sys_ipl_has_secure_attr = |
|---|
| 313 | + __ATTR(has_secure, 0444, ipl_has_secure_show, NULL); |
|---|
| 309 | 314 | |
|---|
| 310 | 315 | static ssize_t ipl_vm_parm_show(struct kobject *kobj, |
|---|
| 311 | 316 | struct kobj_attribute *attr, char *page) |
|---|
| 312 | 317 | { |
|---|
| 313 | 318 | char parm[DIAG308_VMPARM_SIZE + 1] = {}; |
|---|
| 314 | 319 | |
|---|
| 315 | | - append_ipl_vmparm(parm, sizeof(parm)); |
|---|
| 320 | + if (ipl_block_valid && (ipl_block.pb0_hdr.pbt == IPL_PBT_CCW)) |
|---|
| 321 | + ipl_block_get_ascii_vmparm(parm, sizeof(parm), &ipl_block); |
|---|
| 316 | 322 | return sprintf(page, "%s\n", parm); |
|---|
| 317 | 323 | } |
|---|
| 318 | | - |
|---|
| 319 | | -static size_t scpdata_length(const char* buf, size_t count) |
|---|
| 320 | | -{ |
|---|
| 321 | | - while (count) { |
|---|
| 322 | | - if (buf[count - 1] != '\0' && buf[count - 1] != ' ') |
|---|
| 323 | | - break; |
|---|
| 324 | | - count--; |
|---|
| 325 | | - } |
|---|
| 326 | | - return count; |
|---|
| 327 | | -} |
|---|
| 328 | | - |
|---|
| 329 | | -static size_t reipl_append_ascii_scpdata(char *dest, size_t size, |
|---|
| 330 | | - const struct ipl_parameter_block *ipb) |
|---|
| 331 | | -{ |
|---|
| 332 | | - size_t count; |
|---|
| 333 | | - size_t i; |
|---|
| 334 | | - int has_lowercase; |
|---|
| 335 | | - |
|---|
| 336 | | - count = min(size - 1, scpdata_length(ipb->ipl_info.fcp.scp_data, |
|---|
| 337 | | - ipb->ipl_info.fcp.scp_data_len)); |
|---|
| 338 | | - if (!count) |
|---|
| 339 | | - goto out; |
|---|
| 340 | | - |
|---|
| 341 | | - has_lowercase = 0; |
|---|
| 342 | | - for (i = 0; i < count; i++) { |
|---|
| 343 | | - if (!isascii(ipb->ipl_info.fcp.scp_data[i])) { |
|---|
| 344 | | - count = 0; |
|---|
| 345 | | - goto out; |
|---|
| 346 | | - } |
|---|
| 347 | | - if (!has_lowercase && islower(ipb->ipl_info.fcp.scp_data[i])) |
|---|
| 348 | | - has_lowercase = 1; |
|---|
| 349 | | - } |
|---|
| 350 | | - |
|---|
| 351 | | - if (has_lowercase) |
|---|
| 352 | | - memcpy(dest, ipb->ipl_info.fcp.scp_data, count); |
|---|
| 353 | | - else |
|---|
| 354 | | - for (i = 0; i < count; i++) |
|---|
| 355 | | - dest[i] = tolower(ipb->ipl_info.fcp.scp_data[i]); |
|---|
| 356 | | -out: |
|---|
| 357 | | - dest[count] = '\0'; |
|---|
| 358 | | - return count; |
|---|
| 359 | | -} |
|---|
| 360 | | - |
|---|
| 361 | | -size_t append_ipl_scpdata(char *dest, size_t len) |
|---|
| 362 | | -{ |
|---|
| 363 | | - size_t rc; |
|---|
| 364 | | - |
|---|
| 365 | | - rc = 0; |
|---|
| 366 | | - if (ipl_block_valid && ipl_block.hdr.pbt == DIAG308_IPL_TYPE_FCP) |
|---|
| 367 | | - rc = reipl_append_ascii_scpdata(dest, len, &ipl_block); |
|---|
| 368 | | - else |
|---|
| 369 | | - dest[0] = 0; |
|---|
| 370 | | - return rc; |
|---|
| 371 | | -} |
|---|
| 372 | | - |
|---|
| 373 | 324 | |
|---|
| 374 | 325 | static struct kobj_attribute sys_ipl_vm_parm_attr = |
|---|
| 375 | 326 | __ATTR(parm, S_IRUGO, ipl_vm_parm_show, NULL); |
|---|
| .. | .. |
|---|
| 379 | 330 | { |
|---|
| 380 | 331 | switch (ipl_info.type) { |
|---|
| 381 | 332 | case IPL_TYPE_CCW: |
|---|
| 382 | | - return sprintf(page, "0.%x.%04x\n", ipl_block.ipl_info.ccw.ssid, |
|---|
| 383 | | - ipl_block.ipl_info.ccw.devno); |
|---|
| 333 | + return sprintf(page, "0.%x.%04x\n", ipl_block.ccw.ssid, |
|---|
| 334 | + ipl_block.ccw.devno); |
|---|
| 384 | 335 | case IPL_TYPE_FCP: |
|---|
| 385 | 336 | case IPL_TYPE_FCP_DUMP: |
|---|
| 386 | | - return sprintf(page, "0.0.%04x\n", |
|---|
| 387 | | - ipl_block.ipl_info.fcp.devno); |
|---|
| 337 | + return sprintf(page, "0.0.%04x\n", ipl_block.fcp.devno); |
|---|
| 338 | + case IPL_TYPE_NVME: |
|---|
| 339 | + case IPL_TYPE_NVME_DUMP: |
|---|
| 340 | + return sprintf(page, "%08ux\n", ipl_block.nvme.fid); |
|---|
| 388 | 341 | default: |
|---|
| 389 | 342 | return 0; |
|---|
| 390 | 343 | } |
|---|
| .. | .. |
|---|
| 408 | 361 | struct bin_attribute *attr, char *buf, |
|---|
| 409 | 362 | loff_t off, size_t count) |
|---|
| 410 | 363 | { |
|---|
| 411 | | - unsigned int size = ipl_block.ipl_info.fcp.scp_data_len; |
|---|
| 412 | | - void *scp_data = &ipl_block.ipl_info.fcp.scp_data; |
|---|
| 364 | + unsigned int size = ipl_block.fcp.scp_data_len; |
|---|
| 365 | + void *scp_data = &ipl_block.fcp.scp_data; |
|---|
| 413 | 366 | |
|---|
| 414 | 367 | return memory_read_from_buffer(buf, count, &off, scp_data, size); |
|---|
| 415 | 368 | } |
|---|
| 369 | + |
|---|
| 370 | +static ssize_t ipl_nvme_scp_data_read(struct file *filp, struct kobject *kobj, |
|---|
| 371 | + struct bin_attribute *attr, char *buf, |
|---|
| 372 | + loff_t off, size_t count) |
|---|
| 373 | +{ |
|---|
| 374 | + unsigned int size = ipl_block.nvme.scp_data_len; |
|---|
| 375 | + void *scp_data = &ipl_block.nvme.scp_data; |
|---|
| 376 | + |
|---|
| 377 | + return memory_read_from_buffer(buf, count, &off, scp_data, size); |
|---|
| 378 | +} |
|---|
| 379 | + |
|---|
| 416 | 380 | static struct bin_attribute ipl_scp_data_attr = |
|---|
| 417 | 381 | __BIN_ATTR(scp_data, S_IRUGO, ipl_scp_data_read, NULL, PAGE_SIZE); |
|---|
| 382 | + |
|---|
| 383 | +static struct bin_attribute ipl_nvme_scp_data_attr = |
|---|
| 384 | + __BIN_ATTR(scp_data, S_IRUGO, ipl_nvme_scp_data_read, NULL, PAGE_SIZE); |
|---|
| 418 | 385 | |
|---|
| 419 | 386 | static struct bin_attribute *ipl_fcp_bin_attrs[] = { |
|---|
| 420 | 387 | &ipl_parameter_attr, |
|---|
| .. | .. |
|---|
| 422 | 389 | NULL, |
|---|
| 423 | 390 | }; |
|---|
| 424 | 391 | |
|---|
| 392 | +static struct bin_attribute *ipl_nvme_bin_attrs[] = { |
|---|
| 393 | + &ipl_parameter_attr, |
|---|
| 394 | + &ipl_nvme_scp_data_attr, |
|---|
| 395 | + NULL, |
|---|
| 396 | +}; |
|---|
| 397 | + |
|---|
| 425 | 398 | /* FCP ipl device attributes */ |
|---|
| 426 | 399 | |
|---|
| 427 | 400 | DEFINE_IPL_ATTR_RO(ipl_fcp, wwpn, "0x%016llx\n", |
|---|
| 428 | | - (unsigned long long)ipl_block.ipl_info.fcp.wwpn); |
|---|
| 401 | + (unsigned long long)ipl_block.fcp.wwpn); |
|---|
| 429 | 402 | DEFINE_IPL_ATTR_RO(ipl_fcp, lun, "0x%016llx\n", |
|---|
| 430 | | - (unsigned long long)ipl_block.ipl_info.fcp.lun); |
|---|
| 403 | + (unsigned long long)ipl_block.fcp.lun); |
|---|
| 431 | 404 | DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", |
|---|
| 432 | | - (unsigned long long)ipl_block.ipl_info.fcp.bootprog); |
|---|
| 405 | + (unsigned long long)ipl_block.fcp.bootprog); |
|---|
| 433 | 406 | DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", |
|---|
| 434 | | - (unsigned long long)ipl_block.ipl_info.fcp.br_lba); |
|---|
| 407 | + (unsigned long long)ipl_block.fcp.br_lba); |
|---|
| 408 | + |
|---|
| 409 | +/* NVMe ipl device attributes */ |
|---|
| 410 | +DEFINE_IPL_ATTR_RO(ipl_nvme, fid, "0x%08llx\n", |
|---|
| 411 | + (unsigned long long)ipl_block.nvme.fid); |
|---|
| 412 | +DEFINE_IPL_ATTR_RO(ipl_nvme, nsid, "0x%08llx\n", |
|---|
| 413 | + (unsigned long long)ipl_block.nvme.nsid); |
|---|
| 414 | +DEFINE_IPL_ATTR_RO(ipl_nvme, bootprog, "%lld\n", |
|---|
| 415 | + (unsigned long long)ipl_block.nvme.bootprog); |
|---|
| 416 | +DEFINE_IPL_ATTR_RO(ipl_nvme, br_lba, "%lld\n", |
|---|
| 417 | + (unsigned long long)ipl_block.nvme.br_lba); |
|---|
| 435 | 418 | |
|---|
| 436 | 419 | static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, |
|---|
| 437 | 420 | struct kobj_attribute *attr, char *page) |
|---|
| .. | .. |
|---|
| 457 | 440 | &sys_ipl_fcp_bootprog_attr.attr, |
|---|
| 458 | 441 | &sys_ipl_fcp_br_lba_attr.attr, |
|---|
| 459 | 442 | &sys_ipl_ccw_loadparm_attr.attr, |
|---|
| 443 | + &sys_ipl_secure_attr.attr, |
|---|
| 444 | + &sys_ipl_has_secure_attr.attr, |
|---|
| 460 | 445 | NULL, |
|---|
| 461 | 446 | }; |
|---|
| 462 | 447 | |
|---|
| .. | .. |
|---|
| 465 | 450 | .bin_attrs = ipl_fcp_bin_attrs, |
|---|
| 466 | 451 | }; |
|---|
| 467 | 452 | |
|---|
| 453 | +static struct attribute *ipl_nvme_attrs[] = { |
|---|
| 454 | + &sys_ipl_type_attr.attr, |
|---|
| 455 | + &sys_ipl_nvme_fid_attr.attr, |
|---|
| 456 | + &sys_ipl_nvme_nsid_attr.attr, |
|---|
| 457 | + &sys_ipl_nvme_bootprog_attr.attr, |
|---|
| 458 | + &sys_ipl_nvme_br_lba_attr.attr, |
|---|
| 459 | + &sys_ipl_ccw_loadparm_attr.attr, |
|---|
| 460 | + &sys_ipl_secure_attr.attr, |
|---|
| 461 | + &sys_ipl_has_secure_attr.attr, |
|---|
| 462 | + NULL, |
|---|
| 463 | +}; |
|---|
| 464 | + |
|---|
| 465 | +static struct attribute_group ipl_nvme_attr_group = { |
|---|
| 466 | + .attrs = ipl_nvme_attrs, |
|---|
| 467 | + .bin_attrs = ipl_nvme_bin_attrs, |
|---|
| 468 | +}; |
|---|
| 469 | + |
|---|
| 470 | + |
|---|
| 468 | 471 | /* CCW ipl device attributes */ |
|---|
| 469 | 472 | |
|---|
| 470 | 473 | static struct attribute *ipl_ccw_attrs_vm[] = { |
|---|
| .. | .. |
|---|
| 472 | 475 | &sys_ipl_device_attr.attr, |
|---|
| 473 | 476 | &sys_ipl_ccw_loadparm_attr.attr, |
|---|
| 474 | 477 | &sys_ipl_vm_parm_attr.attr, |
|---|
| 478 | + &sys_ipl_secure_attr.attr, |
|---|
| 479 | + &sys_ipl_has_secure_attr.attr, |
|---|
| 475 | 480 | NULL, |
|---|
| 476 | 481 | }; |
|---|
| 477 | 482 | |
|---|
| .. | .. |
|---|
| 479 | 484 | &sys_ipl_type_attr.attr, |
|---|
| 480 | 485 | &sys_ipl_device_attr.attr, |
|---|
| 481 | 486 | &sys_ipl_ccw_loadparm_attr.attr, |
|---|
| 487 | + &sys_ipl_secure_attr.attr, |
|---|
| 488 | + &sys_ipl_has_secure_attr.attr, |
|---|
| 482 | 489 | NULL, |
|---|
| 483 | 490 | }; |
|---|
| 484 | 491 | |
|---|
| .. | .. |
|---|
| 536 | 543 | case IPL_TYPE_FCP_DUMP: |
|---|
| 537 | 544 | rc = sysfs_create_group(&ipl_kset->kobj, &ipl_fcp_attr_group); |
|---|
| 538 | 545 | break; |
|---|
| 546 | + case IPL_TYPE_NVME: |
|---|
| 547 | + case IPL_TYPE_NVME_DUMP: |
|---|
| 548 | + rc = sysfs_create_group(&ipl_kset->kobj, &ipl_nvme_attr_group); |
|---|
| 549 | + break; |
|---|
| 539 | 550 | default: |
|---|
| 540 | 551 | rc = sysfs_create_group(&ipl_kset->kobj, |
|---|
| 541 | 552 | &ipl_unknown_attr_group); |
|---|
| .. | .. |
|---|
| 564 | 575 | { |
|---|
| 565 | 576 | char vmparm[DIAG308_VMPARM_SIZE + 1] = {}; |
|---|
| 566 | 577 | |
|---|
| 567 | | - reipl_get_ascii_vmparm(vmparm, sizeof(vmparm), ipb); |
|---|
| 578 | + ipl_block_get_ascii_vmparm(vmparm, sizeof(vmparm), ipb); |
|---|
| 568 | 579 | return sprintf(page, "%s\n", vmparm); |
|---|
| 569 | 580 | } |
|---|
| 570 | 581 | |
|---|
| .. | .. |
|---|
| 587 | 598 | if (!(isalnum(buf[i]) || isascii(buf[i]) || isprint(buf[i]))) |
|---|
| 588 | 599 | return -EINVAL; |
|---|
| 589 | 600 | |
|---|
| 590 | | - memset(ipb->ipl_info.ccw.vm_parm, 0, DIAG308_VMPARM_SIZE); |
|---|
| 591 | | - ipb->ipl_info.ccw.vm_parm_len = ip_len; |
|---|
| 601 | + memset(ipb->ccw.vm_parm, 0, DIAG308_VMPARM_SIZE); |
|---|
| 602 | + ipb->ccw.vm_parm_len = ip_len; |
|---|
| 592 | 603 | if (ip_len > 0) { |
|---|
| 593 | | - ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID; |
|---|
| 594 | | - memcpy(ipb->ipl_info.ccw.vm_parm, buf, ip_len); |
|---|
| 595 | | - ASCEBC(ipb->ipl_info.ccw.vm_parm, ip_len); |
|---|
| 604 | + ipb->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_VP; |
|---|
| 605 | + memcpy(ipb->ccw.vm_parm, buf, ip_len); |
|---|
| 606 | + ASCEBC(ipb->ccw.vm_parm, ip_len); |
|---|
| 596 | 607 | } else { |
|---|
| 597 | | - ipb->ipl_info.ccw.vm_flags &= ~DIAG308_VM_FLAGS_VP_VALID; |
|---|
| 608 | + ipb->ccw.vm_flags &= ~IPL_PB0_CCW_VM_FLAG_VP; |
|---|
| 598 | 609 | } |
|---|
| 599 | 610 | |
|---|
| 600 | 611 | return len; |
|---|
| .. | .. |
|---|
| 641 | 652 | struct bin_attribute *attr, |
|---|
| 642 | 653 | char *buf, loff_t off, size_t count) |
|---|
| 643 | 654 | { |
|---|
| 644 | | - size_t size = reipl_block_fcp->ipl_info.fcp.scp_data_len; |
|---|
| 645 | | - void *scp_data = reipl_block_fcp->ipl_info.fcp.scp_data; |
|---|
| 655 | + size_t size = reipl_block_fcp->fcp.scp_data_len; |
|---|
| 656 | + void *scp_data = reipl_block_fcp->fcp.scp_data; |
|---|
| 646 | 657 | |
|---|
| 647 | 658 | return memory_read_from_buffer(buf, count, &off, scp_data, size); |
|---|
| 648 | 659 | } |
|---|
| .. | .. |
|---|
| 658 | 669 | if (off) |
|---|
| 659 | 670 | return -EINVAL; |
|---|
| 660 | 671 | |
|---|
| 661 | | - memcpy(reipl_block_fcp->ipl_info.fcp.scp_data, buf, count); |
|---|
| 672 | + memcpy(reipl_block_fcp->fcp.scp_data, buf, count); |
|---|
| 662 | 673 | if (scpdata_len % 8) { |
|---|
| 663 | 674 | padding = 8 - (scpdata_len % 8); |
|---|
| 664 | | - memset(reipl_block_fcp->ipl_info.fcp.scp_data + scpdata_len, |
|---|
| 675 | + memset(reipl_block_fcp->fcp.scp_data + scpdata_len, |
|---|
| 665 | 676 | 0, padding); |
|---|
| 666 | 677 | scpdata_len += padding; |
|---|
| 667 | 678 | } |
|---|
| 668 | 679 | |
|---|
| 669 | | - reipl_block_fcp->ipl_info.fcp.scp_data_len = scpdata_len; |
|---|
| 670 | | - reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN + scpdata_len; |
|---|
| 671 | | - reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN + scpdata_len; |
|---|
| 680 | + reipl_block_fcp->hdr.len = IPL_BP_FCP_LEN + scpdata_len; |
|---|
| 681 | + reipl_block_fcp->fcp.len = IPL_BP0_FCP_LEN + scpdata_len; |
|---|
| 682 | + reipl_block_fcp->fcp.scp_data_len = scpdata_len; |
|---|
| 672 | 683 | |
|---|
| 673 | 684 | return count; |
|---|
| 674 | 685 | } |
|---|
| .. | .. |
|---|
| 682 | 693 | }; |
|---|
| 683 | 694 | |
|---|
| 684 | 695 | DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%llx\n", |
|---|
| 685 | | - reipl_block_fcp->ipl_info.fcp.wwpn); |
|---|
| 696 | + reipl_block_fcp->fcp.wwpn); |
|---|
| 686 | 697 | DEFINE_IPL_ATTR_RW(reipl_fcp, lun, "0x%016llx\n", "%llx\n", |
|---|
| 687 | | - reipl_block_fcp->ipl_info.fcp.lun); |
|---|
| 698 | + reipl_block_fcp->fcp.lun); |
|---|
| 688 | 699 | DEFINE_IPL_ATTR_RW(reipl_fcp, bootprog, "%lld\n", "%lld\n", |
|---|
| 689 | | - reipl_block_fcp->ipl_info.fcp.bootprog); |
|---|
| 700 | + reipl_block_fcp->fcp.bootprog); |
|---|
| 690 | 701 | DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n", |
|---|
| 691 | | - reipl_block_fcp->ipl_info.fcp.br_lba); |
|---|
| 702 | + reipl_block_fcp->fcp.br_lba); |
|---|
| 692 | 703 | DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", |
|---|
| 693 | | - reipl_block_fcp->ipl_info.fcp.devno); |
|---|
| 704 | + reipl_block_fcp->fcp.devno); |
|---|
| 694 | 705 | |
|---|
| 695 | 706 | static void reipl_get_ascii_loadparm(char *loadparm, |
|---|
| 696 | 707 | struct ipl_parameter_block *ibp) |
|---|
| 697 | 708 | { |
|---|
| 698 | | - memcpy(loadparm, ibp->hdr.loadparm, LOADPARM_LEN); |
|---|
| 709 | + memcpy(loadparm, ibp->common.loadparm, LOADPARM_LEN); |
|---|
| 699 | 710 | EBCASC(loadparm, LOADPARM_LEN); |
|---|
| 700 | 711 | loadparm[LOADPARM_LEN] = 0; |
|---|
| 701 | 712 | strim(loadparm); |
|---|
| .. | .. |
|---|
| 730 | 741 | return -EINVAL; |
|---|
| 731 | 742 | } |
|---|
| 732 | 743 | /* initialize loadparm with blanks */ |
|---|
| 733 | | - memset(ipb->hdr.loadparm, ' ', LOADPARM_LEN); |
|---|
| 744 | + memset(ipb->common.loadparm, ' ', LOADPARM_LEN); |
|---|
| 734 | 745 | /* copy and convert to ebcdic */ |
|---|
| 735 | | - memcpy(ipb->hdr.loadparm, buf, lp_len); |
|---|
| 736 | | - ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN); |
|---|
| 737 | | - ipb->hdr.flags |= DIAG308_FLAGS_LP_VALID; |
|---|
| 746 | + memcpy(ipb->common.loadparm, buf, lp_len); |
|---|
| 747 | + ASCEBC(ipb->common.loadparm, LOADPARM_LEN); |
|---|
| 748 | + ipb->common.flags |= IPL_PB0_FLAG_LOADPARM; |
|---|
| 738 | 749 | return len; |
|---|
| 739 | 750 | } |
|---|
| 740 | 751 | |
|---|
| .. | .. |
|---|
| 756 | 767 | __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_fcp_loadparm_show, |
|---|
| 757 | 768 | reipl_fcp_loadparm_store); |
|---|
| 758 | 769 | |
|---|
| 770 | +static ssize_t reipl_fcp_clear_show(struct kobject *kobj, |
|---|
| 771 | + struct kobj_attribute *attr, char *page) |
|---|
| 772 | +{ |
|---|
| 773 | + return sprintf(page, "%u\n", reipl_fcp_clear); |
|---|
| 774 | +} |
|---|
| 775 | + |
|---|
| 776 | +static ssize_t reipl_fcp_clear_store(struct kobject *kobj, |
|---|
| 777 | + struct kobj_attribute *attr, |
|---|
| 778 | + const char *buf, size_t len) |
|---|
| 779 | +{ |
|---|
| 780 | + if (strtobool(buf, &reipl_fcp_clear) < 0) |
|---|
| 781 | + return -EINVAL; |
|---|
| 782 | + return len; |
|---|
| 783 | +} |
|---|
| 784 | + |
|---|
| 759 | 785 | static struct attribute *reipl_fcp_attrs[] = { |
|---|
| 760 | 786 | &sys_reipl_fcp_device_attr.attr, |
|---|
| 761 | 787 | &sys_reipl_fcp_wwpn_attr.attr, |
|---|
| .. | .. |
|---|
| 771 | 797 | .bin_attrs = reipl_fcp_bin_attrs, |
|---|
| 772 | 798 | }; |
|---|
| 773 | 799 | |
|---|
| 800 | +static struct kobj_attribute sys_reipl_fcp_clear_attr = |
|---|
| 801 | + __ATTR(clear, 0644, reipl_fcp_clear_show, reipl_fcp_clear_store); |
|---|
| 802 | + |
|---|
| 803 | +/* NVME reipl device attributes */ |
|---|
| 804 | + |
|---|
| 805 | +static ssize_t reipl_nvme_scpdata_read(struct file *filp, struct kobject *kobj, |
|---|
| 806 | + struct bin_attribute *attr, |
|---|
| 807 | + char *buf, loff_t off, size_t count) |
|---|
| 808 | +{ |
|---|
| 809 | + size_t size = reipl_block_nvme->nvme.scp_data_len; |
|---|
| 810 | + void *scp_data = reipl_block_nvme->nvme.scp_data; |
|---|
| 811 | + |
|---|
| 812 | + return memory_read_from_buffer(buf, count, &off, scp_data, size); |
|---|
| 813 | +} |
|---|
| 814 | + |
|---|
| 815 | +static ssize_t reipl_nvme_scpdata_write(struct file *filp, struct kobject *kobj, |
|---|
| 816 | + struct bin_attribute *attr, |
|---|
| 817 | + char *buf, loff_t off, size_t count) |
|---|
| 818 | +{ |
|---|
| 819 | + size_t scpdata_len = count; |
|---|
| 820 | + size_t padding; |
|---|
| 821 | + |
|---|
| 822 | + if (off) |
|---|
| 823 | + return -EINVAL; |
|---|
| 824 | + |
|---|
| 825 | + memcpy(reipl_block_nvme->nvme.scp_data, buf, count); |
|---|
| 826 | + if (scpdata_len % 8) { |
|---|
| 827 | + padding = 8 - (scpdata_len % 8); |
|---|
| 828 | + memset(reipl_block_nvme->nvme.scp_data + scpdata_len, |
|---|
| 829 | + 0, padding); |
|---|
| 830 | + scpdata_len += padding; |
|---|
| 831 | + } |
|---|
| 832 | + |
|---|
| 833 | + reipl_block_nvme->hdr.len = IPL_BP_FCP_LEN + scpdata_len; |
|---|
| 834 | + reipl_block_nvme->nvme.len = IPL_BP0_FCP_LEN + scpdata_len; |
|---|
| 835 | + reipl_block_nvme->nvme.scp_data_len = scpdata_len; |
|---|
| 836 | + |
|---|
| 837 | + return count; |
|---|
| 838 | +} |
|---|
| 839 | + |
|---|
| 840 | +static struct bin_attribute sys_reipl_nvme_scp_data_attr = |
|---|
| 841 | + __BIN_ATTR(scp_data, (S_IRUGO | S_IWUSR), reipl_nvme_scpdata_read, |
|---|
| 842 | + reipl_nvme_scpdata_write, DIAG308_SCPDATA_SIZE); |
|---|
| 843 | + |
|---|
| 844 | +static struct bin_attribute *reipl_nvme_bin_attrs[] = { |
|---|
| 845 | + &sys_reipl_nvme_scp_data_attr, |
|---|
| 846 | + NULL, |
|---|
| 847 | +}; |
|---|
| 848 | + |
|---|
| 849 | +DEFINE_IPL_ATTR_RW(reipl_nvme, fid, "0x%08llx\n", "%llx\n", |
|---|
| 850 | + reipl_block_nvme->nvme.fid); |
|---|
| 851 | +DEFINE_IPL_ATTR_RW(reipl_nvme, nsid, "0x%08llx\n", "%llx\n", |
|---|
| 852 | + reipl_block_nvme->nvme.nsid); |
|---|
| 853 | +DEFINE_IPL_ATTR_RW(reipl_nvme, bootprog, "%lld\n", "%lld\n", |
|---|
| 854 | + reipl_block_nvme->nvme.bootprog); |
|---|
| 855 | +DEFINE_IPL_ATTR_RW(reipl_nvme, br_lba, "%lld\n", "%lld\n", |
|---|
| 856 | + reipl_block_nvme->nvme.br_lba); |
|---|
| 857 | + |
|---|
| 858 | +/* nvme wrapper */ |
|---|
| 859 | +static ssize_t reipl_nvme_loadparm_show(struct kobject *kobj, |
|---|
| 860 | + struct kobj_attribute *attr, char *page) |
|---|
| 861 | +{ |
|---|
| 862 | + return reipl_generic_loadparm_show(reipl_block_nvme, page); |
|---|
| 863 | +} |
|---|
| 864 | + |
|---|
| 865 | +static ssize_t reipl_nvme_loadparm_store(struct kobject *kobj, |
|---|
| 866 | + struct kobj_attribute *attr, |
|---|
| 867 | + const char *buf, size_t len) |
|---|
| 868 | +{ |
|---|
| 869 | + return reipl_generic_loadparm_store(reipl_block_nvme, buf, len); |
|---|
| 870 | +} |
|---|
| 871 | + |
|---|
| 872 | +static struct kobj_attribute sys_reipl_nvme_loadparm_attr = |
|---|
| 873 | + __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_nvme_loadparm_show, |
|---|
| 874 | + reipl_nvme_loadparm_store); |
|---|
| 875 | + |
|---|
| 876 | +static struct attribute *reipl_nvme_attrs[] = { |
|---|
| 877 | + &sys_reipl_nvme_fid_attr.attr, |
|---|
| 878 | + &sys_reipl_nvme_nsid_attr.attr, |
|---|
| 879 | + &sys_reipl_nvme_bootprog_attr.attr, |
|---|
| 880 | + &sys_reipl_nvme_br_lba_attr.attr, |
|---|
| 881 | + &sys_reipl_nvme_loadparm_attr.attr, |
|---|
| 882 | + NULL, |
|---|
| 883 | +}; |
|---|
| 884 | + |
|---|
| 885 | +static struct attribute_group reipl_nvme_attr_group = { |
|---|
| 886 | + .attrs = reipl_nvme_attrs, |
|---|
| 887 | + .bin_attrs = reipl_nvme_bin_attrs |
|---|
| 888 | +}; |
|---|
| 889 | + |
|---|
| 890 | +static ssize_t reipl_nvme_clear_show(struct kobject *kobj, |
|---|
| 891 | + struct kobj_attribute *attr, char *page) |
|---|
| 892 | +{ |
|---|
| 893 | + return sprintf(page, "%u\n", reipl_nvme_clear); |
|---|
| 894 | +} |
|---|
| 895 | + |
|---|
| 896 | +static ssize_t reipl_nvme_clear_store(struct kobject *kobj, |
|---|
| 897 | + struct kobj_attribute *attr, |
|---|
| 898 | + const char *buf, size_t len) |
|---|
| 899 | +{ |
|---|
| 900 | + if (strtobool(buf, &reipl_nvme_clear) < 0) |
|---|
| 901 | + return -EINVAL; |
|---|
| 902 | + return len; |
|---|
| 903 | +} |
|---|
| 904 | + |
|---|
| 905 | +static struct kobj_attribute sys_reipl_nvme_clear_attr = |
|---|
| 906 | + __ATTR(clear, 0644, reipl_nvme_clear_show, reipl_nvme_clear_store); |
|---|
| 907 | + |
|---|
| 774 | 908 | /* CCW reipl device attributes */ |
|---|
| 775 | | -DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ipl_info.ccw); |
|---|
| 909 | +DEFINE_IPL_CCW_ATTR_RW(reipl_ccw, device, reipl_block_ccw->ccw); |
|---|
| 776 | 910 | |
|---|
| 777 | 911 | /* NSS wrapper */ |
|---|
| 778 | 912 | static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, |
|---|
| .. | .. |
|---|
| 806 | 940 | __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_ccw_loadparm_show, |
|---|
| 807 | 941 | reipl_ccw_loadparm_store); |
|---|
| 808 | 942 | |
|---|
| 943 | +static ssize_t reipl_ccw_clear_show(struct kobject *kobj, |
|---|
| 944 | + struct kobj_attribute *attr, char *page) |
|---|
| 945 | +{ |
|---|
| 946 | + return sprintf(page, "%u\n", reipl_ccw_clear); |
|---|
| 947 | +} |
|---|
| 948 | + |
|---|
| 949 | +static ssize_t reipl_ccw_clear_store(struct kobject *kobj, |
|---|
| 950 | + struct kobj_attribute *attr, |
|---|
| 951 | + const char *buf, size_t len) |
|---|
| 952 | +{ |
|---|
| 953 | + if (strtobool(buf, &reipl_ccw_clear) < 0) |
|---|
| 954 | + return -EINVAL; |
|---|
| 955 | + return len; |
|---|
| 956 | +} |
|---|
| 957 | + |
|---|
| 958 | +static struct kobj_attribute sys_reipl_ccw_clear_attr = |
|---|
| 959 | + __ATTR(clear, 0644, reipl_ccw_clear_show, reipl_ccw_clear_store); |
|---|
| 960 | + |
|---|
| 809 | 961 | static struct attribute *reipl_ccw_attrs_vm[] = { |
|---|
| 810 | 962 | &sys_reipl_ccw_device_attr.attr, |
|---|
| 811 | 963 | &sys_reipl_ccw_loadparm_attr.attr, |
|---|
| 812 | 964 | &sys_reipl_ccw_vmparm_attr.attr, |
|---|
| 965 | + &sys_reipl_ccw_clear_attr.attr, |
|---|
| 813 | 966 | NULL, |
|---|
| 814 | 967 | }; |
|---|
| 815 | 968 | |
|---|
| 816 | 969 | static struct attribute *reipl_ccw_attrs_lpar[] = { |
|---|
| 817 | 970 | &sys_reipl_ccw_device_attr.attr, |
|---|
| 818 | 971 | &sys_reipl_ccw_loadparm_attr.attr, |
|---|
| 972 | + &sys_reipl_ccw_clear_attr.attr, |
|---|
| 819 | 973 | NULL, |
|---|
| 820 | 974 | }; |
|---|
| 821 | 975 | |
|---|
| .. | .. |
|---|
| 834 | 988 | static void reipl_get_ascii_nss_name(char *dst, |
|---|
| 835 | 989 | struct ipl_parameter_block *ipb) |
|---|
| 836 | 990 | { |
|---|
| 837 | | - memcpy(dst, ipb->ipl_info.ccw.nss_name, NSS_NAME_SIZE); |
|---|
| 991 | + memcpy(dst, ipb->ccw.nss_name, NSS_NAME_SIZE); |
|---|
| 838 | 992 | EBCASC(dst, NSS_NAME_SIZE); |
|---|
| 839 | 993 | dst[NSS_NAME_SIZE] = 0; |
|---|
| 840 | 994 | } |
|---|
| .. | .. |
|---|
| 862 | 1016 | if (nss_len > NSS_NAME_SIZE) |
|---|
| 863 | 1017 | return -EINVAL; |
|---|
| 864 | 1018 | |
|---|
| 865 | | - memset(reipl_block_nss->ipl_info.ccw.nss_name, 0x40, NSS_NAME_SIZE); |
|---|
| 1019 | + memset(reipl_block_nss->ccw.nss_name, 0x40, NSS_NAME_SIZE); |
|---|
| 866 | 1020 | if (nss_len > 0) { |
|---|
| 867 | | - reipl_block_nss->ipl_info.ccw.vm_flags |= |
|---|
| 868 | | - DIAG308_VM_FLAGS_NSS_VALID; |
|---|
| 869 | | - memcpy(reipl_block_nss->ipl_info.ccw.nss_name, buf, nss_len); |
|---|
| 870 | | - ASCEBC(reipl_block_nss->ipl_info.ccw.nss_name, nss_len); |
|---|
| 871 | | - EBC_TOUPPER(reipl_block_nss->ipl_info.ccw.nss_name, nss_len); |
|---|
| 1021 | + reipl_block_nss->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_NSS; |
|---|
| 1022 | + memcpy(reipl_block_nss->ccw.nss_name, buf, nss_len); |
|---|
| 1023 | + ASCEBC(reipl_block_nss->ccw.nss_name, nss_len); |
|---|
| 1024 | + EBC_TOUPPER(reipl_block_nss->ccw.nss_name, nss_len); |
|---|
| 872 | 1025 | } else { |
|---|
| 873 | | - reipl_block_nss->ipl_info.ccw.vm_flags &= |
|---|
| 874 | | - ~DIAG308_VM_FLAGS_NSS_VALID; |
|---|
| 1026 | + reipl_block_nss->ccw.vm_flags &= ~IPL_PB0_CCW_VM_FLAG_NSS; |
|---|
| 875 | 1027 | } |
|---|
| 876 | 1028 | |
|---|
| 877 | 1029 | return len; |
|---|
| .. | .. |
|---|
| 917 | 1069 | case IPL_TYPE_FCP: |
|---|
| 918 | 1070 | reipl_block_actual = reipl_block_fcp; |
|---|
| 919 | 1071 | break; |
|---|
| 1072 | + case IPL_TYPE_NVME: |
|---|
| 1073 | + reipl_block_actual = reipl_block_nvme; |
|---|
| 1074 | + break; |
|---|
| 920 | 1075 | case IPL_TYPE_NSS: |
|---|
| 921 | 1076 | reipl_block_actual = reipl_block_nss; |
|---|
| 922 | 1077 | break; |
|---|
| .. | .. |
|---|
| 943 | 1098 | rc = reipl_set_type(IPL_TYPE_CCW); |
|---|
| 944 | 1099 | else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0) |
|---|
| 945 | 1100 | rc = reipl_set_type(IPL_TYPE_FCP); |
|---|
| 1101 | + else if (strncmp(buf, IPL_NVME_STR, strlen(IPL_NVME_STR)) == 0) |
|---|
| 1102 | + rc = reipl_set_type(IPL_TYPE_NVME); |
|---|
| 946 | 1103 | else if (strncmp(buf, IPL_NSS_STR, strlen(IPL_NSS_STR)) == 0) |
|---|
| 947 | 1104 | rc = reipl_set_type(IPL_TYPE_NSS); |
|---|
| 948 | 1105 | return (rc != 0) ? rc : len; |
|---|
| .. | .. |
|---|
| 953 | 1110 | |
|---|
| 954 | 1111 | static struct kset *reipl_kset; |
|---|
| 955 | 1112 | static struct kset *reipl_fcp_kset; |
|---|
| 1113 | +static struct kset *reipl_nvme_kset; |
|---|
| 956 | 1114 | |
|---|
| 957 | 1115 | static void __reipl_run(void *unused) |
|---|
| 958 | 1116 | { |
|---|
| 959 | 1117 | switch (reipl_type) { |
|---|
| 960 | 1118 | case IPL_TYPE_CCW: |
|---|
| 961 | 1119 | diag308(DIAG308_SET, reipl_block_ccw); |
|---|
| 962 | | - diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 1120 | + if (reipl_ccw_clear) |
|---|
| 1121 | + diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 1122 | + else |
|---|
| 1123 | + diag308(DIAG308_LOAD_NORMAL_DUMP, NULL); |
|---|
| 963 | 1124 | break; |
|---|
| 964 | 1125 | case IPL_TYPE_FCP: |
|---|
| 965 | 1126 | diag308(DIAG308_SET, reipl_block_fcp); |
|---|
| 966 | | - diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 1127 | + if (reipl_fcp_clear) |
|---|
| 1128 | + diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 1129 | + else |
|---|
| 1130 | + diag308(DIAG308_LOAD_NORMAL, NULL); |
|---|
| 1131 | + break; |
|---|
| 1132 | + case IPL_TYPE_NVME: |
|---|
| 1133 | + diag308(DIAG308_SET, reipl_block_nvme); |
|---|
| 1134 | + if (reipl_nvme_clear) |
|---|
| 1135 | + diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 1136 | + else |
|---|
| 1137 | + diag308(DIAG308_LOAD_NORMAL, NULL); |
|---|
| 967 | 1138 | break; |
|---|
| 968 | 1139 | case IPL_TYPE_NSS: |
|---|
| 969 | 1140 | diag308(DIAG308_SET, reipl_block_nss); |
|---|
| .. | .. |
|---|
| 973 | 1144 | diag308(DIAG308_LOAD_CLEAR, NULL); |
|---|
| 974 | 1145 | break; |
|---|
| 975 | 1146 | case IPL_TYPE_FCP_DUMP: |
|---|
| 1147 | + case IPL_TYPE_NVME_DUMP: |
|---|
| 976 | 1148 | break; |
|---|
| 977 | 1149 | } |
|---|
| 978 | | - disabled_wait((unsigned long) __builtin_return_address(0)); |
|---|
| 1150 | + disabled_wait(); |
|---|
| 979 | 1151 | } |
|---|
| 980 | 1152 | |
|---|
| 981 | 1153 | static void reipl_run(struct shutdown_trigger *trigger) |
|---|
| .. | .. |
|---|
| 985 | 1157 | |
|---|
| 986 | 1158 | static void reipl_block_ccw_init(struct ipl_parameter_block *ipb) |
|---|
| 987 | 1159 | { |
|---|
| 988 | | - ipb->hdr.len = IPL_PARM_BLK_CCW_LEN; |
|---|
| 1160 | + ipb->hdr.len = IPL_BP_CCW_LEN; |
|---|
| 989 | 1161 | ipb->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 990 | | - ipb->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; |
|---|
| 991 | | - ipb->hdr.pbt = DIAG308_IPL_TYPE_CCW; |
|---|
| 1162 | + ipb->pb0_hdr.len = IPL_BP0_CCW_LEN; |
|---|
| 1163 | + ipb->pb0_hdr.pbt = IPL_PBT_CCW; |
|---|
| 992 | 1164 | } |
|---|
| 993 | 1165 | |
|---|
| 994 | 1166 | static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb) |
|---|
| .. | .. |
|---|
| 996 | 1168 | /* LOADPARM */ |
|---|
| 997 | 1169 | /* check if read scp info worked and set loadparm */ |
|---|
| 998 | 1170 | if (sclp_ipl_info.is_valid) |
|---|
| 999 | | - memcpy(ipb->hdr.loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); |
|---|
| 1171 | + memcpy(ipb->ccw.loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); |
|---|
| 1000 | 1172 | else |
|---|
| 1001 | 1173 | /* read scp info failed: set empty loadparm (EBCDIC blanks) */ |
|---|
| 1002 | | - memset(ipb->hdr.loadparm, 0x40, LOADPARM_LEN); |
|---|
| 1003 | | - ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; |
|---|
| 1174 | + memset(ipb->ccw.loadparm, 0x40, LOADPARM_LEN); |
|---|
| 1175 | + ipb->ccw.flags = IPL_PB0_FLAG_LOADPARM; |
|---|
| 1004 | 1176 | |
|---|
| 1005 | 1177 | /* VM PARM */ |
|---|
| 1006 | 1178 | if (MACHINE_IS_VM && ipl_block_valid && |
|---|
| 1007 | | - (ipl_block.ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID)) { |
|---|
| 1179 | + (ipl_block.ccw.vm_flags & IPL_PB0_CCW_VM_FLAG_VP)) { |
|---|
| 1008 | 1180 | |
|---|
| 1009 | | - ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID; |
|---|
| 1010 | | - ipb->ipl_info.ccw.vm_parm_len = |
|---|
| 1011 | | - ipl_block.ipl_info.ccw.vm_parm_len; |
|---|
| 1012 | | - memcpy(ipb->ipl_info.ccw.vm_parm, |
|---|
| 1013 | | - ipl_block.ipl_info.ccw.vm_parm, DIAG308_VMPARM_SIZE); |
|---|
| 1181 | + ipb->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_VP; |
|---|
| 1182 | + ipb->ccw.vm_parm_len = ipl_block.ccw.vm_parm_len; |
|---|
| 1183 | + memcpy(ipb->ccw.vm_parm, |
|---|
| 1184 | + ipl_block.ccw.vm_parm, DIAG308_VMPARM_SIZE); |
|---|
| 1014 | 1185 | } |
|---|
| 1015 | 1186 | } |
|---|
| 1016 | 1187 | |
|---|
| .. | .. |
|---|
| 1050 | 1221 | |
|---|
| 1051 | 1222 | reipl_block_ccw_init(reipl_block_ccw); |
|---|
| 1052 | 1223 | if (ipl_info.type == IPL_TYPE_CCW) { |
|---|
| 1053 | | - reipl_block_ccw->ipl_info.ccw.ssid = ipl_block.ipl_info.ccw.ssid; |
|---|
| 1054 | | - reipl_block_ccw->ipl_info.ccw.devno = ipl_block.ipl_info.ccw.devno; |
|---|
| 1224 | + reipl_block_ccw->ccw.ssid = ipl_block.ccw.ssid; |
|---|
| 1225 | + reipl_block_ccw->ccw.devno = ipl_block.ccw.devno; |
|---|
| 1055 | 1226 | reipl_block_ccw_fill_parms(reipl_block_ccw); |
|---|
| 1056 | 1227 | } |
|---|
| 1057 | 1228 | |
|---|
| .. | .. |
|---|
| 1076 | 1247 | } |
|---|
| 1077 | 1248 | |
|---|
| 1078 | 1249 | rc = sysfs_create_group(&reipl_fcp_kset->kobj, &reipl_fcp_attr_group); |
|---|
| 1079 | | - if (rc) { |
|---|
| 1080 | | - kset_unregister(reipl_fcp_kset); |
|---|
| 1081 | | - free_page((unsigned long) reipl_block_fcp); |
|---|
| 1082 | | - return rc; |
|---|
| 1250 | + if (rc) |
|---|
| 1251 | + goto out1; |
|---|
| 1252 | + |
|---|
| 1253 | + if (test_facility(141)) { |
|---|
| 1254 | + rc = sysfs_create_file(&reipl_fcp_kset->kobj, |
|---|
| 1255 | + &sys_reipl_fcp_clear_attr.attr); |
|---|
| 1256 | + if (rc) |
|---|
| 1257 | + goto out2; |
|---|
| 1258 | + } else { |
|---|
| 1259 | + reipl_fcp_clear = true; |
|---|
| 1083 | 1260 | } |
|---|
| 1084 | 1261 | |
|---|
| 1085 | 1262 | if (ipl_info.type == IPL_TYPE_FCP) { |
|---|
| .. | .. |
|---|
| 1089 | 1266 | * is invalid in the SCSI IPL parameter block, so take it |
|---|
| 1090 | 1267 | * always from sclp_ipl_info. |
|---|
| 1091 | 1268 | */ |
|---|
| 1092 | | - memcpy(reipl_block_fcp->hdr.loadparm, sclp_ipl_info.loadparm, |
|---|
| 1269 | + memcpy(reipl_block_fcp->fcp.loadparm, sclp_ipl_info.loadparm, |
|---|
| 1093 | 1270 | LOADPARM_LEN); |
|---|
| 1094 | 1271 | } else { |
|---|
| 1095 | | - reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; |
|---|
| 1272 | + reipl_block_fcp->hdr.len = IPL_BP_FCP_LEN; |
|---|
| 1096 | 1273 | reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 1097 | | - reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; |
|---|
| 1098 | | - reipl_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; |
|---|
| 1099 | | - reipl_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_IPL; |
|---|
| 1274 | + reipl_block_fcp->fcp.len = IPL_BP0_FCP_LEN; |
|---|
| 1275 | + reipl_block_fcp->fcp.pbt = IPL_PBT_FCP; |
|---|
| 1276 | + reipl_block_fcp->fcp.opt = IPL_PB0_FCP_OPT_IPL; |
|---|
| 1100 | 1277 | } |
|---|
| 1101 | 1278 | reipl_capabilities |= IPL_TYPE_FCP; |
|---|
| 1102 | 1279 | return 0; |
|---|
| 1280 | + |
|---|
| 1281 | +out2: |
|---|
| 1282 | + sysfs_remove_group(&reipl_fcp_kset->kobj, &reipl_fcp_attr_group); |
|---|
| 1283 | +out1: |
|---|
| 1284 | + kset_unregister(reipl_fcp_kset); |
|---|
| 1285 | + free_page((unsigned long) reipl_block_fcp); |
|---|
| 1286 | + return rc; |
|---|
| 1287 | +} |
|---|
| 1288 | + |
|---|
| 1289 | +static int __init reipl_nvme_init(void) |
|---|
| 1290 | +{ |
|---|
| 1291 | + int rc; |
|---|
| 1292 | + |
|---|
| 1293 | + reipl_block_nvme = (void *) get_zeroed_page(GFP_KERNEL); |
|---|
| 1294 | + if (!reipl_block_nvme) |
|---|
| 1295 | + return -ENOMEM; |
|---|
| 1296 | + |
|---|
| 1297 | + /* sysfs: create kset for mixing attr group and bin attrs */ |
|---|
| 1298 | + reipl_nvme_kset = kset_create_and_add(IPL_NVME_STR, NULL, |
|---|
| 1299 | + &reipl_kset->kobj); |
|---|
| 1300 | + if (!reipl_nvme_kset) { |
|---|
| 1301 | + free_page((unsigned long) reipl_block_nvme); |
|---|
| 1302 | + return -ENOMEM; |
|---|
| 1303 | + } |
|---|
| 1304 | + |
|---|
| 1305 | + rc = sysfs_create_group(&reipl_nvme_kset->kobj, &reipl_nvme_attr_group); |
|---|
| 1306 | + if (rc) |
|---|
| 1307 | + goto out1; |
|---|
| 1308 | + |
|---|
| 1309 | + if (test_facility(141)) { |
|---|
| 1310 | + rc = sysfs_create_file(&reipl_nvme_kset->kobj, |
|---|
| 1311 | + &sys_reipl_nvme_clear_attr.attr); |
|---|
| 1312 | + if (rc) |
|---|
| 1313 | + goto out2; |
|---|
| 1314 | + } else { |
|---|
| 1315 | + reipl_nvme_clear = true; |
|---|
| 1316 | + } |
|---|
| 1317 | + |
|---|
| 1318 | + if (ipl_info.type == IPL_TYPE_NVME) { |
|---|
| 1319 | + memcpy(reipl_block_nvme, &ipl_block, sizeof(ipl_block)); |
|---|
| 1320 | + /* |
|---|
| 1321 | + * Fix loadparm: There are systems where the (SCSI) LOADPARM |
|---|
| 1322 | + * is invalid in the IPL parameter block, so take it |
|---|
| 1323 | + * always from sclp_ipl_info. |
|---|
| 1324 | + */ |
|---|
| 1325 | + memcpy(reipl_block_nvme->nvme.loadparm, sclp_ipl_info.loadparm, |
|---|
| 1326 | + LOADPARM_LEN); |
|---|
| 1327 | + } else { |
|---|
| 1328 | + reipl_block_nvme->hdr.len = IPL_BP_NVME_LEN; |
|---|
| 1329 | + reipl_block_nvme->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 1330 | + reipl_block_nvme->nvme.len = IPL_BP0_NVME_LEN; |
|---|
| 1331 | + reipl_block_nvme->nvme.pbt = IPL_PBT_NVME; |
|---|
| 1332 | + reipl_block_nvme->nvme.opt = IPL_PB0_NVME_OPT_IPL; |
|---|
| 1333 | + } |
|---|
| 1334 | + reipl_capabilities |= IPL_TYPE_NVME; |
|---|
| 1335 | + return 0; |
|---|
| 1336 | + |
|---|
| 1337 | +out2: |
|---|
| 1338 | + sysfs_remove_group(&reipl_nvme_kset->kobj, &reipl_nvme_attr_group); |
|---|
| 1339 | +out1: |
|---|
| 1340 | + kset_unregister(reipl_nvme_kset); |
|---|
| 1341 | + free_page((unsigned long) reipl_block_nvme); |
|---|
| 1342 | + return rc; |
|---|
| 1103 | 1343 | } |
|---|
| 1104 | 1344 | |
|---|
| 1105 | 1345 | static int __init reipl_type_init(void) |
|---|
| .. | .. |
|---|
| 1114 | 1354 | /* |
|---|
| 1115 | 1355 | * If we have an OS info reipl block, this will be used |
|---|
| 1116 | 1356 | */ |
|---|
| 1117 | | - if (reipl_block->hdr.pbt == DIAG308_IPL_TYPE_FCP) { |
|---|
| 1357 | + if (reipl_block->pb0_hdr.pbt == IPL_PBT_FCP) { |
|---|
| 1118 | 1358 | memcpy(reipl_block_fcp, reipl_block, size); |
|---|
| 1119 | 1359 | reipl_type = IPL_TYPE_FCP; |
|---|
| 1120 | | - } else if (reipl_block->hdr.pbt == DIAG308_IPL_TYPE_CCW) { |
|---|
| 1360 | + } else if (reipl_block->pb0_hdr.pbt == IPL_PBT_NVME) { |
|---|
| 1361 | + memcpy(reipl_block_nvme, reipl_block, size); |
|---|
| 1362 | + reipl_type = IPL_TYPE_NVME; |
|---|
| 1363 | + } else if (reipl_block->pb0_hdr.pbt == IPL_PBT_CCW) { |
|---|
| 1121 | 1364 | memcpy(reipl_block_ccw, reipl_block, size); |
|---|
| 1122 | 1365 | reipl_type = IPL_TYPE_CCW; |
|---|
| 1123 | 1366 | } |
|---|
| .. | .. |
|---|
| 1143 | 1386 | rc = reipl_fcp_init(); |
|---|
| 1144 | 1387 | if (rc) |
|---|
| 1145 | 1388 | return rc; |
|---|
| 1389 | + rc = reipl_nvme_init(); |
|---|
| 1390 | + if (rc) |
|---|
| 1391 | + return rc; |
|---|
| 1146 | 1392 | rc = reipl_nss_init(); |
|---|
| 1147 | 1393 | if (rc) |
|---|
| 1148 | 1394 | return rc; |
|---|
| .. | .. |
|---|
| 1162 | 1408 | /* FCP dump device attributes */ |
|---|
| 1163 | 1409 | |
|---|
| 1164 | 1410 | DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%llx\n", |
|---|
| 1165 | | - dump_block_fcp->ipl_info.fcp.wwpn); |
|---|
| 1411 | + dump_block_fcp->fcp.wwpn); |
|---|
| 1166 | 1412 | DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%llx\n", |
|---|
| 1167 | | - dump_block_fcp->ipl_info.fcp.lun); |
|---|
| 1413 | + dump_block_fcp->fcp.lun); |
|---|
| 1168 | 1414 | DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n", |
|---|
| 1169 | | - dump_block_fcp->ipl_info.fcp.bootprog); |
|---|
| 1415 | + dump_block_fcp->fcp.bootprog); |
|---|
| 1170 | 1416 | DEFINE_IPL_ATTR_RW(dump_fcp, br_lba, "%lld\n", "%lld\n", |
|---|
| 1171 | | - dump_block_fcp->ipl_info.fcp.br_lba); |
|---|
| 1417 | + dump_block_fcp->fcp.br_lba); |
|---|
| 1172 | 1418 | DEFINE_IPL_ATTR_RW(dump_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", |
|---|
| 1173 | | - dump_block_fcp->ipl_info.fcp.devno); |
|---|
| 1419 | + dump_block_fcp->fcp.devno); |
|---|
| 1174 | 1420 | |
|---|
| 1175 | 1421 | static struct attribute *dump_fcp_attrs[] = { |
|---|
| 1176 | 1422 | &sys_dump_fcp_device_attr.attr, |
|---|
| .. | .. |
|---|
| 1186 | 1432 | .attrs = dump_fcp_attrs, |
|---|
| 1187 | 1433 | }; |
|---|
| 1188 | 1434 | |
|---|
| 1435 | +/* NVME dump device attributes */ |
|---|
| 1436 | +DEFINE_IPL_ATTR_RW(dump_nvme, fid, "0x%08llx\n", "%llx\n", |
|---|
| 1437 | + dump_block_nvme->nvme.fid); |
|---|
| 1438 | +DEFINE_IPL_ATTR_RW(dump_nvme, nsid, "0x%08llx\n", "%llx\n", |
|---|
| 1439 | + dump_block_nvme->nvme.nsid); |
|---|
| 1440 | +DEFINE_IPL_ATTR_RW(dump_nvme, bootprog, "%lld\n", "%llx\n", |
|---|
| 1441 | + dump_block_nvme->nvme.bootprog); |
|---|
| 1442 | +DEFINE_IPL_ATTR_RW(dump_nvme, br_lba, "%lld\n", "%llx\n", |
|---|
| 1443 | + dump_block_nvme->nvme.br_lba); |
|---|
| 1444 | + |
|---|
| 1445 | +static struct attribute *dump_nvme_attrs[] = { |
|---|
| 1446 | + &sys_dump_nvme_fid_attr.attr, |
|---|
| 1447 | + &sys_dump_nvme_nsid_attr.attr, |
|---|
| 1448 | + &sys_dump_nvme_bootprog_attr.attr, |
|---|
| 1449 | + &sys_dump_nvme_br_lba_attr.attr, |
|---|
| 1450 | + NULL, |
|---|
| 1451 | +}; |
|---|
| 1452 | + |
|---|
| 1453 | +static struct attribute_group dump_nvme_attr_group = { |
|---|
| 1454 | + .name = IPL_NVME_STR, |
|---|
| 1455 | + .attrs = dump_nvme_attrs, |
|---|
| 1456 | +}; |
|---|
| 1457 | + |
|---|
| 1189 | 1458 | /* CCW dump device attributes */ |
|---|
| 1190 | | -DEFINE_IPL_CCW_ATTR_RW(dump_ccw, device, dump_block_ccw->ipl_info.ccw); |
|---|
| 1459 | +DEFINE_IPL_CCW_ATTR_RW(dump_ccw, device, dump_block_ccw->ccw); |
|---|
| 1191 | 1460 | |
|---|
| 1192 | 1461 | static struct attribute *dump_ccw_attrs[] = { |
|---|
| 1193 | 1462 | &sys_dump_ccw_device_attr.attr, |
|---|
| .. | .. |
|---|
| 1227 | 1496 | rc = dump_set_type(DUMP_TYPE_CCW); |
|---|
| 1228 | 1497 | else if (strncmp(buf, DUMP_FCP_STR, strlen(DUMP_FCP_STR)) == 0) |
|---|
| 1229 | 1498 | rc = dump_set_type(DUMP_TYPE_FCP); |
|---|
| 1499 | + else if (strncmp(buf, DUMP_NVME_STR, strlen(DUMP_NVME_STR)) == 0) |
|---|
| 1500 | + rc = dump_set_type(DUMP_TYPE_NVME); |
|---|
| 1230 | 1501 | return (rc != 0) ? rc : len; |
|---|
| 1231 | 1502 | } |
|---|
| 1232 | 1503 | |
|---|
| .. | .. |
|---|
| 1254 | 1525 | case DUMP_TYPE_FCP: |
|---|
| 1255 | 1526 | diag308_dump(dump_block_fcp); |
|---|
| 1256 | 1527 | break; |
|---|
| 1528 | + case DUMP_TYPE_NVME: |
|---|
| 1529 | + diag308_dump(dump_block_nvme); |
|---|
| 1530 | + break; |
|---|
| 1257 | 1531 | default: |
|---|
| 1258 | 1532 | break; |
|---|
| 1259 | 1533 | } |
|---|
| .. | .. |
|---|
| 1279 | 1553 | free_page((unsigned long)dump_block_ccw); |
|---|
| 1280 | 1554 | return rc; |
|---|
| 1281 | 1555 | } |
|---|
| 1282 | | - dump_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN; |
|---|
| 1556 | + dump_block_ccw->hdr.len = IPL_BP_CCW_LEN; |
|---|
| 1283 | 1557 | dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 1284 | | - dump_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; |
|---|
| 1285 | | - dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; |
|---|
| 1558 | + dump_block_ccw->ccw.len = IPL_BP0_CCW_LEN; |
|---|
| 1559 | + dump_block_ccw->ccw.pbt = IPL_PBT_CCW; |
|---|
| 1286 | 1560 | dump_capabilities |= DUMP_TYPE_CCW; |
|---|
| 1287 | 1561 | return 0; |
|---|
| 1288 | 1562 | } |
|---|
| .. | .. |
|---|
| 1301 | 1575 | free_page((unsigned long)dump_block_fcp); |
|---|
| 1302 | 1576 | return rc; |
|---|
| 1303 | 1577 | } |
|---|
| 1304 | | - dump_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; |
|---|
| 1578 | + dump_block_fcp->hdr.len = IPL_BP_FCP_LEN; |
|---|
| 1305 | 1579 | dump_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 1306 | | - dump_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; |
|---|
| 1307 | | - dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP; |
|---|
| 1308 | | - dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP; |
|---|
| 1580 | + dump_block_fcp->fcp.len = IPL_BP0_FCP_LEN; |
|---|
| 1581 | + dump_block_fcp->fcp.pbt = IPL_PBT_FCP; |
|---|
| 1582 | + dump_block_fcp->fcp.opt = IPL_PB0_FCP_OPT_DUMP; |
|---|
| 1309 | 1583 | dump_capabilities |= DUMP_TYPE_FCP; |
|---|
| 1584 | + return 0; |
|---|
| 1585 | +} |
|---|
| 1586 | + |
|---|
| 1587 | +static int __init dump_nvme_init(void) |
|---|
| 1588 | +{ |
|---|
| 1589 | + int rc; |
|---|
| 1590 | + |
|---|
| 1591 | + if (!sclp_ipl_info.has_dump) |
|---|
| 1592 | + return 0; /* LDIPL DUMP is not installed */ |
|---|
| 1593 | + dump_block_nvme = (void *) get_zeroed_page(GFP_KERNEL); |
|---|
| 1594 | + if (!dump_block_nvme) |
|---|
| 1595 | + return -ENOMEM; |
|---|
| 1596 | + rc = sysfs_create_group(&dump_kset->kobj, &dump_nvme_attr_group); |
|---|
| 1597 | + if (rc) { |
|---|
| 1598 | + free_page((unsigned long)dump_block_nvme); |
|---|
| 1599 | + return rc; |
|---|
| 1600 | + } |
|---|
| 1601 | + dump_block_nvme->hdr.len = IPL_BP_NVME_LEN; |
|---|
| 1602 | + dump_block_nvme->hdr.version = IPL_PARM_BLOCK_VERSION; |
|---|
| 1603 | + dump_block_nvme->fcp.len = IPL_BP0_NVME_LEN; |
|---|
| 1604 | + dump_block_nvme->fcp.pbt = IPL_PBT_NVME; |
|---|
| 1605 | + dump_block_nvme->fcp.opt = IPL_PB0_NVME_OPT_DUMP; |
|---|
| 1606 | + dump_capabilities |= DUMP_TYPE_NVME; |
|---|
| 1310 | 1607 | return 0; |
|---|
| 1311 | 1608 | } |
|---|
| 1312 | 1609 | |
|---|
| .. | .. |
|---|
| 1326 | 1623 | if (rc) |
|---|
| 1327 | 1624 | return rc; |
|---|
| 1328 | 1625 | rc = dump_fcp_init(); |
|---|
| 1626 | + if (rc) |
|---|
| 1627 | + return rc; |
|---|
| 1628 | + rc = dump_nvme_init(); |
|---|
| 1329 | 1629 | if (rc) |
|---|
| 1330 | 1630 | return rc; |
|---|
| 1331 | 1631 | dump_set_type(DUMP_TYPE_NONE); |
|---|
| .. | .. |
|---|
| 1429 | 1729 | { |
|---|
| 1430 | 1730 | if (strcmp(trigger->name, ON_PANIC_STR) == 0 || |
|---|
| 1431 | 1731 | strcmp(trigger->name, ON_RESTART_STR) == 0) |
|---|
| 1432 | | - disabled_wait((unsigned long) __builtin_return_address(0)); |
|---|
| 1732 | + disabled_wait(); |
|---|
| 1433 | 1733 | smp_stop_cpu(); |
|---|
| 1434 | 1734 | } |
|---|
| 1435 | 1735 | |
|---|
| .. | .. |
|---|
| 1664 | 1964 | * READ SCP info provides the correct value. |
|---|
| 1665 | 1965 | */ |
|---|
| 1666 | 1966 | if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 && ipl_block_valid) |
|---|
| 1667 | | - memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm, LOADPARM_LEN); |
|---|
| 1967 | + memcpy(sclp_ipl_info.loadparm, ipl_block.ccw.loadparm, LOADPARM_LEN); |
|---|
| 1668 | 1968 | shutdown_actions_init(); |
|---|
| 1669 | 1969 | shutdown_triggers_init(); |
|---|
| 1670 | 1970 | return 0; |
|---|
| .. | .. |
|---|
| 1749 | 2049 | ipl_info.type = get_ipl_type(); |
|---|
| 1750 | 2050 | switch (ipl_info.type) { |
|---|
| 1751 | 2051 | case IPL_TYPE_CCW: |
|---|
| 1752 | | - ipl_info.data.ccw.dev_id.ssid = ipl_block.ipl_info.ccw.ssid; |
|---|
| 1753 | | - ipl_info.data.ccw.dev_id.devno = ipl_block.ipl_info.ccw.devno; |
|---|
| 2052 | + ipl_info.data.ccw.dev_id.ssid = ipl_block.ccw.ssid; |
|---|
| 2053 | + ipl_info.data.ccw.dev_id.devno = ipl_block.ccw.devno; |
|---|
| 1754 | 2054 | break; |
|---|
| 1755 | 2055 | case IPL_TYPE_FCP: |
|---|
| 1756 | 2056 | case IPL_TYPE_FCP_DUMP: |
|---|
| 1757 | 2057 | ipl_info.data.fcp.dev_id.ssid = 0; |
|---|
| 1758 | | - ipl_info.data.fcp.dev_id.devno = ipl_block.ipl_info.fcp.devno; |
|---|
| 1759 | | - ipl_info.data.fcp.wwpn = ipl_block.ipl_info.fcp.wwpn; |
|---|
| 1760 | | - ipl_info.data.fcp.lun = ipl_block.ipl_info.fcp.lun; |
|---|
| 2058 | + ipl_info.data.fcp.dev_id.devno = ipl_block.fcp.devno; |
|---|
| 2059 | + ipl_info.data.fcp.wwpn = ipl_block.fcp.wwpn; |
|---|
| 2060 | + ipl_info.data.fcp.lun = ipl_block.fcp.lun; |
|---|
| 2061 | + break; |
|---|
| 2062 | + case IPL_TYPE_NVME: |
|---|
| 2063 | + case IPL_TYPE_NVME_DUMP: |
|---|
| 2064 | + ipl_info.data.nvme.fid = ipl_block.nvme.fid; |
|---|
| 2065 | + ipl_info.data.nvme.nsid = ipl_block.nvme.nsid; |
|---|
| 1761 | 2066 | break; |
|---|
| 1762 | 2067 | case IPL_TYPE_NSS: |
|---|
| 1763 | 2068 | case IPL_TYPE_UNKNOWN: |
|---|
| .. | .. |
|---|
| 1767 | 2072 | atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb); |
|---|
| 1768 | 2073 | } |
|---|
| 1769 | 2074 | |
|---|
| 1770 | | -void __init ipl_store_parameters(void) |
|---|
| 1771 | | -{ |
|---|
| 1772 | | - int rc; |
|---|
| 1773 | | - |
|---|
| 1774 | | - rc = diag308(DIAG308_STORE, &ipl_block); |
|---|
| 1775 | | - if (rc == DIAG308_RC_OK && ipl_block.hdr.version <= IPL_MAX_SUPPORTED_VERSION) |
|---|
| 1776 | | - ipl_block_valid = 1; |
|---|
| 1777 | | -} |
|---|
| 1778 | | - |
|---|
| 1779 | 2075 | void s390_reset_system(void) |
|---|
| 1780 | 2076 | { |
|---|
| 1781 | 2077 | /* Disable prefixing */ |
|---|
| .. | .. |
|---|
| 1783 | 2079 | |
|---|
| 1784 | 2080 | /* Disable lowcore protection */ |
|---|
| 1785 | 2081 | __ctl_clear_bit(0, 28); |
|---|
| 1786 | | - diag308_reset(); |
|---|
| 2082 | + diag_dma_ops.diag308_reset(); |
|---|
| 1787 | 2083 | } |
|---|
| 2084 | + |
|---|
| 2085 | +#ifdef CONFIG_KEXEC_FILE |
|---|
| 2086 | + |
|---|
| 2087 | +int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf, |
|---|
| 2088 | + unsigned char flags, unsigned short cert) |
|---|
| 2089 | +{ |
|---|
| 2090 | + struct ipl_report_component *comp; |
|---|
| 2091 | + |
|---|
| 2092 | + comp = vzalloc(sizeof(*comp)); |
|---|
| 2093 | + if (!comp) |
|---|
| 2094 | + return -ENOMEM; |
|---|
| 2095 | + list_add_tail(&comp->list, &report->components); |
|---|
| 2096 | + |
|---|
| 2097 | + comp->entry.addr = kbuf->mem; |
|---|
| 2098 | + comp->entry.len = kbuf->memsz; |
|---|
| 2099 | + comp->entry.flags = flags; |
|---|
| 2100 | + comp->entry.certificate_index = cert; |
|---|
| 2101 | + |
|---|
| 2102 | + report->size += sizeof(comp->entry); |
|---|
| 2103 | + |
|---|
| 2104 | + return 0; |
|---|
| 2105 | +} |
|---|
| 2106 | + |
|---|
| 2107 | +int ipl_report_add_certificate(struct ipl_report *report, void *key, |
|---|
| 2108 | + unsigned long addr, unsigned long len) |
|---|
| 2109 | +{ |
|---|
| 2110 | + struct ipl_report_certificate *cert; |
|---|
| 2111 | + |
|---|
| 2112 | + cert = vzalloc(sizeof(*cert)); |
|---|
| 2113 | + if (!cert) |
|---|
| 2114 | + return -ENOMEM; |
|---|
| 2115 | + list_add_tail(&cert->list, &report->certificates); |
|---|
| 2116 | + |
|---|
| 2117 | + cert->entry.addr = addr; |
|---|
| 2118 | + cert->entry.len = len; |
|---|
| 2119 | + cert->key = key; |
|---|
| 2120 | + |
|---|
| 2121 | + report->size += sizeof(cert->entry); |
|---|
| 2122 | + report->size += cert->entry.len; |
|---|
| 2123 | + |
|---|
| 2124 | + return 0; |
|---|
| 2125 | +} |
|---|
| 2126 | + |
|---|
| 2127 | +struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib) |
|---|
| 2128 | +{ |
|---|
| 2129 | + struct ipl_report *report; |
|---|
| 2130 | + |
|---|
| 2131 | + report = vzalloc(sizeof(*report)); |
|---|
| 2132 | + if (!report) |
|---|
| 2133 | + return ERR_PTR(-ENOMEM); |
|---|
| 2134 | + |
|---|
| 2135 | + report->ipib = ipib; |
|---|
| 2136 | + INIT_LIST_HEAD(&report->components); |
|---|
| 2137 | + INIT_LIST_HEAD(&report->certificates); |
|---|
| 2138 | + |
|---|
| 2139 | + report->size = ALIGN(ipib->hdr.len, 8); |
|---|
| 2140 | + report->size += sizeof(struct ipl_rl_hdr); |
|---|
| 2141 | + report->size += sizeof(struct ipl_rb_components); |
|---|
| 2142 | + report->size += sizeof(struct ipl_rb_certificates); |
|---|
| 2143 | + |
|---|
| 2144 | + return report; |
|---|
| 2145 | +} |
|---|
| 2146 | + |
|---|
| 2147 | +void *ipl_report_finish(struct ipl_report *report) |
|---|
| 2148 | +{ |
|---|
| 2149 | + struct ipl_report_certificate *cert; |
|---|
| 2150 | + struct ipl_report_component *comp; |
|---|
| 2151 | + struct ipl_rb_certificates *certs; |
|---|
| 2152 | + struct ipl_parameter_block *ipib; |
|---|
| 2153 | + struct ipl_rb_components *comps; |
|---|
| 2154 | + struct ipl_rl_hdr *rl_hdr; |
|---|
| 2155 | + void *buf, *ptr; |
|---|
| 2156 | + |
|---|
| 2157 | + buf = vzalloc(report->size); |
|---|
| 2158 | + if (!buf) |
|---|
| 2159 | + goto out; |
|---|
| 2160 | + ptr = buf; |
|---|
| 2161 | + |
|---|
| 2162 | + memcpy(ptr, report->ipib, report->ipib->hdr.len); |
|---|
| 2163 | + ipib = ptr; |
|---|
| 2164 | + if (ipl_secure_flag) |
|---|
| 2165 | + ipib->hdr.flags |= IPL_PL_FLAG_SIPL; |
|---|
| 2166 | + ipib->hdr.flags |= IPL_PL_FLAG_IPLSR; |
|---|
| 2167 | + ptr += report->ipib->hdr.len; |
|---|
| 2168 | + ptr = PTR_ALIGN(ptr, 8); |
|---|
| 2169 | + |
|---|
| 2170 | + rl_hdr = ptr; |
|---|
| 2171 | + ptr += sizeof(*rl_hdr); |
|---|
| 2172 | + |
|---|
| 2173 | + comps = ptr; |
|---|
| 2174 | + comps->rbt = IPL_RBT_COMPONENTS; |
|---|
| 2175 | + ptr += sizeof(*comps); |
|---|
| 2176 | + list_for_each_entry(comp, &report->components, list) { |
|---|
| 2177 | + memcpy(ptr, &comp->entry, sizeof(comp->entry)); |
|---|
| 2178 | + ptr += sizeof(comp->entry); |
|---|
| 2179 | + } |
|---|
| 2180 | + comps->len = ptr - (void *)comps; |
|---|
| 2181 | + |
|---|
| 2182 | + certs = ptr; |
|---|
| 2183 | + certs->rbt = IPL_RBT_CERTIFICATES; |
|---|
| 2184 | + ptr += sizeof(*certs); |
|---|
| 2185 | + list_for_each_entry(cert, &report->certificates, list) { |
|---|
| 2186 | + memcpy(ptr, &cert->entry, sizeof(cert->entry)); |
|---|
| 2187 | + ptr += sizeof(cert->entry); |
|---|
| 2188 | + } |
|---|
| 2189 | + certs->len = ptr - (void *)certs; |
|---|
| 2190 | + rl_hdr->len = ptr - (void *)rl_hdr; |
|---|
| 2191 | + |
|---|
| 2192 | + list_for_each_entry(cert, &report->certificates, list) { |
|---|
| 2193 | + memcpy(ptr, cert->key, cert->entry.len); |
|---|
| 2194 | + ptr += cert->entry.len; |
|---|
| 2195 | + } |
|---|
| 2196 | + |
|---|
| 2197 | + BUG_ON(ptr > buf + report->size); |
|---|
| 2198 | +out: |
|---|
| 2199 | + return buf; |
|---|
| 2200 | +} |
|---|
| 2201 | + |
|---|
| 2202 | +int ipl_report_free(struct ipl_report *report) |
|---|
| 2203 | +{ |
|---|
| 2204 | + struct ipl_report_component *comp, *ncomp; |
|---|
| 2205 | + struct ipl_report_certificate *cert, *ncert; |
|---|
| 2206 | + |
|---|
| 2207 | + list_for_each_entry_safe(comp, ncomp, &report->components, list) |
|---|
| 2208 | + vfree(comp); |
|---|
| 2209 | + |
|---|
| 2210 | + list_for_each_entry_safe(cert, ncert, &report->certificates, list) |
|---|
| 2211 | + vfree(cert); |
|---|
| 2212 | + |
|---|
| 2213 | + vfree(report); |
|---|
| 2214 | + |
|---|
| 2215 | + return 0; |
|---|
| 2216 | +} |
|---|
| 2217 | + |
|---|
| 2218 | +#endif |
|---|