Skip to contentSkip to conversation

Crypto API

DISCUSSION Dmitry Kasatkin 2 participants 2 messages Jan 13, 2010 – Jan 14, 2010 Crypto API

lore
Share & tools
lore
#0 lore raw

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

maintainer
#1 lore raw
Quoted 10 lines · Dmitry Kasatkin

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,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt