Commit 26c54d0e authored by Balsundar P's avatar Balsundar P Committed by Martin K. Petersen

scsi: aacraid: send AIF request post IOP RESET

After IOP reset completion, AIF request command is not issued to the
controller. Driver schedules a worker thread to issue a AIF request command
after IOP reset completion.

[mkp: fix zeroday warning]

Link: https://lore.kernel.org/r/1571120524-6037-7-git-send-email-balsundar.p@microsemi.com
Acked-by: Balsundar P < Balsundar.P@microchip.com>
Signed-off-by: default avatarBalsundar P <balsundar.p@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 572ee53a
...@@ -1330,7 +1330,7 @@ struct fib { ...@@ -1330,7 +1330,7 @@ struct fib {
#define AAC_DEVTYPE_ARC_RAW 2 #define AAC_DEVTYPE_ARC_RAW 2
#define AAC_DEVTYPE_NATIVE_RAW 3 #define AAC_DEVTYPE_NATIVE_RAW 3
#define AAC_SAFW_RESCAN_DELAY (10 * HZ) #define AAC_RESCAN_DELAY (10 * HZ)
struct aac_hba_map_info { struct aac_hba_map_info {
__le32 rmw_nexus; /* nexus for native HBA devices */ __le32 rmw_nexus; /* nexus for native HBA devices */
...@@ -1603,6 +1603,7 @@ struct aac_dev ...@@ -1603,6 +1603,7 @@ struct aac_dev
struct fsa_dev_info *fsa_dev; struct fsa_dev_info *fsa_dev;
struct task_struct *thread; struct task_struct *thread;
struct delayed_work safw_rescan_work; struct delayed_work safw_rescan_work;
struct delayed_work src_reinit_aif_worker;
int cardtype; int cardtype;
/* /*
*This lock will protect the two 32-bit *This lock will protect the two 32-bit
...@@ -2647,7 +2648,12 @@ int aac_scan_host(struct aac_dev *dev); ...@@ -2647,7 +2648,12 @@ int aac_scan_host(struct aac_dev *dev);
static inline void aac_schedule_safw_scan_worker(struct aac_dev *dev) static inline void aac_schedule_safw_scan_worker(struct aac_dev *dev)
{ {
schedule_delayed_work(&dev->safw_rescan_work, AAC_SAFW_RESCAN_DELAY); schedule_delayed_work(&dev->safw_rescan_work, AAC_RESCAN_DELAY);
}
static inline void aac_schedule_src_reinit_aif_worker(struct aac_dev *dev)
{
schedule_delayed_work(&dev->src_reinit_aif_worker, AAC_RESCAN_DELAY);
} }
static inline void aac_safw_rescan_worker(struct work_struct *work) static inline void aac_safw_rescan_worker(struct work_struct *work)
...@@ -2661,10 +2667,10 @@ static inline void aac_safw_rescan_worker(struct work_struct *work) ...@@ -2661,10 +2667,10 @@ static inline void aac_safw_rescan_worker(struct work_struct *work)
aac_scan_host(dev); aac_scan_host(dev);
} }
static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev) static inline void aac_cancel_rescan_worker(struct aac_dev *dev)
{ {
if (dev->sa_firmware)
cancel_delayed_work_sync(&dev->safw_rescan_work); cancel_delayed_work_sync(&dev->safw_rescan_work);
cancel_delayed_work_sync(&dev->src_reinit_aif_worker);
} }
/* SCp.phase values */ /* SCp.phase values */
...@@ -2674,6 +2680,7 @@ static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev) ...@@ -2674,6 +2680,7 @@ static inline void aac_cancel_safw_rescan_worker(struct aac_dev *dev)
#define AAC_OWNER_FIRMWARE 0x106 #define AAC_OWNER_FIRMWARE 0x106
void aac_safw_rescan_worker(struct work_struct *work); void aac_safw_rescan_worker(struct work_struct *work);
void aac_src_reinit_aif_worker(struct work_struct *work);
int aac_acquire_irq(struct aac_dev *dev); int aac_acquire_irq(struct aac_dev *dev);
void aac_free_irq(struct aac_dev *dev); void aac_free_irq(struct aac_dev *dev);
int aac_setup_safw_adapter(struct aac_dev *dev); int aac_setup_safw_adapter(struct aac_dev *dev);
...@@ -2731,6 +2738,7 @@ int aac_probe_container(struct aac_dev *dev, int cid); ...@@ -2731,6 +2738,7 @@ int aac_probe_container(struct aac_dev *dev, int cid);
int _aac_rx_init(struct aac_dev *dev); int _aac_rx_init(struct aac_dev *dev);
int aac_rx_select_comm(struct aac_dev *dev, int comm); int aac_rx_select_comm(struct aac_dev *dev, int comm);
int aac_rx_deliver_producer(struct fib * fib); int aac_rx_deliver_producer(struct fib * fib);
void aac_reinit_aif(struct aac_dev *aac, unsigned int index);
static inline int aac_is_src(struct aac_dev *dev) static inline int aac_is_src(struct aac_dev *dev)
{ {
......
...@@ -1464,6 +1464,14 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -1464,6 +1464,14 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
} }
} }
static void aac_schedule_bus_scan(struct aac_dev *aac)
{
if (aac->sa_firmware)
aac_schedule_safw_scan_worker(aac);
else
aac_schedule_src_reinit_aif_worker(aac);
}
static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
{ {
int index, quirks; int index, quirks;
...@@ -1639,7 +1647,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) ...@@ -1639,7 +1647,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
*/ */
if (!retval && !is_kdump_kernel()) { if (!retval && !is_kdump_kernel()) {
dev_info(&aac->pdev->dev, "Scheduling bus rescan\n"); dev_info(&aac->pdev->dev, "Scheduling bus rescan\n");
aac_schedule_safw_scan_worker(aac); aac_schedule_bus_scan(aac);
} }
if (jafo) { if (jafo) {
...@@ -1960,6 +1968,16 @@ int aac_scan_host(struct aac_dev *dev) ...@@ -1960,6 +1968,16 @@ int aac_scan_host(struct aac_dev *dev)
return rcode; return rcode;
} }
void aac_src_reinit_aif_worker(struct work_struct *work)
{
struct aac_dev *dev = container_of(to_delayed_work(work),
struct aac_dev, src_reinit_aif_worker);
wait_event(dev->scsi_host_ptr->host_wait,
!scsi_host_in_recovery(dev->scsi_host_ptr));
aac_reinit_aif(dev, dev->cardtype);
}
/** /**
* aac_handle_sa_aif Handle a message from the firmware * aac_handle_sa_aif Handle a message from the firmware
* @dev: Which adapter this fib is from * @dev: Which adapter this fib is from
......
...@@ -1593,6 +1593,19 @@ static void aac_init_char(void) ...@@ -1593,6 +1593,19 @@ static void aac_init_char(void)
} }
} }
void aac_reinit_aif(struct aac_dev *aac, unsigned int index)
{
/*
* Firmware may send a AIF messages very early and the Driver may have
* ignored as it is not fully ready to process the messages. Send
* AIF to firmware so that if there are any unprocessed events they
* can be processed now.
*/
if (aac_drivers[index].quirks & AAC_QUIRK_SRC)
aac_intr_normal(aac, 0, 2, 0, NULL);
}
static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
unsigned index = id->driver_data; unsigned index = id->driver_data;
...@@ -1690,6 +1703,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1690,6 +1703,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
mutex_init(&aac->scan_mutex); mutex_init(&aac->scan_mutex);
INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker); INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker);
INIT_DELAYED_WORK(&aac->src_reinit_aif_worker,
aac_src_reinit_aif_worker);
/* /*
* Map in the registers from the adapter. * Map in the registers from the adapter.
*/ */
...@@ -1880,7 +1895,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1880,7 +1895,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
struct aac_dev *aac = (struct aac_dev *)shost->hostdata; struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
scsi_block_requests(shost); scsi_block_requests(shost);
aac_cancel_safw_rescan_worker(aac); aac_cancel_rescan_worker(aac);
aac_send_shutdown(aac); aac_send_shutdown(aac);
aac_release_resources(aac); aac_release_resources(aac);
...@@ -1939,7 +1954,7 @@ static void aac_remove_one(struct pci_dev *pdev) ...@@ -1939,7 +1954,7 @@ static void aac_remove_one(struct pci_dev *pdev)
struct Scsi_Host *shost = pci_get_drvdata(pdev); struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct aac_dev *aac = (struct aac_dev *)shost->hostdata; struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
aac_cancel_safw_rescan_worker(aac); aac_cancel_rescan_worker(aac);
scsi_remove_host(shost); scsi_remove_host(shost);
__aac_shutdown(aac); __aac_shutdown(aac);
...@@ -1997,7 +2012,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev, ...@@ -1997,7 +2012,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
aac->handle_pci_error = 1; aac->handle_pci_error = 1;
scsi_block_requests(aac->scsi_host_ptr); scsi_block_requests(aac->scsi_host_ptr);
aac_cancel_safw_rescan_worker(aac); aac_cancel_rescan_worker(aac);
aac_flush_ios(aac); aac_flush_ios(aac);
aac_release_resources(aac); aac_release_resources(aac);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment