Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp215520pxk; Wed, 23 Sep 2020 00:51:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbv6GArADjj/SjIF2kEX9bs6tjYEtOZDpEiINpILkU45VGDKtLkH9GRGYKRbI2JWN6R2n1 X-Received: by 2002:aa7:c158:: with SMTP id r24mr7988534edp.61.1600847469730; Wed, 23 Sep 2020 00:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600847469; cv=none; d=google.com; s=arc-20160816; b=BbGp1rizC3q2hzxz1AbCuVmEiO5ndJbx2jqvIbUvN7LOnZtMaWQ/vXk8AOSJ1+sn86 RXzLCJhPJfYgP6vYSRMgo9pNOBCW9BQJtcO2ut/j1G8WZRmmtv4MnwpGsgwhrKb0q1yK KdHyg7uwFGu+Ck8CycWY2vt/k/3m/zhe6316N8C6qIaESTdFZsIBZ27vmWOrRx13yArE sOw8RCCDxeNWSKa84pQHFNee7WxqNmx+OCtbOPoTB4Hd4PFoxHQ5iXis8gXaR9dpfbMa tR/LuKcctOFyZmJ5ifW3jbz6kIEsloZ+rrJ3BSKZnoKOtNx1Ds0t18mpGONfhcW/iP9t GnJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=afG1zb8/qo7zi+dRFTM5g5y8HdIti04MRIPZVdV66zY=; b=DcyhWpVpEAqOpTpVPzPxscnXA5Fzj9QEPDGv9Q8edYZBotm/jriv8GsmwA75J7cidF EIRueYdAQ3M7Qmhyw7OWcLWqfghVj4WEAMU9hr4eqWsMmhAxvxv8ivPasSn9E+m0gtWX jfl+qVqUwxYsLX/HIr3GqytDPKcL8DimDpvF1ClxOcuUR778x4m7iy4u8VO2ea2i6bAr zzP2zR8iV0x+0l9kn/MO5K+Er1e94lCoyibmjxvhOMiXtjy4JWJIig5pZvoWyXe/C7nS vsSFFpDwFs8tgPhcGjrCwjPTPA8ANN6b54Sb9DmNiM987+EhsYSaWuFy7v0MRoriiKnt jJ7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R3WgXrzt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk16si12473452ejb.676.2020.09.23.00.50.46; Wed, 23 Sep 2020 00:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R3WgXrzt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726402AbgIWHsq (ORCPT + 99 others); Wed, 23 Sep 2020 03:48:46 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:41566 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWHsq (ORCPT ); Wed, 23 Sep 2020 03:48:46 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 08N7mSsg026360; Wed, 23 Sep 2020 02:48:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1600847308; bh=afG1zb8/qo7zi+dRFTM5g5y8HdIti04MRIPZVdV66zY=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=R3WgXrztIVv8HrOVC1at0IvGcTE9vAI/ypuYpsPzjGMAmSDTbYed3Sw7sI/reg3so vALbjfHiHtGAzWeBTDt8yfkkJDenVJmBpHSywckGqADHMEVBu1qnNKbgPMgl5s3gnx rcxfv2KaE5Ysuy2zLXaLawFRXt6LSoBgXVS/2Vro= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 08N7mR5r112799 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 23 Sep 2020 02:48:27 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 23 Sep 2020 02:48:27 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 23 Sep 2020 02:48:27 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 08N7mPUG089691; Wed, 23 Sep 2020 02:48:26 -0500 Subject: Re: [PATCH] crypto: sa2ul: Fix DMA mapping API usage To: Christoph Hellwig CC: , , , , , References: <20200921113846.6973-1-peter.ujfalusi@ti.com> <20200923060246.GA11550@infradead.org> From: Peter Ujfalusi X-Pep-Version: 2.0 Message-ID: <593d5f9d-0629-f01d-4c67-112fc088bb4b@ti.com> Date: Wed, 23 Sep 2020 10:48:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200923060246.GA11550@infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/09/2020 9.02, Christoph Hellwig wrote: > On Mon, Sep 21, 2020 at 02:38:46PM +0300, Peter Ujfalusi wrote: >> Make sure that we call the dma_unmap_sg on the correct scatterlist on >> completion with the correct sg_nents. >> >> We also should be calling dma_sync_sg_for_device() on the tx buffer be= fore >> giving it to the DMA and the dma_sync_sg_for_cpu() should be called on= the >> scatterlist we received the data back. >=20 > You might want to look into using struct sg_table and the DMA mapping > helpers using it to simplify this a bit. It would have simplified it a bit further if the dma_map_sgtable() would have saved the dir we used when mapping (and then dma_unmap_sgtable() would use the stored dir) and had a bool to tell that the mapping was successful. I'll send v2 with the use of sg_table in a bit after running some tests to make sure it is working as expected. It is passing the extended boot time tests on j721e. - P=C3=A9ter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki