Skip to content

Commit 9547464

Browse files
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>
2 parents f81eaf0 + e7d67f3 commit 9547464

File tree

6 files changed

+119
-26
lines changed

6 files changed

+119
-26
lines changed

drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#define MPI3_SECURITY_PGAD_SLOT_GROUP_MASK (0x0000ff00)
6868
#define MPI3_SECURITY_PGAD_SLOT_GROUP_SHIFT (8)
6969
#define MPI3_SECURITY_PGAD_SLOT_MASK (0x000000ff)
70+
#define MPI3_INSTANCE_PGAD_INSTANCE_MASK (0x0000ffff)
7071
struct mpi3_config_request {
7172
__le16 host_tag;
7273
u8 ioc_use_only02;
@@ -75,7 +76,8 @@ struct mpi3_config_request {
7576
u8 ioc_use_only06;
7677
u8 msg_flags;
7778
__le16 change_count;
78-
__le16 reserved0a;
79+
u8 proxy_ioc_number;
80+
u8 reserved0b;
7981
u8 page_version;
8082
u8 page_number;
8183
u8 page_type;
@@ -206,6 +208,9 @@ struct mpi3_config_page_header {
206208
#define MPI3_MFGPAGE_DEVID_SAS5116_MPI_MGMT (0x00b5)
207209
#define MPI3_MFGPAGE_DEVID_SAS5116_NVME_MGMT (0x00b6)
208210
#define MPI3_MFGPAGE_DEVID_SAS5116_PCIE_SWITCH (0x00b8)
211+
#define MPI3_MFGPAGE_DEVID_SAS5248_MPI (0x00f0)
212+
#define MPI3_MFGPAGE_DEVID_SAS5248_MPI_NS (0x00f1)
213+
#define MPI3_MFGPAGE_DEVID_SAS5248_PCIE_SWITCH (0x00f2)
209214
struct mpi3_man_page0 {
210215
struct mpi3_config_page_header header;
211216
u8 chip_revision[8];
@@ -1074,6 +1079,8 @@ struct mpi3_io_unit_page8 {
10741079
#define MPI3_IOUNIT8_SBSTATE_SVN_UPDATE_PENDING (0x04)
10751080
#define MPI3_IOUNIT8_SBSTATE_KEY_UPDATE_PENDING (0x02)
10761081
#define MPI3_IOUNIT8_SBSTATE_SECURE_BOOT_ENABLED (0x01)
1082+
#define MPI3_IOUNIT8_SBMODE_CURRENT_KEY_IOUNIT17 (0x10)
1083+
#define MPI3_IOUNIT8_SBMODE_HARD_SECURE_RECERTIFIED (0x08)
10771084
struct mpi3_io_unit_page9 {
10781085
struct mpi3_config_page_header header;
10791086
__le32 flags;
@@ -1089,6 +1096,8 @@ struct mpi3_io_unit_page9 {
10891096
#define MPI3_IOUNIT9_FLAGS_UBM_ENCLOSURE_ORDER_BACKPLANE_TYPE (0x00000004)
10901097
#define MPI3_IOUNIT9_FLAGS_VDFIRST_ENABLED (0x00000001)
10911098
#define MPI3_IOUNIT9_FIRSTDEVICE_UNKNOWN (0xffff)
1099+
#define MPI3_IOUNIT9_FIRSTDEVICE_IN_DRIVER_PAGE_0 (0xfffe)
1100+
10921101
struct mpi3_io_unit_page10 {
10931102
struct mpi3_config_page_header header;
10941103
u8 flags;
@@ -1224,6 +1233,19 @@ struct mpi3_io_unit_page15 {
12241233
#define MPI3_IOUNIT15_FLAGS_EPRSUPPORT_WITHOUT_POWER_BRAKE_GPIO (0x01)
12251234
#define MPI3_IOUNIT15_FLAGS_EPRSUPPORT_WITH_POWER_BRAKE_GPIO (0x02)
12261235
#define MPI3_IOUNIT15_NUMPOWERBUDGETDATA_POWER_BUDGETING_DISABLED (0x00)
1236+
1237+
struct mpi3_io_unit_page17 {
1238+
struct mpi3_config_page_header header;
1239+
u8 num_instances;
1240+
u8 instance;
1241+
__le16 reserved0a;
1242+
__le32 reserved0c[4];
1243+
__le16 key_length;
1244+
u8 encryption_algorithm;
1245+
u8 reserved1f;
1246+
__le32 current_key[];
1247+
};
1248+
#define MPI3_IOUNIT17_PAGEVERSION (0x00)
12271249
struct mpi3_ioc_page0 {
12281250
struct mpi3_config_page_header header;
12291251
__le32 reserved08;
@@ -1311,7 +1333,7 @@ struct mpi3_driver_page0 {
13111333
u8 tur_interval;
13121334
u8 reserved10;
13131335
u8 security_key_timeout;
1314-
__le16 reserved12;
1336+
__le16 first_device;
13151337
__le32 reserved14;
13161338
__le32 reserved18;
13171339
};
@@ -1324,10 +1346,13 @@ struct mpi3_driver_page0 {
13241346
#define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_AND_DEVS (0x00000000)
13251347
#define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_ONLY (0x00000001)
13261348
#define MPI3_DRIVER0_BSDOPTS_REGISTRATION_IOC_AND_INTERNAL_DEVS (0x00000002)
1349+
#define MPI3_DRIVER0_FIRSTDEVICE_IGNORE1 (0x0000)
1350+
#define MPI3_DRIVER0_FIRSTDEVICE_IGNORE2 (0xffff)
13271351
struct mpi3_driver_page1 {
13281352
struct mpi3_config_page_header header;
13291353
__le32 flags;
1330-
__le32 reserved0c;
1354+
u8 time_stamp_update;
1355+
u8 reserved0d[3];
13311356
__le16 host_diag_trace_max_size;
13321357
__le16 host_diag_trace_min_size;
13331358
__le16 host_diag_trace_decrement_size;
@@ -2347,6 +2372,10 @@ struct mpi3_device0_vd_format {
23472372
#define MPI3_DEVICE0_VD_DEVICE_INFO_SAS (0x0001)
23482373
#define MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_MASK (0xf000)
23492374
#define MPI3_DEVICE0_VD_FLAGS_IO_THROTTLE_GROUP_QD_SHIFT (12)
2375+
#define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_MASK (0x0003)
2376+
#define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_HDD (0x0000)
2377+
#define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_SSD (0x0001)
2378+
#define MPI3_DEVICE0_VD_FLAGS_OSEXPOSURE_NO_GUIDANCE (0x0002)
23502379
union mpi3_device0_dev_spec_format {
23512380
struct mpi3_device0_sas_sata_format sas_sata_format;
23522381
struct mpi3_device0_pcie_format pcie_format;

drivers/scsi/mpi3mr/mpi/mpi30_image.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,14 @@ struct mpi3_encrypted_hash_entry {
205205
u8 hash_image_type;
206206
u8 hash_algorithm;
207207
u8 encryption_algorithm;
208-
u8 reserved03;
208+
u8 flags;
209209
__le16 public_key_size;
210210
__le16 signature_size;
211211
__le32 public_key[MPI3_PUBLIC_KEY_MAX];
212212
};
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)
215216
#define MPI3_HASH_ALGORITHM_VERSION_MASK (0xe0)
216217
#define MPI3_HASH_ALGORITHM_VERSION_NONE (0x00)
217218
#define MPI3_HASH_ALGORITHM_VERSION_SHA1 (0x20)
@@ -230,6 +231,12 @@ struct mpi3_encrypted_hash_entry {
230231
#define MPI3_ENCRYPTION_ALGORITHM_RSA4096 (0x05)
231232
#define MPI3_ENCRYPTION_ALGORITHM_RSA3072 (0x06)
232233

234+
/* hierarchical signature system (hss) */
235+
#define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_87 (0x0b)
236+
#define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_65 (0x0c)
237+
#define MPI3_ENCRYPTION_ALGORITHM_ML_DSA_44 (0x0d)
238+
#define MPI3_ENCRYPTED_HASH_ENTRY_FLAGS_PAIRED_KEY_MASK (0x0f)
239+
233240
#ifndef MPI3_ENCRYPTED_HASH_ENTRY_MAX
234241
#define MPI3_ENCRYPTED_HASH_ENTRY_MAX (1)
235242
#endif

drivers/scsi/mpi3mr/mpi/mpi30_ioc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ struct mpi3_ioc_init_request {
3939
#define MPI3_WHOINIT_HOST_DRIVER (0x03)
4040
#define MPI3_WHOINIT_MANUFACTURER (0x04)
4141

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+
4248
struct mpi3_ioc_facts_request {
4349
__le16 host_tag;
4450
u8 ioc_use_only02;
@@ -140,6 +146,8 @@ struct mpi3_ioc_facts_data {
140146
#define MPI3_IOCFACTS_EXCEPT_MANUFACT_CHECKSUM_FAIL (0x0020)
141147
#define MPI3_IOCFACTS_EXCEPT_FW_CHECKSUM_FAIL (0x0010)
142148
#define MPI3_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL (0x0008)
149+
#define MPI3_IOCFACTS_EXCEPT_BLOCKING_BOOT_EVENT (0x0004)
150+
#define MPI3_IOCFACTS_EXCEPT_SECURITY_SELFTEST_FAILURE (0x0002)
143151
#define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_MASK (0x0001)
144152
#define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_PRIMARY (0x0000)
145153
#define MPI3_IOCFACTS_EXCEPT_BOOTSTAT_SECONDARY (0x0001)

drivers/scsi/mpi3mr/mpi/mpi30_transport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ union mpi3_version_union {
1818

1919
#define MPI3_VERSION_MAJOR (3)
2020
#define MPI3_VERSION_MINOR (0)
21-
#define MPI3_VERSION_UNIT (31)
21+
#define MPI3_VERSION_UNIT (34)
2222
#define MPI3_VERSION_DEV (0)
2323
#define MPI3_DEVHANDLE_INVALID (0xffff)
2424
struct mpi3_sysif_oper_queue_indexes {
@@ -158,6 +158,7 @@ struct mpi3_sysif_registers {
158158
#define MPI3_SYSIF_FAULT_CODE_SOFT_RESET_NEEDED (0x0000f004)
159159
#define MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED (0x0000f005)
160160
#define MPI3_SYSIF_FAULT_CODE_TEMP_THRESHOLD_EXCEEDED (0x0000f006)
161+
#define MPI3_SYSIF_FAULT_CODE_INSUFFICIENT_PCI_SLOT_POWER (0x0000f007)
161162
#define MPI3_SYSIF_FAULT_INFO0_OFFSET (0x00001c14)
162163
#define MPI3_SYSIF_FAULT_INFO1_OFFSET (0x00001c18)
163164
#define MPI3_SYSIF_FAULT_INFO2_OFFSET (0x00001c1c)
@@ -410,6 +411,7 @@ struct mpi3_default_reply {
410411
#define MPI3_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006)
411412
#define MPI3_IOCSTATUS_INVALID_FIELD (0x0007)
412413
#define MPI3_IOCSTATUS_INVALID_STATE (0x0008)
414+
#define MPI3_IOCSTATUS_SHUTDOWN_ACTIVE (0x0009)
413415
#define MPI3_IOCSTATUS_INSUFFICIENT_POWER (0x000a)
414416
#define MPI3_IOCSTATUS_INVALID_CHANGE_COUNT (0x000b)
415417
#define MPI3_IOCSTATUS_ALLOWED_CMD_BLOCK (0x000c)

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ extern struct list_head mrioc_list;
5757
extern int prot_mask;
5858
extern atomic64_t event_counter;
5959

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"
6262

6363
#define MPI3MR_DRIVER_NAME "mpi3mr"
6464
#define MPI3MR_DRIVER_LICENSE "GPL"
@@ -1090,6 +1090,7 @@ struct scmd_priv {
10901090
* @evtack_cmds_bitmap: Event Ack bitmap
10911091
* @delayed_evtack_cmds_list: Delayed event acknowledgment list
10921092
* @ts_update_counter: Timestamp update counter
1093+
* @ts_update_interval: Timestamp update interval
10931094
* @reset_in_progress: Reset in progress flag
10941095
* @unrecoverable: Controller unrecoverable flag
10951096
* @prev_reset_result: Result of previous reset
@@ -1277,7 +1278,8 @@ struct mpi3mr_ioc {
12771278
unsigned long *evtack_cmds_bitmap;
12781279
struct list_head delayed_evtack_cmds_list;
12791280

1280-
u32 ts_update_counter;
1281+
u16 ts_update_counter;
1282+
u16 ts_update_interval;
12811283
u8 reset_in_progress;
12821284
u8 unrecoverable;
12831285
int prev_reset_result;

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,10 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
13621362
int retval = 0;
13631363
enum mpi3mr_iocstate ioc_state;
13641364
u64 base_info;
1365+
u8 retry = 0;
1366+
u64 start_time, elapsed_time_sec;
1367+
1368+
retry_bring_ioc_ready:
13651369

13661370
ioc_status = readl(&mrioc->sysif_regs->ioc_status);
13671371
ioc_config = readl(&mrioc->sysif_regs->ioc_configuration);
@@ -1380,26 +1384,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
13801384
ioc_info(mrioc, "controller is in %s state during detection\n",
13811385
mpi3mr_iocstate_name(ioc_state));
13821386

1383-
if (ioc_state == MRIOC_STATE_BECOMING_READY ||
1384-
ioc_state == MRIOC_STATE_RESET_REQUESTED) {
1385-
timeout = mrioc->ready_timeout * 10;
1386-
do {
1387-
msleep(100);
1388-
} while (--timeout);
1387+
timeout = mrioc->ready_timeout * 10;
1388+
1389+
do {
1390+
ioc_state = mpi3mr_get_iocstate(mrioc);
1391+
1392+
if (ioc_state != MRIOC_STATE_BECOMING_READY &&
1393+
ioc_state != MRIOC_STATE_RESET_REQUESTED)
1394+
break;
13891395

13901396
if (!pci_device_is_present(mrioc->pdev)) {
13911397
mrioc->unrecoverable = 1;
1392-
ioc_err(mrioc,
1393-
"controller is not present while waiting to reset\n");
1394-
retval = -1;
1398+
ioc_err(mrioc, "controller is not present while waiting to reset\n");
13951399
goto out_device_not_present;
13961400
}
13971401

1398-
ioc_state = mpi3mr_get_iocstate(mrioc);
1399-
ioc_info(mrioc,
1400-
"controller is in %s state after waiting to reset\n",
1401-
mpi3mr_iocstate_name(ioc_state));
1402-
}
1402+
msleep(100);
1403+
} while (--timeout);
14031404

14041405
if (ioc_state == MRIOC_STATE_READY) {
14051406
ioc_info(mrioc, "issuing message unit reset (MUR) to bring to reset state\n");
@@ -1460,6 +1461,9 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
14601461
ioc_config |= MPI3_SYSIF_IOC_CONFIG_ENABLE_IOC;
14611462
writel(ioc_config, &mrioc->sysif_regs->ioc_configuration);
14621463

1464+
if (retry == 0)
1465+
start_time = jiffies;
1466+
14631467
timeout = mrioc->ready_timeout * 10;
14641468
do {
14651469
ioc_state = mpi3mr_get_iocstate(mrioc);
@@ -1469,6 +1473,12 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
14691473
mpi3mr_iocstate_name(ioc_state));
14701474
return 0;
14711475
}
1476+
ioc_status = readl(&mrioc->sysif_regs->ioc_status);
1477+
if ((ioc_status & MPI3_SYSIF_IOC_STATUS_RESET_HISTORY) ||
1478+
(ioc_status & MPI3_SYSIF_IOC_STATUS_FAULT)) {
1479+
mpi3mr_print_fault_info(mrioc);
1480+
goto out_failed;
1481+
}
14721482
if (!pci_device_is_present(mrioc->pdev)) {
14731483
mrioc->unrecoverable = 1;
14741484
ioc_err(mrioc,
@@ -1477,9 +1487,19 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
14771487
goto out_device_not_present;
14781488
}
14791489
msleep(100);
1480-
} while (--timeout);
1490+
elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000;
1491+
} while (elapsed_time_sec < mrioc->ready_timeout);
14811492

14821493
out_failed:
1494+
elapsed_time_sec = jiffies_to_msecs(jiffies - start_time)/1000;
1495+
if ((retry < 2) && (elapsed_time_sec < (mrioc->ready_timeout - 60))) {
1496+
retry++;
1497+
1498+
ioc_warn(mrioc, "retrying to bring IOC ready, retry_count:%d\n"
1499+
" elapsed time =%llu\n", retry, elapsed_time_sec);
1500+
1501+
goto retry_bring_ioc_ready;
1502+
}
14831503
ioc_state = mpi3mr_get_iocstate(mrioc);
14841504
ioc_err(mrioc,
14851505
"failed to bring to ready state, current state: %s\n",
@@ -2671,7 +2691,7 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
26712691
return;
26722692
}
26732693

2674-
if (mrioc->ts_update_counter++ >= MPI3MR_TSUPDATE_INTERVAL) {
2694+
if (mrioc->ts_update_counter++ >= mrioc->ts_update_interval) {
26752695
mrioc->ts_update_counter = 0;
26762696
mpi3mr_sync_timestamp(mrioc);
26772697
}
@@ -3844,6 +3864,29 @@ static int mpi3mr_repost_diag_bufs(struct mpi3mr_ioc *mrioc)
38443864
return retval;
38453865
}
38463866

3867+
/**
3868+
* mpi3mr_read_tsu_interval - Update time stamp interval
3869+
* @mrioc: Adapter instance reference
3870+
*
3871+
* Update time stamp interval if its defined in driver page 1,
3872+
* otherwise use default value.
3873+
*
3874+
* Return: Nothing
3875+
*/
3876+
static void
3877+
mpi3mr_read_tsu_interval(struct mpi3mr_ioc *mrioc)
3878+
{
3879+
struct mpi3_driver_page1 driver_pg1;
3880+
u16 pg_sz = sizeof(driver_pg1);
3881+
int retval = 0;
3882+
3883+
mrioc->ts_update_interval = MPI3MR_TSUPDATE_INTERVAL;
3884+
3885+
retval = mpi3mr_cfg_get_driver_pg1(mrioc, &driver_pg1, pg_sz);
3886+
if (!retval && driver_pg1.time_stamp_update)
3887+
mrioc->ts_update_interval = (driver_pg1.time_stamp_update * 60);
3888+
}
3889+
38473890
/**
38483891
* mpi3mr_print_ioc_info - Display controller information
38493892
* @mrioc: Adapter instance reference
@@ -4140,6 +4183,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
41404183
goto out_failed_noretry;
41414184
}
41424185

4186+
mpi3mr_read_tsu_interval(mrioc);
41434187
mpi3mr_print_ioc_info(mrioc);
41444188

41454189
if (!mrioc->cfg_page) {
@@ -4321,6 +4365,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
43214365
goto out_failed_noretry;
43224366
}
43234367

4368+
mpi3mr_read_tsu_interval(mrioc);
43244369
mpi3mr_print_ioc_info(mrioc);
43254370

43264371
if (is_resume) {

0 commit comments

Comments
 (0)