From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <linux-scsi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <bianpan2016@163.com>,
Xiang Chen <chenxiang66@hisilicon.com>,
John Garry <john.garry@huawei.com>
Subject: [PATCH 08/19] scsi: hisi_sas: service interrupt ITCT_CLR interrupt in v2 hw
Date: Fri, 11 Aug 2017 00:09:33 +0800 [thread overview]
Message-ID: <1502381384-219889-9-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com>
From: Xiang Chen <chenxiang66@hisilicon.com>
This patch is a fix related to free'ing a device in
v2 hw driver.
Before, we polled to ITCT CLR interrupt to check if
a device is free.
This was error prone, as if the interrupt doesn't occur
in 10us, we miss processing it.
To avoid this situation, service this interrupt and
sync the event with a completion.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas.h | 1 +
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 40 ++++++++++++++++------------------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index ad6b2d1..23a22dc 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -141,6 +141,7 @@ struct hisi_sas_dq {
struct hisi_sas_device {
struct hisi_hba *hisi_hba;
struct domain_device *sas_device;
+ struct completion *completion;
struct hisi_sas_dq *dq;
struct list_head list;
u64 attached_phy;
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 9eea0b4..0e3634e 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -974,12 +974,14 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
static void free_device_v2_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_device *sas_dev)
{
+ DECLARE_COMPLETION_ONSTACK(completion);
u64 dev_id = sas_dev->device_id;
- struct device *dev = hisi_hba->dev;
struct hisi_sas_itct *itct = &hisi_hba->itct[dev_id];
u32 reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3);
int i;
+ sas_dev->completion = &completion;
+
/* SoC bug workaround */
if (dev_is_sata(sas_dev->sas_device))
clear_bit(sas_dev->sata_idx, hisi_hba->sata_dev_bitmap);
@@ -989,28 +991,12 @@ static void free_device_v2_hw(struct hisi_hba *hisi_hba,
hisi_sas_write32(hisi_hba, ENT_INT_SRC3,
ENT_INT_SRC3_ITC_INT_MSK);
- /* clear the itct int*/
for (i = 0; i < 2; i++) {
- /* clear the itct table*/
- reg_val = hisi_sas_read32(hisi_hba, ITCT_CLR);
- reg_val |= ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK);
+ reg_val = ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK);
hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val);
+ wait_for_completion(sas_dev->completion);
- udelay(10);
- reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3);
- if (ENT_INT_SRC3_ITC_INT_MSK & reg_val) {
- dev_dbg(dev, "got clear ITCT done interrupt\n");
-
- /* invalid the itct state*/
- memset(itct, 0, sizeof(struct hisi_sas_itct));
- hisi_sas_write32(hisi_hba, ENT_INT_SRC3,
- ENT_INT_SRC3_ITC_INT_MSK);
-
- /* clear the itct */
- hisi_sas_write32(hisi_hba, ITCT_CLR, 0);
- dev_dbg(dev, "clear ITCT ok\n");
- break;
- }
+ memset(itct, 0, sizeof(struct hisi_sas_itct));
}
}
@@ -1191,7 +1177,7 @@ static void init_reg_v2_hw(struct hisi_hba *hisi_hba)
hisi_sas_write32(hisi_hba, ENT_INT_SRC3, 0xffffffff);
hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0x7efefefe);
hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0x7efefefe);
- hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0x7ffffffe);
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0x7ffe20fe);
hisi_sas_write32(hisi_hba, SAS_ECC_INTR_MSK, 0xfff00c30);
for (i = 0; i < hisi_hba->queue_count; i++)
hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK+0x4*i, 0);
@@ -3092,8 +3078,20 @@ static irqreturn_t fatal_axi_int_v2_hw(int irq_no, void *p)
irq_value);
queue_work(hisi_hba->wq, &hisi_hba->rst_work);
}
+
+ if (irq_value & BIT(ENT_INT_SRC3_ITC_INT_OFF)) {
+ u32 reg_val = hisi_sas_read32(hisi_hba, ITCT_CLR);
+ u32 dev_id = reg_val & ITCT_DEV_MSK;
+ struct hisi_sas_device *sas_dev =
+ &hisi_hba->devices[dev_id];
+
+ hisi_sas_write32(hisi_hba, ITCT_CLR, 0);
+ dev_dbg(dev, "clear ITCT ok\n");
+ complete(sas_dev->completion);
+ }
}
+ hisi_sas_write32(hisi_hba, ENT_INT_SRC3, irq_value);
hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, irq_msk);
return IRQ_HANDLED;
--
1.9.1
next prev parent reply other threads:[~2017-08-10 15:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 16:09 [PATCH 00/19] hisi_sas: misc fixes, improvements, and new features John Garry
2017-08-10 16:09 ` [PATCH 01/19] scsi: hisi_sas: fix reset and port ID refresh issues John Garry
2017-08-10 16:09 ` [PATCH 02/19] scsi: hisi_sas: avoid potential v2 hw interrupt issue John Garry
2017-08-10 16:09 ` [PATCH 03/19] scsi: hisi_sas: fix v2 hw underflow residual value John Garry
2017-08-10 16:09 ` [PATCH 04/19] scsi: hisi_sas: add v2 hw DFX feature John Garry
2017-08-10 16:09 ` [PATCH 05/19] scsi: hisi_sas: use array for v2 hw ECC errors John Garry
2017-08-10 16:09 ` [PATCH 06/19] scsi: hisi_sas: remove repeated device config in v2 hw John Garry
2017-08-10 16:09 ` [PATCH 07/19] scsi: hisi_sas: add irq and tasklet cleanup " John Garry
2017-08-10 16:09 ` John Garry [this message]
2017-08-10 16:09 ` [PATCH 09/19] scsi: hisi_sas: support zone management commands John Garry
2017-08-10 16:09 ` [PATCH 10/19] scsi: hisi_sas: add status and command buffer for internal abort John Garry
2017-08-10 16:09 ` [PATCH 11/19] scsi: hisi_sas: Modify v3 hw STP_LINK_TIMER setting John Garry
2017-08-10 16:09 ` [PATCH 12/19] scsi: hisi_sas: fix v3 hw channel interrupt processing John Garry
2017-08-10 16:09 ` [PATCH 13/19] scsi: hisi_sas: kill tasklet when destroying irq in v3 hw John Garry
2017-08-10 16:09 ` [PATCH 14/19] scsi: hisi_sas: update some v3 register init settings John Garry
2017-08-10 16:09 ` [PATCH 15/19] scsi: hisi_sas: add reset handler for v3 hw John Garry
2017-08-10 16:09 ` [PATCH 16/19] scsi: hisi_sas: add phy_set_linkrate_v3_hw() John Garry
2017-08-10 16:09 ` [PATCH 17/19] scsi: hisi_sas: remove phy_down_v3_hw() res variable John Garry
2017-08-10 16:09 ` [PATCH 18/19] scsi: hisi_sas: replace kfree with scsi_host_put John Garry
2017-08-10 16:09 ` [PATCH 19/19] scsi: hisi_sas: remove driver versioning John Garry
2017-08-11 0:18 ` [PATCH 00/19] hisi_sas: misc fixes, improvements, and new features Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1502381384-219889-9-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=bianpan2016@163.com \
--cc=chenxiang66@hisilicon.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®