Commit Graph

338 Commits

Author SHA1 Message Date
Rohit Vaswani
a76e99abc5 Merge branch 'Linux 3.0.21' into msm-3.0
Merge Upstream's stable 3.0.21 branch into msm-3.0
This consists 814 commits and some merge conflicts.

The merge conflicts are because of some local changes to
msm-3.0 as well as some conflicts between google's tree and
the upstream tree.

Conflicts:
	arch/arm/kernel/head.S
	drivers/bluetooth/ath3k.c
	drivers/bluetooth/btusb.c
	drivers/mmc/core/core.c
	drivers/tty/serial/serial_core.c
	drivers/usb/host/ehci-hub.c
	drivers/usb/serial/qcserial.c
	fs/namespace.c
	fs/proc/base.c

Change-Id: I62e2edbe213f84915e27f8cd6e4f6ce23db22a21
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2012-03-30 00:09:34 -07:00
Linux Build Service Account
5156c5a8d9 Merge "crypto: remove redundant CRYPTO_CONFIG setting" into msm-3.0 2012-03-09 00:03:12 -08:00
Mona Hossain
313f4ec765 crypto: Add error messages
When request for scaling bus fails, log error message.
Also do not return error on failing to service the
bus scaling request.

Change-Id: Ia893b3fe1b2b7b644ac2f44ed81fb2e33d451b4b
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2012-03-06 15:06:51 -08:00
Mona Hossain
e7585295d3 crypto: remove redundant CRYPTO_CONFIG setting
Remove config_ce_engine. This is already being done in
probe ce callback function.

Change-Id: I5d4dea54b4b28258c2ed0ab2b0e65fd469fb09e7
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2012-02-23 11:15:16 -08:00
Ramesh Masavarapu
9e1c0a0270 crypto: Add support for larger ce block size.
Add support for CE block size to 64 bytes on MDM9x15 target.
The modem on MDM9x15 did not support 64byte crci on data mover till now.

Change-Id: I4ea08f9e6097a17280763b9c0ca063de19a5c0f4
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2012-02-17 08:06:06 -08:00
Ramesh Masavarapu
49259689fe crypto: Add bus scaling request.
Add bus bandwidth request in crypto driver modules.
Add bus scaling request information to platform data files.
Currently the support for bandwidth request is enabled and tested on
msm8960 only.

Change-Id: I77edb827b1633218405cecf3a494c13b7b982c05
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-12-20 23:46:34 -07:00
Phil Sutter
e84ce11bd0 crypto: mv_cesa - fix hashing of chunks > 1920 bytes
commit 274252862f386b7868f35bf5ceaa5391a8ccfdf3 upstream.

This was broken by commit 7759995c75 (yes,
myself). The basic problem here is since the digest state is only saved
after the last chunk, the state array is only valid when handling the
first chunk of the next buffer. Broken since linux-3.0.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:20 -08:00
Mona Hossain
b8db743156 crypto: Fix Cipher Test Failures
This  patch fixes 2 issues that was causing cipher operation
failure

(1) Status register reflecting an SW_ERR (ACCESS_VIOL bit set)

Status register needed to be cleared initially before
starting any operation

(2) Occasional failure observed in some cipher operation(s)
(encryption and/or decryption) for modes that require
reading in the CNTR IV register values after an
operation is complete.

These failures show up when doing a 3DES-CBC operation.
But there is potential for it to raise its head when doing
DES-CBC, AES-CBC or AES_XTS modes as well (since all of this
modes require reading in the CNTR IV register).

The CNTR IV register was being read after writing data to
the IN FIFO.  There is a potential for encryption (or decryption)
operations to not have completed fully on all the data in the FIFO
before the IV register is read, resulting in incorrect IV value.
The fix is to read the CNTR IV register after the operation
is guranteed to have completed sucessfully.  This is done after
reading data out of DATA OUT FIFO.

Change-Id: Icef0d544ecb463cea4be978c3d2809049b92da05
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-11-22 11:25:17 -07:00
Ramesh Masavarapu
2831191a51 msm: 8064: Enable crypto engine.
-add new clock - ce3_core_src_clk to 8064 target.
-ce3_p_clk and ce3_core_clk are derived from ce3_core_src_clk.
-ce3 core src clock expects that the driver(qce40) set the clock
 rate before the clock is enabled.
-set ce3_core_src_clk rate to 100mhz.
-add new DMA channels for APQ8064.

Change-Id: I3f0897b43d5d58a60a1df4f61a241868b8b9a926
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-11-21 11:52:24 -08:00
Ramesh Masavarapu
72077200b0 crypto: Remove featurization of CE config register.
This change makes the configuration of ce register target
agnostic.
 -On targets where the register is xpu protected, a 0 value
is returned and the register has already been configured.
 -On targets when a non-zero value is returned, the driver
configures the register.

Change-Id: Icd1888d6d87d19c52952c27d277bb4b787d72a93
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-11-03 09:13:32 -07:00
Ramesh Masavarapu
c52c23783d crypto: Added checks for initializations and buffer overflow.
Added checks for
 -Initializations of alg and mode values in qcedev.
 -Buffer overflow in qcrypto.

CRs-fixed: 313705
Change-Id: I20e285679af4967f989427ea50eb5a287df28cca
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-10-28 13:19:14 -07:00
Ramesh Masavarapu
a63ff1e60a crypto: Fixed compilation warnings when PMEM is not defined.
Fixed compilation warnings when PMEM is not defined.

Change-Id: Ifdb7c10fabaa2e05737497dbed89457906e8f459
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-10-20 16:43:09 -07:00
Ramesh Masavarapu
fa679d9a8a crypto: Adding crypto MSM9615.
Added the configuration settings for supporting MSM9615.

-MSM9615 does not have TZ(trust zone) hence DM configurations are done
when checking the target.
-MSM9615 does not support PMEM and hence pmem related functions are
featurized under PMEM feature - CONFIG_ANDROID_PMEM
- Added changes to Kconfig to have QCE40 built for MSM9615.

Change-Id: If2946463cc1869f5b0014c68d8e19816cedc8a3a
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-10-17 14:32:17 -06:00
Mona Hossain
2563cbc59a crypto: Clean-up support for 32KB+ packet
For some large (32KB+) packets for AES CCM algorithms,
depending on assoc data length, padding, actual data,
the ce_in_dst_desc, ce_out_src_desc are found to be
incorrect. This patch clears up the supports for 32KB+
and makes it more generic (not cipher/hash specific)

Relocate where the following are being processed
for 32KB+ packets
- ce_in_dst_desc from chain_sg_buffer_in() to ce_in_final()
- ce_out_src_desc from chain_sg_buffer_out() to ce_out_final()

With the above the AES-CCM algorithms passes all scenarios.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:19:40 -07:00
Mona Hossain
6f8108f0d0 crypto: Fix failure to process F8, F9 request
This patch clears up the supports for 32KB+ packet
and makes it more generic (not cipher/hash specific)

This is done by relocating where the following are being
processed for 32KB+ packets
- ce_in_dst_desc: from chain_sg_buffer_in() to ce_in_final()
- ce_out_src_desc: from chain_sg_buffer_out() to ce_out_final()

Furthermore, the descriptor length for the last (single or
multiple descriptors) entry of the above mentioned descriptor
lists is not set correctly.

With the above fixes, f8, f9 and AEAD operations (on supported
targets) is functioning properly.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:19:32 -07:00
Mona Hossain
5f5dde17cb crypto: Add support for larger ce block size
Adds support for CE block size larger than 16 bytes
by setting appropriate bits in CRYPTO_CONFIG register.
NOTE:  This bits are functional in rev 4.2 and higher
of the CE hardware. Setting the bits in 4.0 HW does not
do anything.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:19:17 -07:00
Mona Hossain
962ff20afa crypto: Remove configuration of CRYPTO_CONFIG register
CRYPTO_CONFIG is configured by secure code and the register
is XPU protected. Writing to this register has no effect.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:19:16 -07:00
Ramesh Masavarapu
c1d2b68990 crypto: Driver cleanup
Removed printk messages and replaced them with corresponding
pr_err, pr_debug messages. Added log messages when memory
allocation fails.

Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
2011-10-03 16:18:59 -07:00
Mona Hossain
3b574d8ba4 crypto: Remove direct access to crypto registers
Remove direct access to CRYPTO register when configuring
for a cipher or authentication operation. Create DM  commands
and command pointer list to configure registers.

This change is needed to allow multiple clients from different
execution environment use the same CE1 hardware. DM synchronizes
the request by blocking any access to the CE hardware by any
other pair of DM channels (used by other EE clients)

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:18:53 -07:00
Mona Hossain
390d92e152 crypto: Fix AES_CCM encryption/decryption failure
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:18:18 -07:00
Jeff Ohlstein
dc39f977d2 msm: dma: remove crci conflict checking
The crci conflict checking code was designed for a system where a crci's
mux could be changed at runtime. In reality, our chips configure these
statically, so it is not necessary.

Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
2011-10-03 16:18:14 -07:00
Matt Wagantall
c4b3a4dff1 crypto: Register device with clock driver and rename clocks
Rename the clocks per the new naming convention under which
similarly named clocks are distinguished between using their
associated device's name and ID.

Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
2011-10-03 16:18:06 -07:00
Mona Hossain
e1b13f8914 crypto: Fix memory leak
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:17:30 -07:00
Mona Hossain
d0c032ba69 crypto: Fix memory allocated for ignoring data
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:16:12 -07:00
Mona Hossain
d90ea0e597 crypto: Add support for 32KB+ packets in QCE
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:15:38 -07:00
Mona Hossain
5c8ea1f266 crypto: Clean up header file inclusion and location
- Create a flat directory structure for hw crypto modules
  that includes all source and all header files.
- Remove msm/inc directory
- Relocate qcedev.h header file to include/linux

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 16:14:07 -07:00
Mona Hossain
087c60b990 crypto: Set a unique handle when opening qce device
- Define a new handle data structure "qcedev_handle"
  This structures holds internal context data
  "qcedev_sha_ctxt" and pointer to "qcedev_control"
- Allocate memory for the hanlde, each time a client
  opens the device. Thereby, ensuring a unique handle
  for each client.
- Use the new handle for each operation (instead of
  qcedev_control pointer)
- Remove the internal sha context data structure
  "qcedev_sha_ctx" from the "qcedev_sha_op_req".
  This is now correctly tied to each handle.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 10:27:12 -07:00
Mona Hossain
650c22c765 crypto: Fix race conditons and synchronization issues
- Fix locking mechanism: Add ref count for locking and
  protect ce lock reference count
- Fix race conditions with processing sha request.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 10:26:25 -07:00
Mona Hossain
451cf98b02 crypto: Fix referencing dead pointer
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 10:25:32 -07:00
Mona Hossain
a8657d80cc crypto: Fix memory leak when clk enabling fails
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2011-10-03 09:59:02 -07:00
Bryan Huntsman
3f2bc4d6eb Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-10-03 09:57:10 -07:00
Kim Phillips
a18b989a5c crypto: caam - fix operator precedence in shared descriptor allocation
setkey allocates 16 bytes (CAAM_CMD_SZ *
DESC_AEAD_SHARED_TEXT_LEN) shy of what is needed to
store the shared descriptor, resulting in memory
corruption.  Fix this.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-06-30 07:43:27 +08:00
Holger Dengler
cf2d007bd4 [S390] ap: skip device registration on type probe failure
The registration of an ap device will be skipped, if the device type
probing fails.
Add names of current crypto adapters to the Kconfig help.

Signed-off-by: Holger Dengler <hd@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2011-05-23 10:24:29 +02:00
Linus Torvalds
052497553e Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (45 commits)
  crypto: caam - add support for sha512 variants of existing AEAD algorithms
  crypto: caam - remove unused authkeylen from caam_ctx
  crypto: caam - fix decryption shared vs. non-shared key setting
  crypto: caam - platform_bus_type migration
  crypto: aesni-intel - fix aesni build on i386
  crypto: aesni-intel - Merge with fpu.ko
  crypto: mv_cesa - make count_sgs() null-pointer proof
  crypto: mv_cesa - copy remaining bytes to SRAM only when needed
  crypto: mv_cesa - move digest state initialisation to a better place
  crypto: mv_cesa - fill inner/outer IV fields only in HMAC case
  crypto: mv_cesa - refactor copy_src_to_buf()
  crypto: mv_cesa - no need to save digest state after the last chunk
  crypto: mv_cesa - print a warning when registration of AES algos fail
  crypto: mv_cesa - drop this call to mv_hash_final from mv_hash_finup
  crypto: mv_cesa - the descriptor pointer register needs to be set just once
  crypto: mv_cesa - use ablkcipher_request_cast instead of the manual container_of
  crypto: caam - fix printk recursion for long error texts
  crypto: caam - remove unused keylen from session context
  hwrng: amd - enable AMD hw rnd driver for Maple PPC boards
  hwrng: amd - manage resource allocation
  ...
2011-05-20 17:24:14 -07:00
Kim Phillips
4427b1b4ec crypto: caam - add support for sha512 variants of existing AEAD algorithms
In doing so, sha512 sized keys would not fit with the current
descriptor inlining mechanism, so we now calculate whether keys
should be referenced instead by pointers in the shared descriptor.

also, use symbols for descriptor text lengths, and, ahem, unmap and
free key i/o memory in cra_exit.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-19 14:38:00 +10:00
Kim Phillips
66664487b1 crypto: caam - remove unused authkeylen from caam_ctx
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-19 14:37:59 +10:00
Kim Phillips
ddbb80884a crypto: caam - fix decryption shared vs. non-shared key setting
Key sharing is enabled by default in the shared descriptor.

Using CBC decrypt, AES has to alter the key in order to decrypt.
During high traffic decryption rates, i.e, when sharing starts to
take place, we need to use a different OPERATION option to tell AES
that the key was already altered by the PRIOR descriptor - we need
the following kind of logic:

if ( shared )
    operation where AES uses decryption key (DK=1)
else
    operation where AES uses encryption key (DK=0)

this patch implements this logic using a conditional and
a non-conditional local jump within the decryption job
descriptor.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-19 14:37:59 +10:00
Kim Phillips
2930d49768 crypto: caam - platform_bus_type migration
this fixes a build error since cryptodev-2.6 got rebased
to include commit d714d1979d
"dt: eliminate of_platform_driver shim code".

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-19 14:37:58 +10:00
Phil Sutter
6ef84509f3 crypto: mv_cesa - make count_sgs() null-pointer proof
This also makes the dummy scatterlist in mv_hash_final() needless, so
drop it.

XXX: should this routine be made pulicly available? There are probably
other users with their own implementations.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:22 +10:00
Phil Sutter
7759995c75 crypto: mv_cesa - copy remaining bytes to SRAM only when needed
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:21 +10:00
Phil Sutter
8652348754 crypto: mv_cesa - move digest state initialisation to a better place
On one hand, the digest state registers need to be set only when
actually using the crypto engine. On the other hand, there is a check
for ctx->first_hash in mv_process_hash_current() already, so use that.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:20 +10:00
Phil Sutter
cc8d35057c crypto: mv_cesa - fill inner/outer IV fields only in HMAC case
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:19 +10:00
Phil Sutter
6677a776cf crypto: mv_cesa - refactor copy_src_to_buf()
The main goal was to have it not do anything when a zero len parameter
was being passed (which could lead to a null pointer dereference, as in
this case p->src_sg is null, either). Using the min() macro, the lower
part of the loop gets simpler, too.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:18 +10:00
Phil Sutter
7a1c6bcf26 crypto: mv_cesa - no need to save digest state after the last chunk
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:17 +10:00
Phil Sutter
2a025f5dfc crypto: mv_cesa - print a warning when registration of AES algos fail
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:16 +10:00
Phil Sutter
811e6ed623 crypto: mv_cesa - drop this call to mv_hash_final from mv_hash_finup
The code in mv_hash_final is actually a superset of mv_hash_finup's
body. Since the driver works fine without, drop it.

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:15 +10:00
Phil Sutter
99db3eacac crypto: mv_cesa - the descriptor pointer register needs to be set just once
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:14 +10:00
Phil Sutter
042e9e7356 crypto: mv_cesa - use ablkcipher_request_cast instead of the manual container_of
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-11 15:06:13 +10:00
Kim Phillips
de2954d664 crypto: caam - fix printk recursion for long error texts
during recent descriptor development, an Invalid Sequence Command
error triggered a:

BUG: recent printk recursion!

due to insufficient memory allocated for the error text.

The Invalid Sequence Command error text is the longest.
The length of the maximum error string is computed as
the sum of:

"DECO: ": 6
"jump tgt desc idx 255: ": 23
Invalid Sequence Command text: 272
zero termination character: 1

i.e, 302 characters.

Define this maximum error string length in error.h and fix
caam_jr_strstatus callsites.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-04 15:15:06 +10:00
Kim Phillips
701af31ce0 crypto: caam - remove unused keylen from session context
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-05-04 15:15:05 +10:00