]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
scsi: hisi_sas: Implement handlers of PCIe FLR for v3 hw
authorXiaofei Tan <tanxiaofei@huawei.com>
Wed, 18 Jul 2018 14:14:30 +0000 (22:14 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 1 Oct 2018 16:23:18 +0000 (18:23 +0200)
BugLink: https://bugs.launchpad.net/bugs/1794166
This patch implements handlers of PCIe FLR for v3 hw, reset_prepare() and
reset_done().

User can issue FLR through sysfs interface, as v3 hw support PCIe FLR.
Then if we don't implement these two handlers, our SAS controller will not
work after executing FLR.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e5ea48014adcb030b9d92743e87fbbcbbb2a1d70)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index cc25a8045d9415771a60cd231fcae95198487cca..0031a199cf078944b7510dcc33caf6ed963a9fac 100644 (file)
@@ -2484,6 +2484,41 @@ static pci_ers_result_t hisi_sas_slot_reset_v3_hw(struct pci_dev *pdev)
        return PCI_ERS_RESULT_DISCONNECT;
 }
 
+static void hisi_sas_reset_prepare_v3_hw(struct pci_dev *pdev)
+{
+       struct sas_ha_struct *sha = pci_get_drvdata(pdev);
+       struct hisi_hba *hisi_hba = sha->lldd_ha;
+       struct device *dev = hisi_hba->dev;
+       int rc;
+
+       dev_info(dev, "FLR prepare\n");
+       set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags);
+       hisi_sas_controller_reset_prepare(hisi_hba);
+
+       rc = disable_host_v3_hw(hisi_hba);
+       if (rc)
+               dev_err(dev, "FLR: disable host failed rc=%d\n", rc);
+}
+
+static void hisi_sas_reset_done_v3_hw(struct pci_dev *pdev)
+{
+       struct sas_ha_struct *sha = pci_get_drvdata(pdev);
+       struct hisi_hba *hisi_hba = sha->lldd_ha;
+       struct device *dev = hisi_hba->dev;
+       int rc;
+
+       hisi_sas_init_mem(hisi_hba);
+
+       rc = hw_init_v3_hw(hisi_hba);
+       if (rc) {
+               dev_err(dev, "FLR: hw init failed rc=%d\n", rc);
+               return;
+       }
+
+       hisi_sas_controller_reset_done(hisi_hba);
+       dev_info(dev, "FLR done\n");
+}
+
 enum {
        /* instances of the controller */
        hip08,
@@ -2575,6 +2610,8 @@ static const struct pci_error_handlers hisi_sas_err_handler = {
        .error_detected = hisi_sas_error_detected_v3_hw,
        .mmio_enabled   = hisi_sas_mmio_enabled_v3_hw,
        .slot_reset     = hisi_sas_slot_reset_v3_hw,
+       .reset_prepare  = hisi_sas_reset_prepare_v3_hw,
+       .reset_done     = hisi_sas_reset_done_v3_hw,
 };
 
 static struct pci_driver sas_v3_pci_driver = {