From patchwork Fri Sep 6 12:55:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 173225 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp600078oce; Fri, 6 Sep 2019 05:58:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZKYo9uESy8Z6Oq87otmzOBI1Z3w0ayzRVzBziyI2qmfPRcXOJNyH0oEDVy7VToxRrxW8T X-Received: by 2002:a62:7911:: with SMTP id u17mr10850663pfc.162.1567774695510; Fri, 06 Sep 2019 05:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567774695; cv=none; d=google.com; s=arc-20160816; b=mm3F+cpKatOCqkBXsGr5KO3BRNXmEE2YHO19wQXdZWpM0yjLYM1WwE/PkyjALRjxgR emRle0U43FtA9gqpNUfi1mxkFE5bcw30xeEj7t1Lq75j5ic2lH+rUbaWH2/ZS5C4uR6t npjY3JahEsn/T069XV3T4l2m/YeTf6pzXMYnbZZTWiWu0QeGN+90qNYmgmYKPA9Yf7Gd wBnUI9u6s8mCq5Z/s+oCDl7FGaIy2XuboNmfaAmmP409vo6ILorHlRuZAY7YP0jyx23a Gw7QhoVRhHx68Fc/rDTrog8ORSv2QnvXON3GmQUCSyLZ7C7RK5XOotgg2XszlJq99oAW RDoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=zmxfRa+GTV4OlOZ2BvWrFJHM1F5cuJVFt0sS525XVBU=; b=hjXEREdmR35tbtp4/52hNySD69iYPCpjcdWgaDzIbm0RRFwPbzF2c2ZjIgjeodbjhh GpMtkHCKGbWyyzNdN8CNSjn3CrjqxNMSt8tLX2kJV78TVNMDECoRZOm9vGfBstP6i51t Y+BkDu3EkGPw44NoiKJ6qm/Hds+/Vwuq8AKwJigHfEFp+eYpxqbQQd5c3XC8e7wUuYes v3Ft2VfDB6DtdcXEzmQKy5GyTFOkBt7TVVLUXGx15Am3Of1lyP20xitzQR1IpEe3a7KY YAFAFj2ioF0cuwiIzORR/AlETVn4v2rZpIBFUPscvn0Un6n5Ml+J8q2RPNxnAiHYk6wo vEmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si4750655plt.26.2019.09.06.05.58.15 for ; Fri, 06 Sep 2019 05:58:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404914AbfIFM6P (ORCPT ); Fri, 6 Sep 2019 08:58:15 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7133 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404902AbfIFM6O (ORCPT ); Fri, 6 Sep 2019 08:58:14 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D2D1013A5BD820EA3CEE; Fri, 6 Sep 2019 20:58:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Sep 2019 20:58:03 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 07/13] scsi: hisi_sas: Assign NCQ tag for all NCQ commands Date: Fri, 6 Sep 2019 20:55:31 +0800 Message-ID: <1567774537-20003-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1567774537-20003-1-git-send-email-john.garry@huawei.com> References: <1567774537-20003-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen Currently the NCQ tag is only assigned for FPDMA READ and FPDMA WRITE commands, and for other NCQ commands (such as FPDMA SEND), their NCQ tags are set in the delivery command to 0. So for all the NCQ commands, we also need to assign normal NCQ tag for them, so drop the command type check in hisi_sas_get_ncq_tag() [drop hisi_sas_get_ncq_tag() altogether actually], and always use the ATA command NCQ tag when appropriate. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 - drivers/scsi/hisi_sas/hisi_sas_main.c | 15 --------------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 ++++- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 ++++- 4 files changed, 8 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index fd998d07ffcd..a72d06d973ff 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -559,7 +559,6 @@ extern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, extern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port); extern void hisi_sas_sata_done(struct sas_task *task, struct hisi_sas_slot *slot); -extern int hisi_sas_get_ncq_tag(struct sas_task *task, u32 *tag); extern int hisi_sas_get_fw_info(struct hisi_hba *hisi_hba); extern int hisi_sas_probe(struct platform_device *pdev, const struct hisi_sas_hw *ops); diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 4c279a285c20..efd0ddf24e99 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -118,21 +118,6 @@ void hisi_sas_sata_done(struct sas_task *task, } EXPORT_SYMBOL_GPL(hisi_sas_sata_done); -int hisi_sas_get_ncq_tag(struct sas_task *task, u32 *tag) -{ - struct ata_queued_cmd *qc = task->uldd_task; - - if (qc) { - if (qc->tf.command == ATA_CMD_FPDMA_WRITE || - qc->tf.command == ATA_CMD_FPDMA_READ) { - *tag = qc->tag; - return 1; - } - } - return 0; -} -EXPORT_SYMBOL_GPL(hisi_sas_get_ncq_tag); - /* * This function assumes linkrate mask fits in 8 bits, which it * does for all HW versions supported. diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index fba4fcad4735..9d316f28c74c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2534,7 +2534,10 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba, hdr->dw1 = cpu_to_le32(dw1); /* dw2 */ - if (task->ata_task.use_ncq && hisi_sas_get_ncq_tag(task, &hdr_tag)) { + if (task->ata_task.use_ncq) { + struct ata_queued_cmd *qc = task->uldd_task; + + hdr_tag = qc->tag; task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); dw2 |= hdr_tag << CMD_HDR_NCQ_TAG_OFF; } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 4c32088b9199..cd901213a59b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1356,7 +1356,10 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba, hdr->dw1 = cpu_to_le32(dw1); /* dw2 */ - if (task->ata_task.use_ncq && hisi_sas_get_ncq_tag(task, &hdr_tag)) { + if (task->ata_task.use_ncq) { + struct ata_queued_cmd *qc = task->uldd_task; + + hdr_tag = qc->tag; task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); dw2 |= hdr_tag << CMD_HDR_NCQ_TAG_OFF; }