]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
scsi: hisi_sas: fix the issue of link rate inconsistency
authorXiaofei Tan <tanxiaofei@huawei.com>
Wed, 7 Mar 2018 12:25:07 +0000 (20:25 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 May 2018 09:11:59 +0000 (11:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1768974
In sysfs, there are two files about minimum linkrate, and also two files for
maximum linkrate. Take maximum linkrate example, maximum_linkrate_hw is
read-only and indicated by the register HARD_PHY_LINKRATE, and
maximum_linkrate is read-write and corresponding to the register
PROG_PHY_LINK_RATE.

But in the function phy_up_v*_hw(), we get *_linkrate value from
HARD_PHY_LINKRATE. It is not right. This patch is to fix this issue.

Unreferenced PHY-interrupt enum is also removed for v3 hw.

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 eba8c20c7178af9673ad842b0f68251c891c8546)
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_main.c
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 44c58ca2abd39bb3637fcb67100afdc9393e95ea..dadd65bc98322253b9125c5cdfd4c2262bde78a6 100644 (file)
@@ -683,6 +683,8 @@ static void hisi_sas_phy_init(struct hisi_hba *hisi_hba, int phy_no)
 
        phy->hisi_hba = hisi_hba;
        phy->port = NULL;
+       phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS;
+       phy->maximum_linkrate = hisi_hba->hw->phy_get_max_linkrate();
        sas_phy->enabled = (phy_no < hisi_hba->n_phy) ? 1 : 0;
        sas_phy->class = SAS;
        sas_phy->iproto = SAS_PROTOCOL_ALL;
index 679e76f58a0aaaad478fd015f7312d31f0f6f8bd..38bbda938bc1ca3e3d61ea1a37c24945a07a52b2 100644 (file)
@@ -873,7 +873,6 @@ static void phy_set_linkrate_v1_hw(struct hisi_hba *hisi_hba, int phy_no,
        sas_phy->phy->maximum_linkrate = max;
        sas_phy->phy->minimum_linkrate = min;
 
-       min -= SAS_LINK_RATE_1_5_GBPS;
        max -= SAS_LINK_RATE_1_5_GBPS;
 
        for (i = 0; i <= max; i++)
index 42b3fd6a9936046959040e7d24be992572498155..67be346db239150495770fd87c52fcd3af173939 100644 (file)
@@ -1603,7 +1603,6 @@ static void phy_set_linkrate_v2_hw(struct hisi_hba *hisi_hba, int phy_no,
        sas_phy->phy->maximum_linkrate = max;
        sas_phy->phy->minimum_linkrate = min;
 
-       min -= SAS_LINK_RATE_1_5_GBPS;
        max -= SAS_LINK_RATE_1_5_GBPS;
 
        for (i = 0; i <= max; i++)
@@ -2684,7 +2683,7 @@ static int prep_abort_v2_hw(struct hisi_hba *hisi_hba,
 static int phy_up_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
 {
        int i, res = IRQ_HANDLED;
-       u32 port_id, link_rate, hard_phy_linkrate;
+       u32 port_id, link_rate;
        struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
        struct asd_sas_phy *sas_phy = &phy->sas_phy;
        struct device *dev = hisi_hba->dev;
@@ -2723,11 +2722,6 @@ static int phy_up_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
        }
 
        sas_phy->linkrate = link_rate;
-       hard_phy_linkrate = hisi_sas_phy_read32(hisi_hba, phy_no,
-                                               HARD_PHY_LINKRATE);
-       phy->maximum_linkrate = hard_phy_linkrate & 0xf;
-       phy->minimum_linkrate = (hard_phy_linkrate >> 4) & 0xf;
-
        sas_phy->oob_mode = SAS_OOB_MODE;
        memcpy(sas_phy->attached_sas_addr, &id->sas_addr, SAS_ADDR_SIZE);
        dev_info(dev, "phyup: phy%d link_rate=%d\n", phy_no, link_rate);
index 30b7bf7c221840c21fdf0b928f08dcbef6dec471..2be9500b6c2c0314026832b1d244477f02d44679 100644 (file)
@@ -343,12 +343,6 @@ struct hisi_sas_err_record_v3 {
 #define HISI_SAS_COMMAND_ENTRIES_V3_HW 4096
 #define HISI_SAS_MSI_COUNT_V3_HW 32
 
-enum {
-       HISI_SAS_PHY_PHY_UPDOWN,
-       HISI_SAS_PHY_CHNL_INT,
-       HISI_SAS_PHY_INT_NR
-};
-
 #define DIR_NO_DATA 0
 #define DIR_TO_INI 1
 #define DIR_TO_DEVICE 2
@@ -1120,7 +1114,7 @@ static int prep_abort_v3_hw(struct hisi_hba *hisi_hba,
 static int phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
 {
        int i, res = 0;
-       u32 context, port_id, link_rate, hard_phy_linkrate;
+       u32 context, port_id, link_rate;
        struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
        struct asd_sas_phy *sas_phy = &phy->sas_phy;
        struct device *dev = hisi_hba->dev;
@@ -1138,10 +1132,6 @@ static int phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
                goto end;
        }
        sas_phy->linkrate = link_rate;
-       hard_phy_linkrate = hisi_sas_phy_read32(hisi_hba, phy_no,
-                                               HARD_PHY_LINKRATE);
-       phy->maximum_linkrate = hard_phy_linkrate & 0xf;
-       phy->minimum_linkrate = (hard_phy_linkrate >> 4) & 0xf;
        phy->phy_type &= ~(PORT_TYPE_SAS | PORT_TYPE_SATA);
 
        /* Check for SATA dev */
@@ -1863,7 +1853,6 @@ static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no,
        sas_phy->phy->maximum_linkrate = max;
        sas_phy->phy->minimum_linkrate = min;
 
-       min -= SAS_LINK_RATE_1_5_GBPS;
        max -= SAS_LINK_RATE_1_5_GBPS;
 
        for (i = 0; i <= max; i++)