Linux cryptographic layer development
 help / color / mirror / Atom feed
* Crypto API
@ 2010-01-13  6:28 Dmitry Kasatkin
  2010-01-14  0:40 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kasatkin @ 2010-01-13  6:28 UTC (permalink / raw)
  To: linux-crypto

Hi,

I develop some drivers for crypto HW and met some difficulties.
Some algorithm functions are called behind crypto_kmap()

data = crypto_kmap(sg_page(sg), 0);

It will do inc_preempt_count();

I try to use DMA controller to perform memory transfers and try to use
wait_for_completion()

But of course  it gives

BUG: sleeping function called from invalid context at kernel/sched.c:5786

What is the best way to handle such case?

Thanks,
Dmitry



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Crypto API
  2010-01-13  6:28 Crypto API Dmitry Kasatkin
@ 2010-01-14  0:40 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2010-01-14  0:40 UTC (permalink / raw)
  To: Dmitry Kasatkin; +Cc: linux-crypto

Dmitry Kasatkin <dmitry.kasatkin@nokia.com> wrote:
> 
> I develop some drivers for crypto HW and met some difficulties.
> Some algorithm functions are called behind crypto_kmap()
> 
> data = crypto_kmap(sg_page(sg), 0);
> 
> It will do inc_preempt_count();
> 
> I try to use DMA controller to perform memory transfers and try to use
> wait_for_completion()

crypto_kmap is for software crypto.  If you're doing DMA, you
shouldn't use it.

Please take a look at other crypto drivers under drivers/crypto
as to how DMA should be implemented.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-14  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13  6:28 Crypto API Dmitry Kasatkin
2010-01-14  0:40 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox