path: root/drivers/scsi/megaraid/megaraid_sas_base.c
diff options
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>2019-05-07 10:05:34 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2019-06-18 19:46:19 -0400
commit78409d4b47b83d81d29450ef890e07d9ce629fdd (patch)
treec6073bd5b8c39aa7212e968e5f68aa932121ebb2 /drivers/scsi/megaraid/megaraid_sas_base.c
parentscsi: megaraid_sas: Rework code around controller reset (diff)
scsi: megaraid_sas: Block PCI config space access from userspace during OCR
While an online controller reset(OCR) is in progress, there is short duration where all access to controller's PCI config space from the host needs to be blocked. This is due to a hardware limitation of MegaRAID controllers. With this patch, driver will block all access to controller's config space from userland applications by calling pci_cfg_access_lock() while OCR is in progress and unlocking after controller comes back to ready state. Added helper function which locks the config space before initiating OCR and wait for controller to become READY. Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to '')
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 63b31082d985..34abd5194b0b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5534,13 +5534,15 @@ static int megasas_init_fw(struct megasas_instance *instance)
if (megasas_transition_to_ready(instance, 0)) {
+ dev_info(&instance->pdev->dev,
+ "Failed to transition controller to ready from %s!\n",
+ __func__);
if (instance->adapter_type != MFI_SERIES) {
status_reg = instance->instancet->read_fw_status_reg(
if (status_reg & MFI_RESET_ADAPTER) {
- instance->instancet->adp_reset
- (instance, instance->reg_set);
- if (megasas_transition_to_ready(instance, 0))
+ if (megasas_adp_reset_wait_for_ready
+ (instance, true, 0) == FAILED)
goto fail_ready_state;
} else {
goto fail_ready_state;
@@ -5550,9 +5552,6 @@ static int megasas_init_fw(struct megasas_instance *instance)
(instance, instance->reg_set);
atomic_set(&instance->fw_reset_no_pci_access, 0);
- dev_info(&instance->pdev->dev,
- "FW restarted successfully from %s!\n",
- __func__);
/*waiting for about 30 second before retry*/
@@ -5560,6 +5559,10 @@ static int megasas_init_fw(struct megasas_instance *instance)
if (megasas_transition_to_ready(instance, 0))
goto fail_ready_state;
+ dev_info(&instance->pdev->dev,
+ "FW restarted successfully from %s!\n",
+ __func__);