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

s390: nvme ipl

Recognize IPL Block's Ipl Type of "nvme". Populate related structs and sysfs
entries.

Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Jason J. Herne and committed by
Vasily Gorbik
3737e8ee 9056754f

+99
+11
arch/s390/include/asm/ipl.h
··· 21 21 struct ipl_pb0_common common; 22 22 struct ipl_pb0_fcp fcp; 23 23 struct ipl_pb0_ccw ccw; 24 + struct ipl_pb0_nvme nvme; 24 25 char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)]; 25 26 }; 26 27 } __packed __aligned(PAGE_SIZE); ··· 31 30 #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \ 32 31 sizeof(struct ipl_pb0_fcp)) 33 32 #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp)) 33 + 34 + #define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \ 35 + sizeof(struct ipl_pb0_nvme)) 36 + #define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme)) 37 + 34 38 #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \ 35 39 sizeof(struct ipl_pb0_ccw)) 36 40 #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw)) ··· 65 59 IPL_TYPE_FCP = 4, 66 60 IPL_TYPE_FCP_DUMP = 8, 67 61 IPL_TYPE_NSS = 16, 62 + IPL_TYPE_NVME = 32, 68 63 }; 69 64 70 65 struct ipl_info ··· 80 73 u64 wwpn; 81 74 u64 lun; 82 75 } fcp; 76 + struct { 77 + u32 fid; 78 + u32 nsid; 79 + } nvme; 83 80 struct { 84 81 char name[NSS_NAME_SIZE + 1]; 85 82 } nss;
+25
arch/s390/include/uapi/asm/ipl.h
··· 27 27 IPL_PBT_FCP = 0, 28 28 IPL_PBT_SCP_DATA = 1, 29 29 IPL_PBT_CCW = 2, 30 + IPL_PBT_NVME = 4, 30 31 }; 31 32 32 33 /* IPL Parameter Block 0 with common fields */ ··· 67 66 68 67 #define IPL_PB0_FCP_OPT_IPL 0x10 69 68 #define IPL_PB0_FCP_OPT_DUMP 0x20 69 + 70 + /* IPL Parameter Block 0 for NVMe */ 71 + struct ipl_pb0_nvme { 72 + __u32 len; 73 + __u8 pbt; 74 + __u8 reserved1[3]; 75 + __u8 loadparm[8]; 76 + __u8 reserved2[304]; 77 + __u8 opt; 78 + __u8 reserved3[3]; 79 + __u32 fid; 80 + __u8 reserved4[12]; 81 + __u32 nsid; 82 + __u8 reserved5[4]; 83 + __u32 bootprog; 84 + __u8 reserved6[12]; 85 + __u64 br_lba; 86 + __u32 scp_data_len; 87 + __u8 reserved7[260]; 88 + __u8 scp_data[]; 89 + } __packed; 90 + 91 + #define IPL_PB0_NVME_OPT_IPL 0x10 92 + #define IPL_PB0_NVME_OPT_DUMP 0x20 70 93 71 94 /* IPL Parameter Block 0 for CCW */ 72 95 struct ipl_pb0_ccw {
+63
arch/s390/kernel/ipl.c
··· 39 39 #define IPL_CCW_STR "ccw" 40 40 #define IPL_FCP_STR "fcp" 41 41 #define IPL_FCP_DUMP_STR "fcp_dump" 42 + #define IPL_NVME_STR "nvme" 42 43 #define IPL_NSS_STR "nss" 43 44 44 45 #define DUMP_CCW_STR "ccw" ··· 94 93 return IPL_FCP_DUMP_STR; 95 94 case IPL_TYPE_NSS: 96 95 return IPL_NSS_STR; 96 + case IPL_TYPE_NVME: 97 + return IPL_NVME_STR; 97 98 case IPL_TYPE_UNKNOWN: 98 99 default: 99 100 return IPL_UNKNOWN_STR; ··· 264 261 return IPL_TYPE_FCP_DUMP; 265 262 else 266 263 return IPL_TYPE_FCP; 264 + case IPL_PBT_NVME: 265 + return IPL_TYPE_NVME; 267 266 } 268 267 return IPL_TYPE_UNKNOWN; 269 268 } ··· 322 317 case IPL_TYPE_FCP: 323 318 case IPL_TYPE_FCP_DUMP: 324 319 return sprintf(page, "0.0.%04x\n", ipl_block.fcp.devno); 320 + case IPL_TYPE_NVME: 321 + return sprintf(page, "%08ux\n", ipl_block.nvme.fid); 325 322 default: 326 323 return 0; 327 324 } ··· 352 345 353 346 return memory_read_from_buffer(buf, count, &off, scp_data, size); 354 347 } 348 + 349 + static ssize_t ipl_nvme_scp_data_read(struct file *filp, struct kobject *kobj, 350 + struct bin_attribute *attr, char *buf, 351 + loff_t off, size_t count) 352 + { 353 + unsigned int size = ipl_block.nvme.scp_data_len; 354 + void *scp_data = &ipl_block.nvme.scp_data; 355 + 356 + return memory_read_from_buffer(buf, count, &off, scp_data, size); 357 + } 358 + 355 359 static struct bin_attribute ipl_scp_data_attr = 356 360 __BIN_ATTR(scp_data, S_IRUGO, ipl_scp_data_read, NULL, PAGE_SIZE); 361 + 362 + static struct bin_attribute ipl_nvme_scp_data_attr = 363 + __BIN_ATTR(scp_data, S_IRUGO, ipl_nvme_scp_data_read, NULL, PAGE_SIZE); 357 364 358 365 static struct bin_attribute *ipl_fcp_bin_attrs[] = { 359 366 &ipl_parameter_attr, 360 367 &ipl_scp_data_attr, 368 + NULL, 369 + }; 370 + 371 + static struct bin_attribute *ipl_nvme_bin_attrs[] = { 372 + &ipl_parameter_attr, 373 + &ipl_nvme_scp_data_attr, 361 374 NULL, 362 375 }; 363 376 ··· 391 364 (unsigned long long)ipl_block.fcp.bootprog); 392 365 DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", 393 366 (unsigned long long)ipl_block.fcp.br_lba); 367 + 368 + /* NVMe ipl device attributes */ 369 + DEFINE_IPL_ATTR_RO(ipl_nvme, fid, "0x%08llx\n", 370 + (unsigned long long)ipl_block.nvme.fid); 371 + DEFINE_IPL_ATTR_RO(ipl_nvme, nsid, "0x%08llx\n", 372 + (unsigned long long)ipl_block.nvme.nsid); 373 + DEFINE_IPL_ATTR_RO(ipl_nvme, bootprog, "%lld\n", 374 + (unsigned long long)ipl_block.nvme.bootprog); 375 + DEFINE_IPL_ATTR_RO(ipl_nvme, br_lba, "%lld\n", 376 + (unsigned long long)ipl_block.nvme.br_lba); 394 377 395 378 static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, 396 379 struct kobj_attribute *attr, char *page) ··· 435 398 .attrs = ipl_fcp_attrs, 436 399 .bin_attrs = ipl_fcp_bin_attrs, 437 400 }; 401 + 402 + static struct attribute *ipl_nvme_attrs[] = { 403 + &sys_ipl_type_attr.attr, 404 + &sys_ipl_nvme_fid_attr.attr, 405 + &sys_ipl_nvme_nsid_attr.attr, 406 + &sys_ipl_nvme_bootprog_attr.attr, 407 + &sys_ipl_nvme_br_lba_attr.attr, 408 + &sys_ipl_ccw_loadparm_attr.attr, 409 + &sys_ipl_secure_attr.attr, 410 + &sys_ipl_has_secure_attr.attr, 411 + NULL, 412 + }; 413 + 414 + static struct attribute_group ipl_nvme_attr_group = { 415 + .attrs = ipl_nvme_attrs, 416 + .bin_attrs = ipl_nvme_bin_attrs, 417 + }; 418 + 438 419 439 420 /* CCW ipl device attributes */ 440 421 ··· 528 473 case IPL_TYPE_FCP: 529 474 case IPL_TYPE_FCP_DUMP: 530 475 rc = sysfs_create_group(&ipl_kset->kobj, &ipl_fcp_attr_group); 476 + break; 477 + case IPL_TYPE_NVME: 478 + rc = sysfs_create_group(&ipl_kset->kobj, &ipl_nvme_attr_group); 531 479 break; 532 480 default: 533 481 rc = sysfs_create_group(&ipl_kset->kobj, ··· 1007 949 diag308(DIAG308_SET, reipl_block_nss); 1008 950 diag308(DIAG308_LOAD_CLEAR, NULL); 1009 951 break; 952 + case IPL_TYPE_NVME: 1010 953 case IPL_TYPE_UNKNOWN: 1011 954 diag308(DIAG308_LOAD_CLEAR, NULL); 1012 955 break; ··· 1808 1749 ipl_info.data.fcp.dev_id.devno = ipl_block.fcp.devno; 1809 1750 ipl_info.data.fcp.wwpn = ipl_block.fcp.wwpn; 1810 1751 ipl_info.data.fcp.lun = ipl_block.fcp.lun; 1752 + break; 1753 + case IPL_TYPE_NVME: 1754 + ipl_info.data.nvme.fid = ipl_block.nvme.fid; 1755 + ipl_info.data.nvme.nsid = ipl_block.nvme.nsid; 1811 1756 break; 1812 1757 case IPL_TYPE_NSS: 1813 1758 case IPL_TYPE_UNKNOWN: