From patchwork Tue Oct 25 10:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 10706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp917951wru; Tue, 25 Oct 2022 03:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C0RhCnIXL7KYuNf1FFVgI4lSq2C1ceeebfIoeX6GIDCif/Fl4G3gJ3QI0I7W1SvYpNJvx X-Received: by 2002:a17:90b:1e0d:b0:213:ae0:fcf8 with SMTP id pg13-20020a17090b1e0d00b002130ae0fcf8mr11742248pjb.189.1666692945483; Tue, 25 Oct 2022 03:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666692945; cv=none; d=google.com; s=arc-20160816; b=VtC7wbpvUMPA3XtycGtt3z4d7jm+qJjqDWgUIkHonpI3/NYVxoaK3tK06kXDGGYJ/z T6AMEKUBmau5juGRTwZZn42EBntFNfRAVCv8PLh9ec5B83PMnI1RWr3a/4tt/zFt/4w/ pXIgF3oQgDknuEp1pJsVpZMOWQtiE+/DWRMmZez29ORKWhyd4JJjzoVQDogv/PGMfttt 17HJHw0qsRfC7kzduXV/4A1AFScVwP/rh39+HVN+ubC9eLZC7qDVCt2j5XvTdkeQG7me 6NO3SscGXqaXVsyBvlo5oBoHQ6hv/9ec3+aFkWf0XH5eTa4z8KThkmFgaCbH6NIt7qgP hREw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rpJvMTY8rj2ffu8oebfguK7ijpUmRwByfQuId/UsITw=; b=XW+3PhIWEXkDl+xtcrlgtx56/kNkbkjuzl9xHH7v3kz6xLw8D5mQh3YFmzD8+yVZKJ Vh2kz0l9dm/Xcx7d8ZK+MQAfZYwRFJRkN1092bF/dz/EWXnReZHxUwHFq+WetE+9nlAX kShpIqKvHmcUoQjz+FXHN2Q6NpgbfaW6zzBAqIVpHWYoaDVIOeFY5dlU9+WaSlSm29hU tHUhza0Y9XFQVXP4JPOo20I0JsjGEYKiW7XlWS+NGaQf+yrzkoU+Vvvb71qN43GpmkjF rUThBnsNsZSXJPpYh98Bk+isM5hJC7sSFg0TNSezGT/B7ido2CqofeKa4Vqj33r32KWx TNIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a056a00174f00b0055fb32175c4si2877566pfc.294.2022.10.25.03.15.32; Tue, 25 Oct 2022 03:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbiJYKL2 (ORCPT + 99 others); Tue, 25 Oct 2022 06:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbiJYKKj (ORCPT ); Tue, 25 Oct 2022 06:10:39 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0CF1211C5; Tue, 25 Oct 2022 03:03:27 -0700 (PDT) Received: from fraeml706-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MxSC12RFXz6H73T; Tue, 25 Oct 2022 18:01:33 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml706-chm.china.huawei.com (10.206.15.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 25 Oct 2022 12:03:26 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 11:03:22 +0100 From: John Garry To: , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH RFC v3 3/7] ata: libata: Make space for ATA queue command in scmd payload Date: Tue, 25 Oct 2022 18:32:52 +0800 Message-ID: <1666693976-181094-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1666693976-181094-1-git-send-email-john.garry@huawei.com> References: <1666693976-181094-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747654222430022072?= X-GMAIL-MSGID: =?utf-8?q?1747654222430022072?= Prepare to put the ATA queue command in a scmd payload by using priv space per driver which uses libata. The end goal is to remove ata_port.qcmd[]. Suggested-by: Hannes Reinecke Signed-off-by: John Garry --- drivers/ata/libata-scsi.c | 6 ++++++ drivers/scsi/aic94xx/aic94xx_init.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 ++ drivers/scsi/isci/init.c | 2 ++ drivers/scsi/mvsas/mv_init.c | 2 ++ drivers/scsi/pm8001/pm8001_init.c | 2 ++ include/linux/libata.h | 5 ++++- 9 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 0d6f37d80137..18c60addf943 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1118,6 +1118,12 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) return 0; } +int ata_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd) +{ + return 0; +} +EXPORT_SYMBOL_GPL(ata_init_cmd_priv); + int ata_internal_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmd) { struct ata_port *ap; diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 70b735cedeb3..e2c99c74f73e 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -63,6 +63,8 @@ static struct scsi_host_template aic94xx_sht = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static int asd_map_memio(struct asd_ha_struct *asd_ha) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 438e8a963782..aec13a46de6e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1763,6 +1763,8 @@ static struct scsi_host_template sht_v1_hw = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static const struct hisi_sas_hw hisi_sas_v1_hw = { diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index b733eb18864c..cb057b3a84ac 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3581,6 +3581,8 @@ static struct scsi_host_template sht_v2_hw = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static const struct hisi_sas_hw hisi_sas_v2_hw = { diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index d703af7985b0..4caf07306b24 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3248,6 +3248,8 @@ static struct scsi_host_template sht_v3_hw = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static const struct hisi_sas_hw hisi_sas_v3_hw = { diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index c07d89451bb6..0d0b8ef71c65 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c @@ -180,6 +180,8 @@ static struct scsi_host_template isci_sht = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static struct sas_domain_function_template isci_transport_ops = { diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 07e6c5d6c46d..e1b6cc196cef 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -57,6 +57,8 @@ static struct scsi_host_template mvs_sht = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; static struct sas_domain_function_template mvs_transport_ops = { diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index e37e8898afaa..fe55cc9765ae 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -126,6 +126,8 @@ static struct scsi_host_template pm8001_sht = { .reserved_queuecommand = sas_queuecommand_internal, .reserved_timedout = sas_internal_timeout, .nr_reserved_cmds = 2, + .init_cmd_priv = ata_init_cmd_priv, + .cmd_size = sizeof(struct ata_queued_cmd), }; /* diff --git a/include/linux/libata.h b/include/linux/libata.h index f09c5dca16ce..1a03c7fbb4e6 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1143,6 +1143,7 @@ extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev); extern int ata_scsi_slave_config(struct scsi_device *sdev); extern int ata_internal_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmd); +extern int ata_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd); extern void ata_scsi_slave_destroy(struct scsi_device *sdev); extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth); @@ -1394,7 +1395,9 @@ extern const struct attribute_group *ata_common_sdev_groups[]; .bios_param = ata_std_bios_param, \ .unlock_native_capacity = ata_scsi_unlock_native_capacity,\ .max_sectors = ATA_MAX_SECTORS_LBA48,\ - .reserved_queuecommand = ata_internal_queuecommand + .reserved_queuecommand = ata_internal_queuecommand,\ + .cmd_size = sizeof(struct ata_queued_cmd),\ + .init_cmd_priv = ata_init_cmd_priv #define ATA_SUBBASE_SHT(drv_name) \ __ATA_BASE_SHT(drv_name), \