Re: [PATCH v2 3/6] crypto/realtek: hash algorithms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, dem 30.12.2022 um 15:55 +0800 schrieb Herbert Xu:
> Markus Stockhausen <markus.stockhausen@xxxxxx> wrote:
> > 
> > +       /* Write back any uncommitted data to memory. */
> > +       if (hreq->buflen)
> > +               dma_sync_single_for_device(cdev->dev,
> > virt_to_phys(hreq->buf),
> > +                                          hreq->buflen,
> > DMA_TO_DEVICE);
> 
> This is not how the DMA API works.  You must not do virt_to_phys.
> Instead use dma_map_single and dma_sync_* is not necessary unless
> you are using the mapping for something else.
> 

DMA is totally new for me so thanks for the hint. 

The simple thing we need to achieve is to flush the CPU caches so that
data becomes visible to the crypto engine. No other hardware specific
DMA commands needed for these SOCs as far as testing shows. I made use
of this because kernel for these devices is compiled with option
CONFIG_DMA_NONCOHERENT=y and I found references to the function in the
caam crypto driver.

Can I just replace the calls with dma_map_single() or do I need other
initialization or cleanup calls?

Best regards.




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux