From patchwork Tue Oct 25 10:32:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 10700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp917296wru; Tue, 25 Oct 2022 03:14:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gKdstP0PHx8e1BJJC1KhFTYesAN1PF0fh0Izicrs3aFyXtuetAJILlzh6bT5xu72Y5ViO X-Received: by 2002:aa7:9dcb:0:b0:565:89a8:c708 with SMTP id g11-20020aa79dcb000000b0056589a8c708mr38606001pfq.4.1666692868035; Tue, 25 Oct 2022 03:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666692868; cv=none; d=google.com; s=arc-20160816; b=iSHvlzcAJnjATMbIC9oY2ybPdnrTUuOma3k5VRtgPYwt0M0zjs8lpS7rfkSimPhx7U mRGxKIprnUf3F5zeLMdOIDdoLRA5r0LPuhICOAW/kr5Gjazf06e3+qIX14E18BbtVxDm lkHNqsfqI0JYy4GybwUQUm+I5t2dToLa6LbbtEILbb0IO05ibtNe+HnkCLcxnm/Tjv9Q dd/9l1D1rQHgf1VltvR2Hl5ak+q2P3MsnbztQITOydSicpD1p6m0GruaQRiX/rwKWJSW mvWNn7CEKyvHqgtsCP4CTqtt/CGnvqxk2quXDBb4jC5NrkEURHLhGeOd8O0Q4viutm88 4KNw== 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=yKftcTuMP1lpUQsxRoeRUgpzkno5mZnny31oRfO5Y0A=; b=czo1CccrghGRFYZVFXH39W2Nej+f5Q3hnFETsGCSU8L/jQqiVDQUJtFEpOm4+z8KNe YJAlMQE9IRpjEIqPpO/UZe5y6LixnOYUxmWbSxgBnJ2xrcIaDK9dr+RstxqnLKRYu1gE KzguLElskSjHkehZDuAerLbeZenOjeyHesGNtx1Lk0Hs2WYkJDddHgHEzGzTnhW4yFhx RHTgoYr1DiLv/wjImLvUfG1l0nAkXkse8qwF/vgh19ERKvU9YYYm3lQWBDWjKgEL0b1G vskNIbl5cHQ9gu92lXbvelSk4JYO9d5H+Ms80kxN54NH5LXiLMOGWKyGfjP+Lg0v9maH dKvg== 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 x21-20020a631715000000b0046f18bdf887si2369003pgl.476.2022.10.25.03.14.15; Tue, 25 Oct 2022 03:14:28 -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 S231855AbiJYKLY (ORCPT + 99 others); Tue, 25 Oct 2022 06:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbiJYKKi (ORCPT ); Tue, 25 Oct 2022 06:10:38 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6976B11F487; Tue, 25 Oct 2022 03:03:24 -0700 (PDT) Received: from fraeml708-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MxS942Vhvz689yL; Tue, 25 Oct 2022 17:59:52 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml708-chm.china.huawei.com (10.206.15.36) 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 12:03:22 +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:19 +0100 From: John Garry To: , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH RFC v3 2/7] ata: libata-scsi: Add ata_internal_queuecommand() Date: Tue, 25 Oct 2022 18:32:51 +0800 Message-ID: <1666693976-181094-3-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?1747654140507647861?= X-GMAIL-MSGID: =?utf-8?q?1747654140507647861?= Add callback to queue reserved commands - call it "internal" as this is what libata uses. Also add it to the base ATA SHT. Signed-off-by: John Garry --- drivers/ata/libata-scsi.c | 14 ++++++++++++++ include/linux/libata.h | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 30d7c90b0c35..0d6f37d80137 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1118,6 +1118,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 8938b584520f..f09c5dca16ce 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); @@ -1391,7 +1393,8 @@ extern const struct attribute_group *ata_common_sdev_groups[]; .slave_destroy = ata_scsi_slave_destroy, \ .bios_param = ata_std_bios_param, \ .unlock_native_capacity = ata_scsi_unlock_native_capacity,\ - .max_sectors = ATA_MAX_SECTORS_LBA48 + .max_sectors = ATA_MAX_SECTORS_LBA48,\ + .reserved_queuecommand = ata_internal_queuecommand #define ATA_SUBBASE_SHT(drv_name) \ __ATA_BASE_SHT(drv_name), \