This patchset introduces SATA support fixes for
the HiSilicon v2 hw SAS controller.
Fixes include:
- attach issue for SATA disk attached through expander
- intermittent issue for directly attaching multiple
SATA disks
- add support for directly attaching SATA disk to phy
index 4+
- ITCT config issue
John Garry (5):
hisi_sas: use device linkrate in MCR for v2 hw
hisi_sas: fix v2 hw multiple SATA disk issue
hisi_sas: add v2 hw support for >4 SATA phys
hisi_sas: for v2 hw only set ITCT qw2 for SAS device
hisi_sas: update driver version to 1.4
drivers/scsi/hisi_sas/hisi_sas.h | 2 +-
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 32 +++++++++++++++++---------------
2 files changed, 18 insertions(+), 16 deletions(-)
--
1.9.1
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 29e89f3..7a7e543 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -23,7 +23,7 @@
#include <scsi/sas_ata.h>
#include <scsi/libsas.h>
-#define DRV_VERSION "v1.3"
+#define DRV_VERSION "v1.4"
#define HISI_SAS_MAX_PHYS 9
#define HISI_SAS_MAX_QUEUES 32
--
1.9.1
Intermittently it is found that when multiple SATA
disks are directly connected to the host that some
disks are not detected.
The problem is that all set bitfields in ENT_INT_SRC1
are cleared for all phys in sata_int_v2_hw() - it
should clear the set bit for the phy being serviced.
Also unnecessary double-write to ENT_INT_SRC1 and
ENT_INT_SRC_MSK1 is removed (remaining writes are
done at end label).
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index f462fc4..5a7f709 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -2003,12 +2003,10 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p)
hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, ent_msk | 1 << phy_no);
ent_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC1);
- ent_tmp = ent_int;
+ ent_tmp = ent_int & (1 << (ENT_INT_SRC1_D2H_FIS_CH1_OFF * phy_no));
ent_int >>= ENT_INT_SRC1_D2H_FIS_CH1_OFF * (phy_no % 4);
if ((ent_int & ENT_INT_SRC1_D2H_FIS_CH0_MSK) == 0) {
dev_warn(dev, "sata int: phy%d did not receive FIS\n", phy_no);
- hisi_sas_write32(hisi_hba, ENT_INT_SRC1, ent_tmp);
- hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, ent_msk);
res = IRQ_NONE;
goto end;
}
--
1.9.1
Contrary to the field name, the MCR (max connection rate)
in the ITCT should hold the device linkrate (linkrate of
the connected phy), and not the max linkrate.
This fixes an issue seen where some SATA drives connected
through an expander which would not attach.
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index b733747..f462fc4 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -544,7 +544,7 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
}
qw0 |= ((1 << ITCT_HDR_VALID_OFF) |
- (device->max_linkrate << ITCT_HDR_MCR_OFF) |
+ (device->linkrate << ITCT_HDR_MCR_OFF) |
(1 << ITCT_HDR_VLN_OFF) |
(port->id << ITCT_HDR_PORT_ID_OFF));
itct->qw0 = cpu_to_le64(qw0);
--
1.9.1
This patch fixes the ITCT table setup as it should be
configured differently for SAS and SATA devices.
For SATA disks there is no need to set qw2 (already
zeroed).
Also, link parameters for Bus inactive limit, max
connection time limit, and reject to open limit timers
parameters are changed to match global config register,
MAX_CON_TIME_LIMIT_TIME, as recommended by hw team.
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index cc083b9..4276594 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -554,10 +554,11 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
itct->sas_addr = __swab64(itct->sas_addr);
/* qw2 */
- itct->qw2 = cpu_to_le64((500ULL << ITCT_HDR_INLT_OFF) |
- (0xff00ULL << ITCT_HDR_BITLT_OFF) |
- (0xff00ULL << ITCT_HDR_MCTLT_OFF) |
- (0xff00ULL << ITCT_HDR_RTOLT_OFF));
+ if (!dev_is_sata(device))
+ itct->qw2 = cpu_to_le64((500ULL << ITCT_HDR_INLT_OFF) |
+ (0x1ULL << ITCT_HDR_BITLT_OFF) |
+ (0x32ULL << ITCT_HDR_MCTLT_OFF) |
+ (0x1ULL << ITCT_HDR_RTOLT_OFF));
}
static void free_device_v2_hw(struct hisi_hba *hisi_hba,
@@ -715,7 +716,7 @@ static void init_reg_v2_hw(struct hisi_hba *hisi_hba)
hisi_sas_write32(hisi_hba, HGC_SAS_TX_OPEN_FAIL_RETRY_CTRL, 0x7FF);
hisi_sas_write32(hisi_hba, OPENA_WT_CONTI_TIME, 0x1);
hisi_sas_write32(hisi_hba, I_T_NEXUS_LOSS_TIME, 0x1F4);
- hisi_sas_write32(hisi_hba, MAX_CON_TIME_LIMIT_TIME, 0x4E20);
+ hisi_sas_write32(hisi_hba, MAX_CON_TIME_LIMIT_TIME, 0x32);
hisi_sas_write32(hisi_hba, BUS_INACTIVE_LIMIT_TIME, 0x1);
hisi_sas_write32(hisi_hba, CFG_AGING_TIME, 0x1);
hisi_sas_write32(hisi_hba, HGC_ERR_STAT_EN, 0x1);
--
1.9.1
This patch adds support for directly attaching SATA
disks to phy 4-8. The problem was that only registers
concerned with phy 0-3 were being considered in
sata_int_v2_hw().
The issue was not detected previously as the
development board only exposed phy 0-3; the new
board provides access to 8 phys.
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 5a7f709..cc083b9 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -1993,17 +1993,20 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p)
u32 ent_tmp, ent_msk, ent_int, port_id, link_rate, hard_phy_linkrate;
irqreturn_t res = IRQ_HANDLED;
u8 attached_sas_addr[SAS_ADDR_SIZE] = {0};
- int phy_no;
+ int phy_no, offset;
phy_no = sas_phy->id;
initial_fis = &hisi_hba->initial_fis[phy_no];
fis = &initial_fis->fis;
- ent_msk = hisi_sas_read32(hisi_hba, ENT_INT_SRC_MSK1);
- hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, ent_msk | 1 << phy_no);
+ offset = 4 * (phy_no / 4);
+ ent_msk = hisi_sas_read32(hisi_hba, ENT_INT_SRC_MSK1 + offset);
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1 + offset,
+ ent_msk | 1 << ((phy_no % 4) * 8));
- ent_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC1);
- ent_tmp = ent_int & (1 << (ENT_INT_SRC1_D2H_FIS_CH1_OFF * phy_no));
+ ent_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC1 + offset);
+ ent_tmp = ent_int & (1 << (ENT_INT_SRC1_D2H_FIS_CH1_OFF *
+ (phy_no % 4)));
ent_int >>= ENT_INT_SRC1_D2H_FIS_CH1_OFF * (phy_no % 4);
if ((ent_int & ENT_INT_SRC1_D2H_FIS_CH0_MSK) == 0) {
dev_warn(dev, "sata int: phy%d did not receive FIS\n", phy_no);
@@ -2054,8 +2057,8 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p)
queue_work(hisi_hba->wq, &phy->phyup_ws);
end:
- hisi_sas_write32(hisi_hba, ENT_INT_SRC1, ent_tmp);
- hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, ent_msk);
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC1 + offset, ent_tmp);
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1 + offset, ent_msk);
return res;
}
--
1.9.1
>>>>> "John" == John Garry <[email protected]> writes:
John> This patchset introduces SATA support fixes for the HiSilicon v2
John> hw SAS controller.
Somebody please review.
--
Martin K. Petersen Oracle Linux Engineering
On Fri, Apr 8, 2016 at 5:23 PM, John Garry <[email protected]> wrote:
> This patchset introduces SATA support fixes for
> the HiSilicon v2 hw SAS controller.
>
> Fixes include:
> - attach issue for SATA disk attached through expander
> - intermittent issue for directly attaching multiple
> SATA disks
> - add support for directly attaching SATA disk to phy
> index 4+
> - ITCT config issue
>
> John Garry (5):
> hisi_sas: use device linkrate in MCR for v2 hw
> hisi_sas: fix v2 hw multiple SATA disk issue
> hisi_sas: add v2 hw support for >4 SATA phys
> hisi_sas: for v2 hw only set ITCT qw2 for SAS device
> hisi_sas: update driver version to 1.4
For the series,
Reviewed-by: Zhangfei Gao <[email protected]>
Thanks
>>>>> "John" == John Garry <[email protected]> writes:
John> This patchset introduces SATA support fixes for the HiSilicon v2
John> hw SAS controller.
John> Fixes include: - attach issue for SATA disk attached through
John> expander - intermittent issue for directly attaching multiple SATA
John> disks - add support for directly attaching SATA disk to phy index
John> 4+ - ITCT config issue
Applied to 4.7/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
On 15/04/2016 03:20, Martin K. Petersen wrote:
>>>>>> "John" == John Garry <[email protected]> writes:
>
> John> This patchset introduces SATA support fixes for the HiSilicon v2
> John> hw SAS controller.
>
> John> Fixes include: - attach issue for SATA disk attached through
> John> expander - intermittent issue for directly attaching multiple SATA
> John> disks - add support for directly attaching SATA disk to phy index
> John> 4+ - ITCT config issue
>
> Applied to 4.7/scsi-queue.
>
Hi Martin,
Could these also be applied to 4.6 fixes branch? Maybe I should have
explicitly asked.
Thanks,
John
>>>>> "John" == John Garry <[email protected]> writes:
John,
John> Could these also be applied to 4.6 fixes branch? Maybe I should
John> have explicitly asked.
Only taking critical patches for 4.6 at this point.
--
Martin K. Petersen Oracle Linux Engineering