mpt3sas: Reload SBR without rebooting HBA
Subsystems (2)
Ranjan Kumar
maintainerPATCH 1/2 mpt3sas: Reload SBR without rebooting HBA
Added a new IOCTL command MPT3ENABLEDIAGSBRRELOAD.
As a part of firmware update operation, applications use this IOCTL command to set the SBR reload bit in the Host Diagnostic register. So that HBA firmware is updated without power-cycling the system.
Signed-off-by Ranjan Kumar <[email protected]>
Signed-off-by Sreekanth Reddy <[email protected]>
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 75 ++++++++++++++++++++-------- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++ drivers/scsi/mpt3sas/mpt3sas_ctl.c | 54 ++++++++++++++++++++ drivers/scsi/mpt3sas/mpt3sas_ctl.h | 10 ++++ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1 + 5 files changed, 123 insertions(+), 21 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +54 -21
@@ -7920,26 +7920,20 @@ mpt3sas_base_validate_event_type(struct MPT3SAS_ADAPTER *ioc, u32 *event_type) }/** -* _base_diag_reset - the "big hammer" start of day reset +* mpt3sas_base_unlock_and_get_host_diagnostic- enable Host Diagnostic Register writes * @ioc: per adapter object +* @host_diagnostic: host diagnostic register content * * Return: 0 for success, non-zero for failure. */ -static int -_base_diag_reset (struct MPT3SAS_ADAPTER *ioc) +int +mpt3sas_base_unlock_and_get_host_diagnostic (struct MPT3SAS_ADAPTER *ioc, +u32 *host_diagnostic) { -u32 host_diagnostic; -u32 ioc_state;u32 count; -u32 hcb_size; - -ioc_info (ioc,"sending diag reset !!\n" ); - -pci_cfg_access_lock (ioc->pdev); - -drsprintk (ioc,ioc_info (ioc,"clear interrupts\n" )); - + *host_diagnostic =0 ; count =0 ; + do { /* Write magic sequence to WriteSequence register * Loop until in diagnostic mode
@@ -7960,15 +7954,55 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)ioc_info (ioc,"Stop writing magic sequence after 20 retries\n" );_base_dump_reg_set (ioc); - goto out; +return -EFAULT ; } - host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic); + *host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic);drsprintk (ioc,ioc_info (ioc,"wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n" , - count, host_diagnostic)); + count, *host_diagnostic)); + + }while ((*host_diagnostic &MPI2_DIAG_DIAG_WRITE_ENABLE ) ==0 ); +return 0 ; +} + +/** +* mpt3sas_base_lock_host_diagnostic - Disable Host Diagnostic Register writes +* @ioc: per adapter object +* +*/ +void +mpt3sas_base_lock_host_diagnostic (struct MPT3SAS_ADAPTER *ioc) +{ +drsprintk (ioc,ioc_info (ioc,"disable writes to the diagnostic register\n" )); +writel (MPI2_WRSEQ_FLUSH_KEY_VALUE , &ioc->chip->WriteSequence); +} - }while ((host_diagnostic &MPI2_DIAG_DIAG_WRITE_ENABLE ) ==0 ); +/** +* _base_diag_reset - the "big hammer" start of day reset +* @ioc: per adapter object +* +* Return: 0 for success, non-zero for failure. +*/ +static int +_base_diag_reset (struct MPT3SAS_ADAPTER *ioc) +{ +u32 host_diagnostic; +u32 ioc_state; +u32 count; +u32 hcb_size; + +ioc_info (ioc,"sending diag reset !!\n" ); + +pci_cfg_access_lock (ioc->pdev); + +drsprintk (ioc,ioc_info (ioc,"clear interrupts\n" )); + +mutex_lock (&ioc->hostdiag_unlock_mutex); +if (mpt3sas_base_unlock_and_get_host_diagnostic (ioc, &host_diagnostic)) { +mutex_unlock (&ioc->hostdiag_unlock_mutex); + goto out; + } hcb_size = ioc->base_readl (&ioc->chip->HCBSize);
@@ -8013,10 +8047,8 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)drsprintk (ioc,ioc_info (ioc,"restart the adapter\n" ));writel (host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET , &ioc->chip->HostDiagnostic); - -drsprintk (ioc, -ioc_info (ioc,"disable writes to the diagnostic register\n" )); -writel (MPI2_WRSEQ_FLUSH_KEY_VALUE , &ioc->chip->WriteSequence); +mpt3sas_base_lock_host_diagnostic (ioc); +mutex_unlock (&ioc->hostdiag_unlock_mutex);drsprintk (ioc,ioc_info (ioc,"Wait for FW to go to the READY state\n" )); ioc_state =_base_wait_on_iocstate (ioc,MPI2_IOC_STATE_READY ,20 );
@@ -8034,6 +8066,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) out:pci_cfg_access_unlock (ioc->pdev);ioc_err (ioc,"diag reset: FAILED\n" ); +mutex_unlock (&ioc->hostdiag_unlock_mutex);return -EFAULT ; }
drivers/scsi/mpt3sas/mpt3sas_base.h +4 -0
@@ -1367,6 +1367,7 @@ struct MPT3SAS_ADAPTER {u8 got_task_abort_from_ioctl;struct mutex reset_in_progress_mutex; +struct mutex hostdiag_unlock_mutex;spinlock_t ioc_reset_in_progress_lock;u8 ioc_link_reset_in_progress;
@@ -1791,6 +1792,9 @@ void mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc);int mpt3sas_blk_mq_poll (struct Scsi_Host *shost,unsigned int queue_num);void mpt3sas_base_pause_mq_polling (struct MPT3SAS_ADAPTER *ioc);void mpt3sas_base_resume_mq_polling (struct MPT3SAS_ADAPTER *ioc); +int mpt3sas_base_unlock_and_get_host_diagnostic (struct MPT3SAS_ADAPTER *ioc, +u32 *host_diagnostic); +void mpt3sas_base_lock_host_diagnostic (struct MPT3SAS_ADAPTER *ioc);/* scsih shared API */ struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,
drivers/scsi/mpt3sas/mpt3sas_ctl.c +54 -0
66 lines not on this page · raw message
drivers/scsi/mpt3sas/mpt3sas_ctl.h +10 -0
@@ -98,6 +98,8 @@ struct mpt3_diag_read_buffer)#define MPT3ADDNLDIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 32, \ struct mpt3_addnl_diag_query) +#define MPT3ENABLEDIAGSBRRELOAD _IOWR(MPT3_MAGIC_NUMBER, 33, \ + struct mpt3_enable_diag_sbr_reload)/* Trace Buffer default UniqueId */ #define MPT2DIAGBUFFUNIQUEID (0x07075900)
@@ -448,4 +450,12 @@ struct mpt3_addnl_diag_query { uint32_t reserved2[2]; }; +/** +* struct mpt3_enable_diag_sbr_reload - enable sbr reload +* @hdr - generic header +*/ +struct mpt3_enable_diag_sbr_reload { +struct mpt3_ioctl_header hdr; +}; +#endif /* MPT3SAS_CTL_H_INCLUDED */
drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 -0
@@ -12259,6 +12259,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)/* misc semaphores and spin locks */ mutex_init (&ioc->reset_in_progress_mutex); +mutex_init (&ioc->hostdiag_unlock_mutex);/* initializing pci_access_mutex lock */ mutex_init (&ioc->pci_access_mutex);spin_lock_init (&ioc->ioc_reset_in_progress_lock);
Signature · 1 line
2.31.1
Ranjan Kumar
maintainerPATCH 2/2 mpt3sas: Update driver version to 45.100.00.00
Update driver version to 45.100.00.00
Signed-off-by Ranjan Kumar <[email protected]>
Signed-off-by Sreekanth Reddy <[email protected]>
--- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.h +2 -2
@@ -77,8 +77,8 @@#define MPT3SAS_DRIVER_NAME "mpt3sas"#define MPT3SAS_AUTHOR "Avago Technologies <[email protected]>"#define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver" -#define MPT3SAS_DRIVER_VERSION "43.100.00.00" -#define MPT3SAS_MAJOR_VERSION 43 +#define MPT3SAS_DRIVER_VERSION "45.100.00.00" +#define MPT3SAS_MAJOR_VERSION 45#define MPT3SAS_MINOR_VERSION 100#define MPT3SAS_BUILD_VERSION 0#define MPT3SAS_RELEASE_VERSION 00
Signature · 1 line
2.31.1
Martin K. Petersen
AppliedRanjan,
Quoted 4 lines
Added a new IOCTL command MPT3ENABLEDIAGSBRRELOAD. As a part of firmware update operation, applications use this IOCTL command to set the SBR reload bit in the Host Diagnostic register. So that HBA firmware is updated without power-cycling the system.
Applied to 6.4/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering