From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18BD9C636CA for ; Fri, 16 Jul 2021 12:11:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E947F6128B for ; Fri, 16 Jul 2021 12:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbhGPMOi (ORCPT ); Fri, 16 Jul 2021 08:14:38 -0400 Received: from foss.arm.com ([217.140.110.172]:38236 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232024AbhGPMOi (ORCPT ); Fri, 16 Jul 2021 08:14:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03A52D6E; Fri, 16 Jul 2021 05:11:43 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A2A3F774; Fri, 16 Jul 2021 05:11:39 -0700 (PDT) Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() To: Christoph Hellwig , Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, Marek Szyprowski , Stephen Bates , Martin Oliveira , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Niklas Schnelle , Thomas Bogendoerfer , Michael Ellerman References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> From: Robin Murphy Message-ID: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> Date: Fri, 16 Jul 2021 13:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210716063241.GC13345@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DCB8C07E95 for ; Fri, 16 Jul 2021 12:12:16 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7DC16128B for ; Fri, 16 Jul 2021 12:12:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7DC16128B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GR98t09yPz304V for ; Fri, 16 Jul 2021 22:12:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=robin.murphy@arm.com; receiver=) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4GR98P2Rt2z2yxv for ; Fri, 16 Jul 2021 22:11:46 +1000 (AEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03A52D6E; Fri, 16 Jul 2021 05:11:43 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A2A3F774; Fri, 16 Jul 2021 05:11:39 -0700 (PDT) Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() To: Christoph Hellwig , Logan Gunthorpe References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> From: Robin Murphy Message-ID: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> Date: Fri, 16 Jul 2021 13:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210716063241.GC13345@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, Thomas Bogendoerfer , linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, Niklas Schnelle , "H. Peter Anvin" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Ingo Molnar , Borislav Petkov , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, Thomas Gleixner , Stephen Bates , linuxppc-dev@lists.ozlabs.org, Martin Oliveira , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD92FC07E95 for ; Fri, 16 Jul 2021 12:11:47 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72299613F5 for ; Fri, 16 Jul 2021 12:11:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72299613F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3506A84440; Fri, 16 Jul 2021 12:11:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hqf_BvstC6Vl; Fri, 16 Jul 2021 12:11:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1BAA48443C; Fri, 16 Jul 2021 12:11:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F3A5CC001A; Fri, 16 Jul 2021 12:11:45 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88A73C000E for ; Fri, 16 Jul 2021 12:11:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 749E242476 for ; Fri, 16 Jul 2021 12:11:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fv4ogAupv9_1 for ; Fri, 16 Jul 2021 12:11:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp4.osuosl.org (Postfix) with ESMTP id A8CBE4246C for ; Fri, 16 Jul 2021 12:11:43 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03A52D6E; Fri, 16 Jul 2021 05:11:43 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A2A3F774; Fri, 16 Jul 2021 05:11:39 -0700 (PDT) Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() To: Christoph Hellwig , Logan Gunthorpe References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> From: Robin Murphy Message-ID: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> Date: Fri, 16 Jul 2021 13:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210716063241.GC13345@lst.de> Content-Language: en-GB Cc: linux-s390@vger.kernel.org, Thomas Bogendoerfer , linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, Niklas Schnelle , Michael Ellerman , "H. Peter Anvin" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Ingo Molnar , Borislav Petkov , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, Thomas Gleixner , Stephen Bates , linuxppc-dev@lists.ozlabs.org, Martin Oliveira , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1CABC07E95 for ; Fri, 16 Jul 2021 12:13:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D84F6128B for ; Fri, 16 Jul 2021 12:13:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D84F6128B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HR2GD36r7kXnX+8CsZQ89nkP9PLPtrSsATwAXj2+eGM=; b=bbYcB8/JvwsO8IfRWNqxWMAkEZ 7e4YxZ6HGCO2xaEjEd43rH2LdX8OJM4R8tbgGU5zG94V7Fn+DXiAQS6WIOZLTFgC+FMQZolMVQjLb nJsc4w5oGOD2jZHfq5ybkCjsqtLTh2OCOHZ/B39p/WQAPzMedlpXWkexEaxeBpQXBcLGc6r5DMR2S dIVZJdlS/aXexSs3bWwunhVDndvl5rnFBMGenHJfmr4YIe1iaPbMAyoM105m91zsQo60Hh62C/7Lc YMAjqH7Mfl+fSlf0mlFO2hFbXXtxzFwLzk6Pktf4+FphyTPcSfjf5FOZ2gJHoqJAjJG2/j9wrU0ZG ybC8YHmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m4Mh3-004LFm-Co; Fri, 16 Jul 2021 12:11:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m4Mgz-004LEs-71 for linux-arm-kernel@lists.infradead.org; Fri, 16 Jul 2021 12:11:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03A52D6E; Fri, 16 Jul 2021 05:11:43 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A2A3F774; Fri, 16 Jul 2021 05:11:39 -0700 (PDT) Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() To: Christoph Hellwig , Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, Marek Szyprowski , Stephen Bates , Martin Oliveira , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Niklas Schnelle , Thomas Bogendoerfer , Michael Ellerman References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> From: Robin Murphy Message-ID: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> Date: Fri, 16 Jul 2021 13:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210716063241.GC13345@lst.de> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210716_051145_365971_B711441C X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Murphy Date: Fri, 16 Jul 2021 12:11:33 +0000 Subject: Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg() Message-Id: <98c09e65-35d0-dde5-75fc-e3d99864d078@arm.com> List-Id: References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-15-logang@deltatee.com> <20210716063241.GC13345@lst.de> In-Reply-To: <20210716063241.GC13345@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christoph Hellwig , Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, Marek Szyprowski , Stephen Bates , Martin Oliveira , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Niklas Schnelle , Thomas Bogendoerfer , Michael Ellerman On 2021-07-16 07:32, Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: >> @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, >> iommu_full(dev, pages << PAGE_SHIFT, dir); >> for_each_sg(sg, s, nents, i) >> s->dma_address = DMA_MAPPING_ERROR; >> - return 0; >> + return ret; > > While we're at it - setting the ->dma_address to DMA_MAPPING_ERROR is > not part of the ->map_sg calling convention. Might be worth to fix > up while we're at it. Especially since it's not even zeroing dma_length, which at least is a documented indicator of validity (even if it's not strictly defined for failure cases either). Robin.