Messages in this thread | | | Subject | Re: [PATCH] crypto: sa2ul: Fix DMA mapping API usage | From | Peter Ujfalusi <> | Date | Wed, 23 Sep 2020 10:48:36 +0300 |
| |
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 before >> giving it to the DMA and the dma_sync_sg_for_cpu() should be called on the >> scatterlist we received the data back. > > 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éter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
| |