Merge patch series "mpi3mr: Few Enhancements and minor fix"

Ranjan Kumar <ranjan.kumar@broadcom.com> says:

Few Enhancements and minor fix of mpi3mr driver.

Link: https://lore.kernel.org/r/20240905102753.105310-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+119 -26
+32 -3
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
··· 67 67 #define MPI3_SECURITY_PGAD_SLOT_GROUP_MASK (0x0000ff00) 68 68 #define MPI3_SECURITY_PGAD_SLOT_GROUP_SHIFT (8) 69 69 #define MPI3_SECURITY_PGAD_SLOT_MASK (0x000000ff) 70 + #define MPI3_INSTANCE_PGAD_INSTANCE_MASK (0x0000ffff) 70 71 struct mpi3_config_request { 71 72 __le16 host_tag; 72 73 u8 ioc_use_only02; ··· 76 75 u8 ioc_use_only06; 77 76 u8 msg_flags; 78 77 __le16 change_count; 79 - __le16 reserved0a; 78 + u8 proxy_ioc_number; 79 + u8 reserved0b; 80 80 u8 page_version; 81 81 u8 page_number; 82 82 u8 page_type; ··· 208 206 #define MPI3_MFGPAGE_DEVID_SAS5116_MPI_MGMT (0x00b5) 209 207 #define MPI3_MFGPAGE_DEVID_SAS5116_NVME_MGMT (0x00b6) 210 208 #define MPI3_MFGPAGE_DEVID_SAS5116_PCIE_SWITCH (0x00b8) 209 + #define MPI3_MFGPAGE_DEVID_SAS5248_MPI (0x00f0) 210 + #define MPI3_MFGPAGE_DEVID_SAS5248_MPI_NS (0x00f1) 211 + #define MPI3_MFGPAGE_DEVID_SAS5248_PCIE_SWITCH (0x00f2) 211 212 struct mpi3_man_page0 { 212 213 struct mpi3_config_page_header header; 213 214 u8 chip_revision[8]; ··· 1079 1074 #define MPI3_IOUNIT8_SBSTATE_SVN_UPDATE_PENDING (0x04) 1080 1075 #define MPI3_IOUNIT8_SBSTATE_KEY_UPDATE_PENDING (0x02) 1081 1076 #define MPI3_IOUNIT8_SBSTATE_SECURE_BOOT_ENABLED (0x01) 1077 + #define MPI3_IOUNIT8_SBMODE_CURRENT_KEY_IOUNIT17 (0x10) 1078 + #define MPI3_IOUNIT8_SBMODE_HARD_SECURE_RECERTIFIED (0x08) 1082 1079 struct mpi3_io_unit_page9 { 1083 1080 struct mpi3_config_page_header header; 1084 1081 __le32 flags; ··· 1096 1089 #define MPI3_IOUNIT9_FLAGS_UBM_ENCLOSURE_ORDER_BACKPLANE_TYPE (0x00000004) 1097 1090 #define MPI3_IOUNIT9_FLAGS_VDFIRST_ENABLED (0x00000001) 1098 1091 #define MPI3_IOUNIT9_FIRSTDEVICE_UNKNOWN (0xffff) 1092 + #define MPI3_IOUNIT9_FIRSTDEVICE_IN_DRIVER_PAGE_0 (0xfffe) 1093 + 1099 1094 struct mpi3_io_unit_page10 { 1100 1095 struct mpi3_config_page_header header; 1101 1096 u8 flags; ··· 1233 1224 #define MPI3_IOUNIT15_FLAGS_EPRSUPPORT_WITHOUT_POWER_BRAKE_GPIO (0x01) 1234 1225 #define MPI3_IOUNIT15_FLAGS_EPRSUPPORT_WITH_POWER_BRAKE_GPIO (0x02) 1235 1226 #define MPI3_IOUNIT15_NUMPOWERBUDGETDATA_POWER_BUDGETING_DISABLED (0x00) 1227 + 1228 + struct mpi3_io_unit_page17 { 1229 + struct mpi3_config_page_header header; 1230 + u8 num_instances; 1231 + u8 instance; 1232 + __le16 reserved0a; 1233 + __le32 reserved0c[4]; 1234 + __le16 key_length; 1235 + u8 encryption_algorithm; 1236 + u8 reserved1f; 1237 + __le32 current_key[]; 1238 + }; 1239 + #define MPI3_IOUNIT17_PAGEVERSION (0x00) 1236 1240 struct mpi3_ioc_page0 { 1237 1241 struct mpi3_config_page_header header; 1238 1242 __le32 reserved08; ··· 1333 1311 u8 tur_interval; 1334 1312 u8 reserved10; 1335 1313 u8 security_key_timeout; 1336 - __le16 reserved12; 1314 + __le16 first_device; 1337 1315 __le32 reserved14; 1338 1316 __le32 reserved18; 1339 1317 }; ··· 1346 1324 #define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_AND_DEVS (0x00000000) 1347 1325 #define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_ONLY (0x00000001) 1348 1326 #define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_AND_INTERNAL_DEVS (0x00000002) 1327 + #define MPI3_DRIVER0_FIRSTDEVICE_IGNORE1 (0x0000) 1328 + #define MPI3_DRIVER0_FIRSTDEVICE_IGNORE2 (0xffff) 1349 1329 struct mpi3_driver_page1 { 1350 1330 struct mpi3_config_page_header header; 1351 1331 __le32 flags; 1352 - __le32 reserved0c; 1332 + u8 time_stamp_update; 1333 + u8 reserved0d[3]; 1353 1334 __le16 host_diag_trace_max_size; 1354 1335 __le16 host_diag_trace_min_size; 1355 1336 __le16 host_diag_trace_decrement_size; ··· 2372 2347 #define MPI3_DEVICE0_VD_DEVICE_INFO_SAS (0x0001) 2373 2348 #define MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_MASK (0xf000) 2374 2349 #define MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_SHIFT (12) 2350 + #define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_MASK (0x0003) 2351 + #define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_HDD (0x0000) 2352 + #define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_SSD (0x0001) 2353 + #define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_NO_GUIDANCE (0x0002) 2375 2354 union mpi3_device0_dev_spec_format { 2376 2355 struct mpi3_device0_sas_sata_format sas_sata_format; 2377 2356 struct mpi3_device0_pcie_format pcie_format;
+10 -3
drivers/scsi/mpi3mr/mpi/mpi30_image.h
··· 205 205 u8 hash_image_type; 206 206 u8 hash_algorithm; 207 207 u8 encryption_algorithm; 208 - u8 reserved03; 208 + u8 flags; 209 209 __le16 public_key_size; 210 210 __le16 signature_size; 211 211 __le32 public_key[MPI3_PUBLIC_KEY_MAX]; 212 212 }; 213 - 214 - #define MPI3_HASH_IMAGE_TYPE_KEY_WITH_SIGNATURE (0x03) 213 + #define MPI3_HASH_IMAGE_TYPE_KEY_WITH_HASH (0x03) 214 + #define MPI3_HASH_IMAGE_TYPE_KEY_WITH_HASH_1_OF_2 (0x04) 215 + #define MPI3_HASH_IMAGE_TYPE_KEY_WITH_HASH_2_OF_2 (0x05) 215 216 #define MPI3_HASH_ALGORITHM_VERSION_MASK (0xe0) 216 217 #define MPI3_HASH_ALGORITHM_VERSION_NONE (0x00) 217 218 #define MPI3_HASH_ALGORITHM_VERSION_SHA1 (0x20) ··· 230 229 #define MPI3_ENCRYPTION_ALGORITHM_RSA2048 (0x04) 231 230 #define MPI3_ENCRYPTION_ALGORITHM_RSA4096 (0x05) 232 231 #define MPI3_ENCRYPTION_ALGORITHM_RSA3072 (0x06) 232 + 233 + /* hierarchical signature system (hss) */ 234 + #define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_87 (0x0b) 235 + #define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_65 (0x0c) 236 + #define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_44 (0x0d) 237 + #define MPI3_ENCRYPTED_HASH_ENTRY_FLAGS_PAIRED_KEY_MASK (0x0f) 233 238 234 239 #ifndef MPI3_ENCRYPTED_HASH_ENTRY_MAX 235 240 #define MPI3_ENCRYPTED_HASH_ENTRY_MAX (1)
+8
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
··· 39 39 #define MPI3_WHOINIT_HOST_DRIVER (0x03) 40 40 #define MPI3_WHOINIT_MANUFACTURER (0x04) 41 41 42 + #define MPI3_IOCINIT_DRIVERCAP_OSEXPOSURE_MASK (0x00000003) 43 + #define MPI3_IOCINIT_DRIVERCAP_OSEXPOSURE_NO_GUIDANCE (0x00000000) 44 + #define MPI3_IOCINIT_DRIVERCAP_OSEXPOSURE_NO_SPECIAL (0x00000001) 45 + #define MPI3_IOCINIT_DRIVERCAP_OSEXPOSURE_REPORT_AS_HDD (0x00000002) 46 + #define MPI3_IOCINIT_DRIVERCAP_OSEXPOSURE_REPORT_AS_SSD (0x00000003) 47 + 42 48 struct mpi3_ioc_facts_request { 43 49 __le16 host_tag; 44 50 u8 ioc_use_only02; ··· 146 140 #define MPI3_IOCFACTS_EXCEPT_MANUFACT_CHECKSUM_FAIL (0x0020) 147 141 #define MPI3_IOCFACTS_EXCEPT_FW_CHECKSUM_FAIL (0x0010) 148 142 #define MPI3_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL (0x0008) 143 + #define MPI3_IOCFACTS_EXCEPT_BLOCKING_BOOT_EVENT (0x0004) 144 + #define MPI3_IOCFACTS_EXCEPT_SECURITY_SELFTEST_FAILURE (0x0002) 149 145 #define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_MASK (0x0001) 150 146 #define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_PRIMARY (0x0000) 151 147 #define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_SECONDARY (0x0001)
+3 -1
drivers/scsi/mpi3mr/mpi/mpi30_transport.h
··· 18 18 19 19 #define MPI3_VERSION_MAJOR (3) 20 20 #define MPI3_VERSION_MINOR (0) 21 - #define MPI3_VERSION_UNIT (31) 21 + #define MPI3_VERSION_UNIT (34) 22 22 #define MPI3_VERSION_DEV (0) 23 23 #define MPI3_DEVHANDLE_INVALID (0xffff) 24 24 struct mpi3_sysif_oper_queue_indexes { ··· 158 158 #define MPI3_SYSIF_FAULT_CODE_SOFT_RESET_NEEDED (0x0000f004) 159 159 #define MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED (0x0000f005) 160 160 #define MPI3_SYSIF_FAULT_CODE_TEMP_THRESHOLD_EXCEEDED (0x0000f006) 161 + #define MPI3_SYSIF_FAULT_CODE_INSUFFICIENT_PCI_SLOT_POWER (0x0000f007) 161 162 #define MPI3_SYSIF_FAULT_INFO0_OFFSET (0x00001c14) 162 163 #define MPI3_SYSIF_FAULT_INFO1_OFFSET (0x00001c18) 163 164 #define MPI3_SYSIF_FAULT_INFO2_OFFSET (0x00001c1c) ··· 411 410 #define MPI3_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006) 412 411 #define MPI3_IOCSTATUS_INVALID_FIELD (0x0007) 413 412 #define MPI3_IOCSTATUS_INVALID_STATE (0x0008) 413 + #define MPI3_IOCSTATUS_SHUTDOWN_ACTIVE (0x0009) 414 414 #define MPI3_IOCSTATUS_INSUFFICIENT_POWER (0x000a) 415 415 #define MPI3_IOCSTATUS_INVALID_CHANGE_COUNT (0x000b) 416 416 #define MPI3_IOCSTATUS_ALLOWED_CMD_BLOCK (0x000c)
+5 -3
drivers/scsi/mpi3mr/mpi3mr.h
··· 57 57 extern int prot_mask; 58 58 extern atomic64_t event_counter; 59 59 60 - #define MPI3MR_DRIVER_VERSION "8.10.0.5.50" 61 - #define MPI3MR_DRIVER_RELDATE "08-Aug-2024" 60 + #define MPI3MR_DRIVER_VERSION "8.12.0.0.50" 61 + #define MPI3MR_DRIVER_RELDATE "05-Sept-2024" 62 62 63 63 #define MPI3MR_DRIVER_NAME "mpi3mr" 64 64 #define MPI3MR_DRIVER_LICENSE "GPL" ··· 1090 1090 * @evtack_cmds_bitmap: Event Ack bitmap 1091 1091 * @delayed_evtack_cmds_list: Delayed event acknowledgment list 1092 1092 * @ts_update_counter: Timestamp update counter 1093 + * @ts_update_interval: Timestamp update interval 1093 1094 * @reset_in_progress: Reset in progress flag 1094 1095 * @unrecoverable: Controller unrecoverable flag 1095 1096 * @prev_reset_result: Result of previous reset ··· 1278 1277 unsigned long *evtack_cmds_bitmap; 1279 1278 struct list_head delayed_evtack_cmds_list; 1280 1279 1281 - u32 ts_update_counter; 1280 + u16 ts_update_counter; 1281 + u16 ts_update_interval; 1282 1282 u8 reset_in_progress; 1283 1283 u8 unrecoverable; 1284 1284 int prev_reset_result;
+61 -16
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 1362 1362 int retval = 0; 1363 1363 enum mpi3mr_iocstate ioc_state; 1364 1364 u64 base_info; 1365 + u8 retry = 0; 1366 + u64 start_time, elapsed_time_sec; 1367 + 1368 + retry_bring_ioc_ready: 1365 1369 1366 1370 ioc_status = readl(&mrioc->sysif_regs->ioc_status); 1367 1371 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration); ··· 1384 1380 ioc_info(mrioc, "controller is in %s state during detection\n", 1385 1381 mpi3mr_iocstate_name(ioc_state)); 1386 1382 1387 - if (ioc_state == MRIOC_STATE_BECOMING_READY || 1388 - ioc_state == MRIOC_STATE_RESET_REQUESTED) { 1389 - timeout = mrioc->ready_timeout * 10; 1390 - do { 1391 - msleep(100); 1392 - } while (--timeout); 1383 + timeout = mrioc->ready_timeout * 10; 1384 + 1385 + do { 1386 + ioc_state = mpi3mr_get_iocstate(mrioc); 1387 + 1388 + if (ioc_state != MRIOC_STATE_BECOMING_READY && 1389 + ioc_state != MRIOC_STATE_RESET_REQUESTED) 1390 + break; 1393 1391 1394 1392 if (!pci_device_is_present(mrioc->pdev)) { 1395 1393 mrioc->unrecoverable = 1; 1396 - ioc_err(mrioc, 1397 - "controller is not present while waiting to reset\n"); 1398 - retval = -1; 1394 + ioc_err(mrioc, "controller is not present while waiting to reset\n"); 1399 1395 goto out_device_not_present; 1400 1396 } 1401 1397 1402 - ioc_state = mpi3mr_get_iocstate(mrioc); 1403 - ioc_info(mrioc, 1404 - "controller is in %s state after waiting to reset\n", 1405 - mpi3mr_iocstate_name(ioc_state)); 1406 - } 1398 + msleep(100); 1399 + } while (--timeout); 1407 1400 1408 1401 if (ioc_state == MRIOC_STATE_READY) { 1409 1402 ioc_info(mrioc, "issuing message unit reset (MUR) to bring to reset state\n"); ··· 1461 1460 ioc_config |= MPI3_SYSIF_IOC_CONFIG_ENABLE_IOC; 1462 1461 writel(ioc_config, &mrioc->sysif_regs->ioc_configuration); 1463 1462 1463 + if (retry == 0) 1464 + start_time = jiffies; 1465 + 1464 1466 timeout = mrioc->ready_timeout * 10; 1465 1467 do { 1466 1468 ioc_state = mpi3mr_get_iocstate(mrioc); ··· 1473 1469 mpi3mr_iocstate_name(ioc_state)); 1474 1470 return 0; 1475 1471 } 1472 + ioc_status = readl(&mrioc->sysif_regs->ioc_status); 1473 + if ((ioc_status & MPI3_SYSIF_IOC_STATUS_RESET_HISTORY) || 1474 + (ioc_status & MPI3_SYSIF_IOC_STATUS_FAULT)) { 1475 + mpi3mr_print_fault_info(mrioc); 1476 + goto out_failed; 1477 + } 1476 1478 if (!pci_device_is_present(mrioc->pdev)) { 1477 1479 mrioc->unrecoverable = 1; 1478 1480 ioc_err(mrioc, ··· 1487 1477 goto out_device_not_present; 1488 1478 } 1489 1479 msleep(100); 1490 - } while (--timeout); 1480 + elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000; 1481 + } while (elapsed_time_sec < mrioc->ready_timeout); 1491 1482 1492 1483 out_failed: 1484 + elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000; 1485 + if ((retry < 2) && (elapsed_time_sec < (mrioc->ready_timeout - 60))) { 1486 + retry++; 1487 + 1488 + ioc_warn(mrioc, "retrying to bring IOC ready, retry_count:%d\n" 1489 + " elapsed time =%llu\n", retry, elapsed_time_sec); 1490 + 1491 + goto retry_bring_ioc_ready; 1492 + } 1493 1493 ioc_state = mpi3mr_get_iocstate(mrioc); 1494 1494 ioc_err(mrioc, 1495 1495 "failed to bring to ready state, current state: %s\n", ··· 2691 2671 return; 2692 2672 } 2693 2673 2694 - if (mrioc->ts_update_counter++ >= MPI3MR_TSUPDATE_INTERVAL) { 2674 + if (mrioc->ts_update_counter++ >= mrioc->ts_update_interval) { 2695 2675 mrioc->ts_update_counter = 0; 2696 2676 mpi3mr_sync_timestamp(mrioc); 2697 2677 } ··· 3865 3845 } 3866 3846 3867 3847 /** 3848 + * mpi3mr_read_tsu_interval - Update time stamp interval 3849 + * @mrioc: Adapter instance reference 3850 + * 3851 + * Update time stamp interval if its defined in driver page 1, 3852 + * otherwise use default value. 3853 + * 3854 + * Return: Nothing 3855 + */ 3856 + static void 3857 + mpi3mr_read_tsu_interval(struct mpi3mr_ioc *mrioc) 3858 + { 3859 + struct mpi3_driver_page1 driver_pg1; 3860 + u16 pg_sz = sizeof(driver_pg1); 3861 + int retval = 0; 3862 + 3863 + mrioc->ts_update_interval = MPI3MR_TSUPDATE_INTERVAL; 3864 + 3865 + retval = mpi3mr_cfg_get_driver_pg1(mrioc, &driver_pg1, pg_sz); 3866 + if (!retval && driver_pg1.time_stamp_update) 3867 + mrioc->ts_update_interval = (driver_pg1.time_stamp_update * 60); 3868 + } 3869 + 3870 + /** 3868 3871 * mpi3mr_print_ioc_info - Display controller information 3869 3872 * @mrioc: Adapter instance reference 3870 3873 * ··· 4183 4140 goto out_failed_noretry; 4184 4141 } 4185 4142 4143 + mpi3mr_read_tsu_interval(mrioc); 4186 4144 mpi3mr_print_ioc_info(mrioc); 4187 4145 4188 4146 if (!mrioc->cfg_page) { ··· 4365 4321 goto out_failed_noretry; 4366 4322 } 4367 4323 4324 + mpi3mr_read_tsu_interval(mrioc); 4368 4325 mpi3mr_print_ioc_info(mrioc); 4369 4326 4370 4327 if (is_resume) {