OSDN Git Service

crypto: inside-secure - Fix Unable to fit even 1 command desc error w/ EIP97
authorPascal van Leeuwen <pascalvanl@gmail.com>
Wed, 11 Dec 2019 16:32:35 +0000 (17:32 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 20 Dec 2019 06:58:33 +0000 (14:58 +0800)
commit098e51e517bc2e5865c520f3eee8bf83dd320e61
treed178bc98e13d412c0bdad67dd2ed7d81303f7775
parenta30637625822e42f67a6a537147b978551288daf
crypto: inside-secure - Fix Unable to fit even 1 command desc error w/ EIP97

Due to the additions of support for modes like AES-CCM and AES-GCM, which
require large command tokens, the size of the descriptor has grown such that
it now does not fit into the descriptor cache of a standard EIP97 anymore.
This means that the driver no longer works on the Marvell Armada 3700LP chip
(as used on e.g. Espressobin) that it has always supported.
Additionally, performance on EIP197's like Marvell A8K may also degrade
due to being able to fit less descriptors in the on-chip cache.
Putting these tokens into the descriptor was really a hack and not how the
design was supposed to be used - resource allocation did not account for it.

So what this patch does, is move the command token out of the descriptor.
To avoid having to allocate buffers on the fly for these command tokens,
they are stuffed in a "shadow ring", which is a circular buffer of fixed
size blocks that runs in lock-step with the descriptor ring. i.e. there is
one token block per descriptor. The descriptor ring itself is then pre-
populated with the pointers to these token blocks so these do not need to
be filled in when building the descriptors later.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@rambus.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel.c
drivers/crypto/inside-secure/safexcel.h
drivers/crypto/inside-secure/safexcel_cipher.c
drivers/crypto/inside-secure/safexcel_hash.c
drivers/crypto/inside-secure/safexcel_ring.c