@@ -8319,13 +8319,38 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd)
8319
8319
static int ipr_reset_slot_reset_done (struct ipr_cmnd * ipr_cmd )
8320
8320
{
8321
8321
ENTER ;
8322
- pci_set_pcie_reset_state (ipr_cmd -> ioa_cfg -> pdev , pcie_deassert_reset );
8323
8322
ipr_cmd -> job_step = ipr_reset_bist_done ;
8324
8323
ipr_reset_start_timer (ipr_cmd , IPR_WAIT_FOR_BIST_TIMEOUT );
8325
8324
LEAVE ;
8326
8325
return IPR_RC_JOB_RETURN ;
8327
8326
}
8328
8327
8328
+ /**
8329
+ * ipr_reset_reset_work - Pulse a PCIe fundamental reset
8330
+ * @work: work struct
8331
+ *
8332
+ * Description: This pulses warm reset to a slot.
8333
+ *
8334
+ **/
8335
+ static void ipr_reset_reset_work (struct work_struct * work )
8336
+ {
8337
+ struct ipr_cmnd * ipr_cmd = container_of (work , struct ipr_cmnd , work );
8338
+ struct ipr_ioa_cfg * ioa_cfg = ipr_cmd -> ioa_cfg ;
8339
+ struct pci_dev * pdev = ioa_cfg -> pdev ;
8340
+ unsigned long lock_flags = 0 ;
8341
+
8342
+ ENTER ;
8343
+ pci_set_pcie_reset_state (pdev , pcie_warm_reset );
8344
+ msleep (jiffies_to_msecs (IPR_PCI_RESET_TIMEOUT ));
8345
+ pci_set_pcie_reset_state (pdev , pcie_deassert_reset );
8346
+
8347
+ spin_lock_irqsave (ioa_cfg -> host -> host_lock , lock_flags );
8348
+ if (ioa_cfg -> reset_cmd == ipr_cmd )
8349
+ ipr_reset_ioa_job (ipr_cmd );
8350
+ spin_unlock_irqrestore (ioa_cfg -> host -> host_lock , lock_flags );
8351
+ LEAVE ;
8352
+ }
8353
+
8329
8354
/**
8330
8355
* ipr_reset_slot_reset - Reset the PCI slot of the adapter.
8331
8356
* @ipr_cmd: ipr command struct
@@ -8338,12 +8363,11 @@ static int ipr_reset_slot_reset_done(struct ipr_cmnd *ipr_cmd)
8338
8363
static int ipr_reset_slot_reset (struct ipr_cmnd * ipr_cmd )
8339
8364
{
8340
8365
struct ipr_ioa_cfg * ioa_cfg = ipr_cmd -> ioa_cfg ;
8341
- struct pci_dev * pdev = ioa_cfg -> pdev ;
8342
8366
8343
8367
ENTER ;
8344
- pci_set_pcie_reset_state (pdev , pcie_warm_reset );
8368
+ INIT_WORK (& ipr_cmd -> work , ipr_reset_reset_work );
8369
+ queue_work (ioa_cfg -> reset_work_q , & ipr_cmd -> work );
8345
8370
ipr_cmd -> job_step = ipr_reset_slot_reset_done ;
8346
- ipr_reset_start_timer (ipr_cmd , IPR_PCI_RESET_TIMEOUT );
8347
8371
LEAVE ;
8348
8372
return IPR_RC_JOB_RETURN ;
8349
8373
}
@@ -9092,26 +9116,25 @@ static void ipr_free_mem(struct ipr_ioa_cfg *ioa_cfg)
9092
9116
}
9093
9117
9094
9118
/**
9095
- * ipr_free_all_resources - Free all allocated resources for an adapter.
9096
- * @ipr_cmd : ipr command struct
9119
+ * ipr_free_irqs - Free all allocated IRQs for the adapter.
9120
+ * @ioa_cfg : ipr cfg struct
9097
9121
*
9098
- * This function frees all allocated resources for the
9122
+ * This function frees all allocated IRQs for the
9099
9123
* specified adapter.
9100
9124
*
9101
9125
* Return value:
9102
9126
* none
9103
9127
**/
9104
- static void ipr_free_all_resources (struct ipr_ioa_cfg * ioa_cfg )
9128
+ static void ipr_free_irqs (struct ipr_ioa_cfg * ioa_cfg )
9105
9129
{
9106
9130
struct pci_dev * pdev = ioa_cfg -> pdev ;
9107
9131
9108
- ENTER ;
9109
9132
if (ioa_cfg -> intr_flag == IPR_USE_MSI ||
9110
9133
ioa_cfg -> intr_flag == IPR_USE_MSIX ) {
9111
9134
int i ;
9112
9135
for (i = 0 ; i < ioa_cfg -> nvectors ; i ++ )
9113
9136
free_irq (ioa_cfg -> vectors_info [i ].vec ,
9114
- & ioa_cfg -> hrrq [i ]);
9137
+ & ioa_cfg -> hrrq [i ]);
9115
9138
} else
9116
9139
free_irq (pdev -> irq , & ioa_cfg -> hrrq [0 ]);
9117
9140
@@ -9122,7 +9145,26 @@ static void ipr_free_all_resources(struct ipr_ioa_cfg *ioa_cfg)
9122
9145
pci_disable_msix (pdev );
9123
9146
ioa_cfg -> intr_flag &= ~IPR_USE_MSIX ;
9124
9147
}
9148
+ }
9149
+
9150
+ /**
9151
+ * ipr_free_all_resources - Free all allocated resources for an adapter.
9152
+ * @ipr_cmd: ipr command struct
9153
+ *
9154
+ * This function frees all allocated resources for the
9155
+ * specified adapter.
9156
+ *
9157
+ * Return value:
9158
+ * none
9159
+ **/
9160
+ static void ipr_free_all_resources (struct ipr_ioa_cfg * ioa_cfg )
9161
+ {
9162
+ struct pci_dev * pdev = ioa_cfg -> pdev ;
9125
9163
9164
+ ENTER ;
9165
+ ipr_free_irqs (ioa_cfg );
9166
+ if (ioa_cfg -> reset_work_q )
9167
+ destroy_workqueue (ioa_cfg -> reset_work_q );
9126
9168
iounmap (ioa_cfg -> hdw_dma_regs );
9127
9169
pci_release_regions (pdev );
9128
9170
ipr_free_mem (ioa_cfg );
@@ -9942,6 +9984,14 @@ static int ipr_probe_ioa(struct pci_dev *pdev,
9942
9984
(dev_id -> device == PCI_DEVICE_ID_IBM_OBSIDIAN_E && !ioa_cfg -> revid )) {
9943
9985
ioa_cfg -> needs_warm_reset = 1 ;
9944
9986
ioa_cfg -> reset = ipr_reset_slot_reset ;
9987
+
9988
+ ioa_cfg -> reset_work_q = alloc_ordered_workqueue ("ipr_reset_%d" ,
9989
+ WQ_MEM_RECLAIM , host -> host_no );
9990
+
9991
+ if (!ioa_cfg -> reset_work_q ) {
9992
+ dev_err (& pdev -> dev , "Couldn't register reset workqueue\n" );
9993
+ goto out_free_irq ;
9994
+ }
9945
9995
} else
9946
9996
ioa_cfg -> reset = ipr_reset_start_bist ;
9947
9997
@@ -9953,6 +10003,8 @@ static int ipr_probe_ioa(struct pci_dev *pdev,
9953
10003
out :
9954
10004
return rc ;
9955
10005
10006
+ out_free_irq :
10007
+ ipr_free_irqs (ioa_cfg );
9956
10008
cleanup_nolog :
9957
10009
ipr_free_mem (ioa_cfg );
9958
10010
out_msi_disable :
@@ -10033,6 +10085,8 @@ static void __ipr_remove(struct pci_dev *pdev)
10033
10085
spin_unlock_irqrestore (ioa_cfg -> host -> host_lock , host_lock_flags );
10034
10086
wait_event (ioa_cfg -> reset_wait_q , !ioa_cfg -> in_reset_reload );
10035
10087
flush_work (& ioa_cfg -> work_q );
10088
+ if (ioa_cfg -> reset_work_q )
10089
+ flush_workqueue (ioa_cfg -> reset_work_q );
10036
10090
INIT_LIST_HEAD (& ioa_cfg -> used_res_q );
10037
10091
spin_lock_irqsave (ioa_cfg -> host -> host_lock , host_lock_flags );
10038
10092
@@ -10178,22 +10232,7 @@ static void ipr_shutdown(struct pci_dev *pdev)
10178
10232
spin_unlock_irqrestore (ioa_cfg -> host -> host_lock , lock_flags );
10179
10233
wait_event (ioa_cfg -> reset_wait_q , !ioa_cfg -> in_reset_reload );
10180
10234
if (ipr_fast_reboot && system_state == SYSTEM_RESTART && ioa_cfg -> sis64 ) {
10181
- if (ioa_cfg -> intr_flag == IPR_USE_MSI ||
10182
- ioa_cfg -> intr_flag == IPR_USE_MSIX ) {
10183
- int i ;
10184
- for (i = 0 ; i < ioa_cfg -> nvectors ; i ++ )
10185
- free_irq (ioa_cfg -> vectors_info [i ].vec ,
10186
- & ioa_cfg -> hrrq [i ]);
10187
- }
10188
-
10189
- if (ioa_cfg -> intr_flag == IPR_USE_MSI ) {
10190
- pci_disable_msi (ioa_cfg -> pdev );
10191
- ioa_cfg -> intr_flag &= ~IPR_USE_MSI ;
10192
- } else if (ioa_cfg -> intr_flag == IPR_USE_MSIX ) {
10193
- pci_disable_msix (ioa_cfg -> pdev );
10194
- ioa_cfg -> intr_flag &= ~IPR_USE_MSIX ;
10195
- }
10196
-
10235
+ ipr_free_irqs (ioa_cfg );
10197
10236
pci_disable_device (ioa_cfg -> pdev );
10198
10237
}
10199
10238
}
0 commit comments