Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304590 > unrolled thread
| Started by | John Garry <john.garry@huawei.com> |
|---|---|
| First post | 2016-01-08 15:20 +0100 |
| Last post | 2016-01-11 14:50 +0100 |
| Articles | 8 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 00/23] HiSilicon SAS v2 hw support John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
[PATCH 14/23] hisi_sas: add v2 channel interrupt handler John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
[PATCH 18/23] hisi_sas: add v2 code to send smp command John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
[PATCH 06/23] hisi_sas: rename some fields in hisi_sas_itct John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
[PATCH 23/23] hisi_sas: update driver version to 1.1 John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
[PATCH 11/23] hisi_sas: add v2 phy init code John Garry <john.garry@huawei.com> - 2016-01-08 15:20 +0100
Re: [PATCH 00/23] HiSilicon SAS v2 hw support John Garry <john.garry@huawei.com> - 2016-01-08 15:40 +0100
Re: [PATCH 00/23] HiSilicon SAS v2 hw support Hannes Reinecke <hare@suse.de> - 2016-01-11 14:50 +0100
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 00/23] HiSilicon SAS v2 hw support |
| Message-ID | <qOFTQ-7OQ-3@gated-at.bofh.it> |
This patchset introduces support for the HiSi SAS v2 hw. The major difference between v1 and v2 hw is support for SATA/STP. Known limitation: - We cannot connect a SATA disk through a 12G expander without disabling the STP buffer. Direcly connecting a SATA disk to the HBA is ok. John Garry (23): devicetree: bindings: hisi_sas: add v2 HW bindings hisi_sas: relocate DEV_IS_EXPANDER hisi_sas: set max commands as configurable hisi_sas: reduce max itct entries hisi_sas: add hisi_sas_err_record_v1 hisi_sas: rename some fields in hisi_sas_itct hisi_sas: add bare v2 hw driver hisi_sas: add v2 register definitions hisi_sas: add v2 hw init hisi_sas: add init_id_frame_v2_hw() hisi_sas: add v2 phy init code hisi_sas: add v2 int init and phy up handler hisi_sas: add v2 phy down handler hisi_sas: add v2 channel interrupt handler hisi_sas: add v2 SATA interrupt handler hisi_sas: add v2 cq interrupt handler hisi_sas: add v2 path to send ssp frame hisi_sas: add v2 code to send smp command hisi_sas: add v2 code for itct setup and free hisi_sas: add v2 path to send ATA command hisi_sas: add v2 slot error handler hisi_sas: add v2 tmf functions hisi_sas: update driver version to 1.1 .../devicetree/bindings/scsi/hisilicon-sas.txt | 20 +- drivers/scsi/hisi_sas/Makefile | 2 +- drivers/scsi/hisi_sas/hisi_sas.h | 39 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 36 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 20 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2206 ++++++++++++++++++++ 6 files changed, 2277 insertions(+), 46 deletions(-) create mode 100644 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -- 1.9.1
[toc] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 14/23] hisi_sas: add v2 channel interrupt handler |
| Message-ID | <qOG3w-7SE-11@gated-at.bofh.it> |
| In reply to | #1304590 |
This also includes broadcast handler. Unlike v1 hw,
broadcast does not have its own dedicated interrupt.
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 79 ++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index d70e5d7..f276d20 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -258,6 +258,7 @@ struct hisi_sas_complete_v2_hdr {
enum {
HISI_SAS_PHY_PHY_UPDOWN,
+ HISI_SAS_PHY_CHNL_INT,
HISI_SAS_PHY_INT_NR
};
@@ -782,8 +783,86 @@ end:
return res;
}
+static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
+{
+ struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
+ struct asd_sas_phy *sas_phy = &phy->sas_phy;
+ struct sas_ha_struct *sas_ha = &hisi_hba->sha;
+ unsigned long flags;
+
+ hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1);
+
+ spin_lock_irqsave(&hisi_hba->lock, flags);
+ sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD);
+ spin_unlock_irqrestore(&hisi_hba->lock, flags);
+
+ hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0,
+ CHL_INT0_SL_RX_BCST_ACK_MSK);
+ hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0);
+}
+
+static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p)
+{
+ struct hisi_hba *hisi_hba = p;
+ struct device *dev = &hisi_hba->pdev->dev;
+ u32 ent_msk, ent_tmp, irq_msk;
+ int phy_no = 0;
+
+ ent_msk = hisi_sas_read32(hisi_hba, ENT_INT_SRC_MSK3);
+ ent_tmp = ent_msk;
+ ent_msk |= ENT_INT_SRC_MSK3_ENT95_MSK_MSK;
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, ent_msk);
+
+ irq_msk = (hisi_sas_read32(hisi_hba, HGC_INVLD_DQE_INFO) >>
+ HGC_INVLD_DQE_INFO_FB_CH3_OFF) & 0x1ff;
+
+ while (irq_msk) {
+ if (irq_msk & (1 << phy_no)) {
+ u32 irq_value0 = hisi_sas_phy_read32(hisi_hba, phy_no,
+ CHL_INT0);
+ u32 irq_value1 = hisi_sas_phy_read32(hisi_hba, phy_no,
+ CHL_INT1);
+ u32 irq_value2 = hisi_sas_phy_read32(hisi_hba, phy_no,
+ CHL_INT2);
+
+ if (irq_value1) {
+ if (irq_value1 & (CHL_INT1_DMAC_RX_ECC_ERR_MSK |
+ CHL_INT1_DMAC_TX_ECC_ERR_MSK))
+ panic("%s: DMAC RX/TX ecc bad error! (0x%x)",
+ dev_name(dev), irq_value1);
+
+ hisi_sas_phy_write32(hisi_hba, phy_no,
+ CHL_INT1, irq_value1);
+ }
+
+ if (irq_value2)
+ hisi_sas_phy_write32(hisi_hba, phy_no,
+ CHL_INT2, irq_value2);
+
+
+ if (irq_value0) {
+ if (irq_value0 & CHL_INT0_SL_RX_BCST_ACK_MSK)
+ phy_bcast_v2_hw(phy_no, hisi_hba);
+
+ hisi_sas_phy_write32(hisi_hba, phy_no,
+ CHL_INT0, irq_value0
+ & (~CHL_INT0_HOTPLUG_TOUT_MSK)
+ & (~CHL_INT0_SL_PHY_ENABLE_MSK)
+ & (~CHL_INT0_NOT_RDY_MSK));
+ }
+ }
+ irq_msk &= ~(1 << phy_no);
+ phy_no++;
+ }
+
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, ent_tmp);
+
+ return IRQ_HANDLED;
+}
+
static irq_handler_t phy_interrupts[HISI_SAS_PHY_INT_NR] = {
int_phy_updown_v2_hw,
+ int_chnl_int_v2_hw,
};
/**
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 18/23] hisi_sas: add v2 code to send smp command |
| Message-ID | <qOG3w-7SE-25@gated-at.bofh.it> |
| In reply to | #1304590 |
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 71 ++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index e9d3db9..94499b1 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -743,6 +743,76 @@ static int prep_prd_sge_v2_hw(struct hisi_hba *hisi_hba,
return 0;
}
+static int prep_smp_v2_hw(struct hisi_hba *hisi_hba,
+ struct hisi_sas_slot *slot)
+{
+ struct sas_task *task = slot->task;
+ struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
+ struct domain_device *device = task->dev;
+ struct device *dev = &hisi_hba->pdev->dev;
+ struct hisi_sas_port *port = slot->port;
+ struct scatterlist *sg_req, *sg_resp;
+ struct hisi_sas_device *sas_dev = device->lldd_dev;
+ dma_addr_t req_dma_addr;
+ unsigned int req_len, resp_len;
+ int elem, rc;
+
+ /*
+ * DMA-map SMP request, response buffers
+ */
+ /* req */
+ sg_req = &task->smp_task.smp_req;
+ elem = dma_map_sg(dev, sg_req, 1, DMA_TO_DEVICE);
+ if (!elem)
+ return -ENOMEM;
+ req_len = sg_dma_len(sg_req);
+ req_dma_addr = sg_dma_address(sg_req);
+
+ /* resp */
+ sg_resp = &task->smp_task.smp_resp;
+ elem = dma_map_sg(dev, sg_resp, 1, DMA_FROM_DEVICE);
+ if (!elem) {
+ rc = -ENOMEM;
+ goto err_out_req;
+ }
+ resp_len = sg_dma_len(sg_resp);
+ if ((req_len & 0x3) || (resp_len & 0x3)) {
+ rc = -EINVAL;
+ goto err_out_resp;
+ }
+
+ /* create header */
+ /* dw0 */
+ hdr->dw0 = cpu_to_le32((port->id << CMD_HDR_PORT_OFF) |
+ (1 << CMD_HDR_PRIORITY_OFF) | /* high pri */
+ (2 << CMD_HDR_CMD_OFF)); /* smp */
+
+ /* map itct entry */
+ hdr->dw1 = cpu_to_le32((sas_dev->device_id << CMD_HDR_DEV_ID_OFF) |
+ (1 << CMD_HDR_FRAME_TYPE_OFF) |
+ (DIR_NO_DATA << CMD_HDR_DIR_OFF));
+
+ /* dw2 */
+ hdr->dw2 = cpu_to_le32((((req_len - 4) / 4) << CMD_HDR_CFL_OFF) |
+ (HISI_SAS_MAX_SMP_RESP_SZ / 4 <<
+ CMD_HDR_MRFL_OFF));
+
+ hdr->transfer_tags = cpu_to_le32(slot->idx << CMD_HDR_IPTT_OFF);
+
+ hdr->cmd_table_addr = cpu_to_le64(req_dma_addr);
+ hdr->sts_buffer_addr = cpu_to_le64(slot->status_buffer_dma);
+
+ return 0;
+
+err_out_resp:
+ dma_unmap_sg(dev, &slot->task->smp_task.smp_resp, 1,
+ DMA_FROM_DEVICE);
+err_out_req:
+ dma_unmap_sg(dev, &slot->task->smp_task.smp_req, 1,
+ DMA_TO_DEVICE);
+ return rc;
+}
+
static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int is_tmf,
struct hisi_sas_tmf_task *tmf)
@@ -1399,6 +1469,7 @@ static const struct hisi_sas_hw hisi_sas_v2_hw = {
.hw_init = hisi_sas_v2_init,
.sl_notify = sl_notify_v2_hw,
.get_wideport_bitmap = get_wideport_bitmap_v2_hw,
+ .prep_smp = prep_smp_v2_hw,
.prep_ssp = prep_ssp_v2_hw,
.get_free_slot = get_free_slot_v2_hw,
.start_delivery = start_delivery_v2_hw,
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 06/23] hisi_sas: rename some fields in hisi_sas_itct |
| Message-ID | <qOG3w-7SE-29@gated-at.bofh.it> |
| In reply to | #1304590 |
Since hisi_sas_itct format is different between v1
and v2 hw, give more general names for some fields.
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas.h | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index e5a58c5..b2e4b26 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -248,18 +248,7 @@ struct hisi_sas_itct {
__le64 sas_addr;
__le64 qw2;
__le64 qw3;
- __le64 qw4;
- __le64 qw_sata_ncq0_3;
- __le64 qw_sata_ncq7_4;
- __le64 qw_sata_ncq11_8;
- __le64 qw_sata_ncq15_12;
- __le64 qw_sata_ncq19_16;
- __le64 qw_sata_ncq23_20;
- __le64 qw_sata_ncq27_24;
- __le64 qw_sata_ncq31_28;
- __le64 qw_non_ncq_iptt;
- __le64 qw_rsvd0;
- __le64 qw_rsvd1;
+ __le64 qw4_15[12];
};
struct hisi_sas_iost {
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 23/23] hisi_sas: update driver version to 1.1 |
| Message-ID | <qOG3x-7SE-33@gated-at.bofh.it> |
| In reply to | #1304590 |
Signed-off-by: John Garry <john.garry@huawei.com> --- 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 f00b55b..9f08c0c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -21,7 +21,7 @@ #include <scsi/sas_ata.h> #include <scsi/libsas.h> -#define DRV_VERSION "v1.0" +#define DRV_VERSION "v1.1" #define HISI_SAS_MAX_PHYS 9 #define HISI_SAS_MAX_QUEUES 32 -- 1.9.1
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:20 +0100 |
| Subject | [PATCH 11/23] hisi_sas: add v2 phy init code |
| Message-ID | <qOG3x-7SE-31@gated-at.bofh.it> |
| In reply to | #1304590 |
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 49 ++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 6ab0503..325b287 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -288,6 +288,15 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,
return readl(regs);
}
+static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
+{
+ u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
+
+ cfg &= ~PHY_CFG_DC_OPT_MSK;
+ cfg |= 1 << PHY_CFG_DC_OPT_OFF;
+ hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg);
+}
+
static void config_id_frame_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
{
struct sas_identify_frame identify_frame;
@@ -562,6 +571,44 @@ static int hw_init_v2_hw(struct hisi_hba *hisi_hba)
return 0;
}
+static void enable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
+{
+ u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
+
+ cfg |= PHY_CFG_ENA_MSK;
+ hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg);
+}
+
+static void start_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
+{
+ config_id_frame_v2_hw(hisi_hba, phy_no);
+ config_phy_opt_mode_v2_hw(hisi_hba, phy_no);
+ enable_phy_v2_hw(hisi_hba, phy_no);
+}
+
+static void start_phys_v2_hw(unsigned long data)
+{
+ struct hisi_hba *hisi_hba = (struct hisi_hba *)data;
+ int i;
+
+ for (i = 0; i < hisi_hba->n_phy; i++)
+ start_phy_v2_hw(hisi_hba, i);
+}
+
+static void phys_init_v2_hw(struct hisi_hba *hisi_hba)
+{
+ int i;
+ struct timer_list *timer = &hisi_hba->timer;
+
+ for (i = 0; i < hisi_hba->n_phy; i++) {
+ hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0x6a);
+ hisi_sas_phy_read32(hisi_hba, i, CHL_INT2_MSK);
+ }
+
+ setup_timer(timer, start_phys_v2_hw, (unsigned long)hisi_hba);
+ mod_timer(timer, jiffies + HZ);
+}
+
static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
{
int rc;
@@ -570,6 +617,8 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
if (rc)
return rc;
+ phys_init_v2_hw(hisi_hba);
+
return 0;
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2016-01-08 15:40 +0100 |
| Message-ID | <qOGmR-812-3@gated-at.bofh.it> |
| In reply to | #1304590 |
My patchset was bounced by JBottomley@odin.com It seems sudipm.mukherjee@gmail.com had the same issue earlier this week, but other contributors seem to continue using the same address - shall I resend with alternate address?
[toc] | [prev] | [next] | [standalone]
| From | Hannes Reinecke <hare@suse.de> |
|---|---|
| Date | 2016-01-11 14:50 +0100 |
| Message-ID | <qPL18-34y-19@gated-at.bofh.it> |
| In reply to | #1304590 |
On 01/08/2016 03:15 PM, John Garry wrote: > This patchset introduces support for the HiSi SAS v2 hw. > The major difference between v1 and v2 hw is support > for SATA/STP. > > Known limitation: > - We cannot connect a SATA disk through a 12G expander > without disabling the STP buffer. Direcly connecting > a SATA disk to the HBA is ok. > > John Garry (23): > devicetree: bindings: hisi_sas: add v2 HW bindings > hisi_sas: relocate DEV_IS_EXPANDER > hisi_sas: set max commands as configurable > hisi_sas: reduce max itct entries > hisi_sas: add hisi_sas_err_record_v1 > hisi_sas: rename some fields in hisi_sas_itct > hisi_sas: add bare v2 hw driver > hisi_sas: add v2 register definitions > hisi_sas: add v2 hw init > hisi_sas: add init_id_frame_v2_hw() > hisi_sas: add v2 phy init code > hisi_sas: add v2 int init and phy up handler > hisi_sas: add v2 phy down handler > hisi_sas: add v2 channel interrupt handler > hisi_sas: add v2 SATA interrupt handler > hisi_sas: add v2 cq interrupt handler > hisi_sas: add v2 path to send ssp frame > hisi_sas: add v2 code to send smp command > hisi_sas: add v2 code for itct setup and free > hisi_sas: add v2 path to send ATA command > hisi_sas: add v2 slot error handler > hisi_sas: add v2 tmf functions > hisi_sas: update driver version to 1.1 > > .../devicetree/bindings/scsi/hisilicon-sas.txt | 20 +- > drivers/scsi/hisi_sas/Makefile | 2 +- > drivers/scsi/hisi_sas/hisi_sas.h | 39 +- > drivers/scsi/hisi_sas/hisi_sas_main.c | 36 +- > drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 20 +- > drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2206 ++++++++++++++++++++ > 6 files changed, 2277 insertions(+), 46 deletions(-) > create mode 100644 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c > For the entire series: Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web