Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp291895iol; Thu, 9 Jun 2022 04:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRgQ1BvTIlqTSO3K/1eqBdBN2its5ivhFlpA3T9+z6/Yc90WMX7vusmR9CrXl5bTqjikSO X-Received: by 2002:a65:6b8a:0:b0:3db:7dc5:fec2 with SMTP id d10-20020a656b8a000000b003db7dc5fec2mr33086012pgw.223.1654772760019; Thu, 09 Jun 2022 04:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654772760; cv=none; d=google.com; s=arc-20160816; b=WYwtdnVzSJpN7l1o5weq5Lcf14kHGhC4vt6LEmrMX8xltUO1jl1A+STyCZ35dy823y peCL8WwZdMOC8lFPzFT1WlKnDYFOZp3KYbNsW6vowTsWD/R2J+DgPX75jZ0Bpr3qjhel dMhppykQbLLJZYIXWpRZ0xa1eZwgRXGgT6n1zhKbyh35sQ3Vr/lidLjNbCT881fWrydz VRi7LsN+yyhwgBH8lyLS0cXNI7UuDiaabdxvNLo2bNCowZFx84oFvfl4zW1aX7+g6JNS /wNHCHCs3AqOXFq+p1+75wu9/QNYa2wIuyYPOVwT6Ygeb5Z6xUesjX4XwbCEofIuz9Gf SpiQ== 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=CIV6w1yMZW8vpq+8fPxxbqVAYVvv+EPEZ5pl3Ux05Ts=; b=oyksRjyhRaJl3i/K4FUjv34XO5y3NFfxK7I/KldTb/9qa/wVhDIqNizb5fMDwP3cKI WT02uNknIp4LItQlGOLY54gIPOzg4L2O4RGFqG+9xUk2zeCjJvcxwH4zdN153ZMBw1+M BlkIlEciQ9V6sKXNu+VZJ9cMnc13/Wf0QTHmLobHbRt0O0nuox5nqBaF3Znfw6Q+C9Mz gzxRIJp0CtlPqOc/rVG0s1vCFVAsZZJwhMqWuT2AiVinhSNLwRhNSet3/ZDc8nMgaSBW jnqM1RowzRkBb7G6TUQHo3kxmiORl3Qur9ndCnixtQYgyhivhkzzx4qre2AgthwGU0G9 tw5Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a170902d70700b0016215c2e4fasi30765585ply.74.2022.06.09.04.05.45; Thu, 09 Jun 2022 04:06:00 -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 S230425AbiFIKg7 (ORCPT + 99 others); Thu, 9 Jun 2022 06:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242960AbiFIKgu (ORCPT ); Thu, 9 Jun 2022 06:36:50 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0126214812; Thu, 9 Jun 2022 03:36:21 -0700 (PDT) Received: from fraeml715-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJgTL0SD0z67LRs; Thu, 9 Jun 2022 18:35:02 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml715-chm.china.huawei.com (10.206.15.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 9 Jun 2022 12:36:19 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 9 Jun 2022 11:36:16 +0100 From: John Garry To: , , , , , , CC: , , , , , John Garry Subject: [PATCH RFC v2 07/18] libata-scsi: Add ata_internal_queuecommand() Date: Thu, 9 Jun 2022 18:29:08 +0800 Message-ID: <1654770559-101375-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1654770559-101375-1-git-send-email-john.garry@huawei.com> References: <1654770559-101375-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Add callback to queue reserved commands - call it "internal" as this is what libata uses. Also add it to the base ATA SHT, and set nr_reserved_cmds = 1, which matches tag ATA_TAG_INTERNAL. Signed-off-by: John Garry --- drivers/ata/libata-scsi.c | 14 ++++++++++++++ include/linux/libata.h | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index baac35dd17ca..b2702ab0183b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1114,6 +1114,20 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) return 0; } +int ata_internal_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmd) +{ + struct ata_port *ap; + int res; + + ap = ata_shost_to_port(shost); + spin_lock_irq(ap->lock); + res = ata_sas_queuecmd(scmd, ap); + spin_unlock_irq(ap->lock); + + return res; +} +EXPORT_SYMBOL_GPL(ata_internal_queuecommand); + /** * ata_scsi_slave_config - Set SCSI device attributes * @sdev: SCSI device to examine diff --git a/include/linux/libata.h b/include/linux/libata.h index 43f4bcfe9a5f..5fa6f56bba81 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1141,6 +1141,8 @@ extern int ata_std_bios_param(struct scsi_device *sdev, sector_t capacity, int geom[]); 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 void ata_scsi_slave_destroy(struct scsi_device *sdev); extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth); @@ -1390,7 +1392,9 @@ extern const struct attribute_group *ata_common_sdev_groups[]; .proc_name = drv_name, \ .slave_destroy = ata_scsi_slave_destroy, \ .bios_param = ata_std_bios_param, \ - .unlock_native_capacity = ata_scsi_unlock_native_capacity + .unlock_native_capacity = ata_scsi_unlock_native_capacity,\ + .nr_reserved_cmds = 1,\ + .reserved_queuecommand = ata_internal_queuecommand #define ATA_SUBBASE_SHT(drv_name) \ __ATA_BASE_SHT(drv_name), \ -- 2.26.2