Commit Graph

119 Commits

Author SHA1 Message Date
Gilad Ben-Yossef fb0cb50d6e staging: ccree: fix block comment style
Align block comments according to coding style.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 492ddcbb21 staging: ccree: remove/add (un)needed blank lines
Remove or add blank lines as needed to match coding style.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef e8e5110e6b staging: ccree: remove unused type CCFipsSyncStatus_t
The CCFipsSyncStatus_t type was not being used in the code.
Remove it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef dff5e61e90 staging: ccree: remove custom type ssi_fips_state_t
Replace custom type ssi_fips_state_t with underlying enum.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 8422f1120b staging: ccree: remove custom type ssi_fips_error_t
Replace custom type ssi_fips_error_t with underlying enum.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 1de8f59fa4 staging: ccree: remove custom type tdes_keys_t
Replace references to type tdes_keys_t with struct tdes_keys.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef d32a0b6db8 staging: ccree: fix pointer location
Fix location of pointer in variables definitions and dereference.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 6191eb1dc8 staging: ccree: remove comparisons to NULL
Remove explicit comparisons to NULL in ccree driver.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 44c891af57 staging: ccree: fix unmatched if/else braces
Fix mismatched braces between if and else.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef a8f6cbaad2 staging: ccree: no need for braces for single statements
Fix several cases of needless braces around single statement blocks.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef b4562b61cf staging: ccree: remove redundant blank lines
Remove redundant blank lines in brace blocks

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:51 +02:00
Gilad Ben-Yossef 8683e6272d staging: ccree: fix else placement
Fix cases where the else clause was not located correctly after the if
brace.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:50 +02:00
Gilad Ben-Yossef 7331916cff staging: ccree: drop comparsion to true/false
Fix cases in ccree where explicit comparsion to true/false
was made.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:50 +02:00
Gilad Ben-Yossef e7258b6a22 staging: ccree: fix missing or redundant spaces
Add and/or remove redundant and/or missing spaces in ccree source

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29 16:38:50 +02:00
Gilad Ben-Yossef 0f2f02d1b5 staging: ccree: use signal safe completion wait
We were waiting for a completion notification of HW DMA
operation using an interruptible wait which can result
in data corruption if a signal interrupted us while
DMA was not yet completed.

Fix this by moving to uninterrupted wait.

Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver").

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:15 +02:00
Gilad Ben-Yossef d255b343f5 staging: ccree: add DT bus coherency detection
The ccree driver has build time configurable support
to work on top of coherent (e.g. ACP) vs. none coherent bus
connections. Turn it to run-time configurable option
based on device tree.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:15 +02:00
Gilad Ben-Yossef 675ef02fcb staging: ccree: add clock management support
Some SoC which implement CryptoCell have a dedicated clock
tied to it, some do not. Implement clock support if exists
based on device tree data and tie power management to it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:15 +02:00
Gilad Ben-Yossef b091fadb12 staging: ccree: remove unused function
The function set_ack_last was not used anywhere. Remove it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:15 +02:00
Gilad Ben-Yossef c51831be99 staging: ccree: register setkey for none hash macs
The original ccree driver was registering a useless setkey
method even for non-MAC hash transformations. Somewhere
around v4.9 a check was added that failed hash operations
if a setkey method was registered but was not called,
so during the initial upstream port code was added to
only register the setkey method for MAC type hash transform.

Unfortunately, the ccree driver also registers non-hash based
MAC transforms and the code had a logic error that stopped
it registering a setkey callback even for those, thus rendering
them useless.

This commit fixes the logic mistake, thus correctly registering
a setkey method only for MAC transformations, leaving it out
for non-MAC ones, whether they are hash based on not.

Fixes: 50cfbbb7e6 ("staging: ccree: add ahash support").

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:15 +02:00
Gilad Ben-Yossef 454527d0d9 staging: ccree: fix hash import/export
Hash import and export was saving and restoring the wrong context
and therefore disabled. Fix it by restoring intermediate digest
and additional state needed.

The hash and mac transform now pass testmgr partial hash tests.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-25 16:29:14 +02:00
Jeremy Sowden d4f3d4b150 staging: ccree: removed spaces after opening parentheses.
Removed spaces after opening parentheses in ssi_ivgen.c.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:27:28 +08:00
Derek Robson 4f71fecd78 staging: ccree: - style fix, spaces and tabs
Changed code indent to be tabs across whole driver
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:27:10 +08:00
Jhih-Ming Hunag 2bd2515130 staging: ccree: move else to follow close brace '}'
Move else to follow close brace '}'

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Jhih-Ming Hunag fe2d182332 staging: ccree: remove improper space
Remove improper space.

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Jhih-Ming Hunag 134a8ca1c9 staging: ccree: move * to close variable name instead of type.
Move * to close variable name instead of type.

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Jhih-Ming Hunag 4e09b077a0 staging: ccree: move '{' to next line for function.
Move '{' to next line for function.

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Jhih-Ming Hunag b803d57df5 staging: ccree: move brace { to previous line for if.
Move brace { to previous line for if.

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Jhih-Ming Hunag b9778d910d Staging: ccree: add space around comma, brace and operator.
Add space around comma, brace, and opertor.

Signed-off-by: Jhih-Ming Hunag <fbihjmeric@gmail.com>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:26:26 +08:00
Greg Kroah-Hartman 7bf1e44f86 Merge 4.12-rc5 into staging-next
We want the IIO fixes and other staging driver fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-12 08:20:47 +02:00
Gilad Ben-Yossef 26f4b1f7a8 staging: ccree: fix buffer copy
Fix a bug where the copying of scatterlist buffers incorrectly
ignored bytes to skip in a scatterlist and ended 1 byte short.

This fixes testmgr hmac and hash test failures currently obscured
by hash import/export not being supported.

Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver").

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-06 16:23:27 +02:00
Colin Ian King 1d80d1bd17 staging: ccree: fix spelling mistake: "chanined" -> "chained"
Trivial fix to spelling mistake in SSI_LOG_ERR message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:17:42 +02:00
Gilad Ben-Yossef b52fb14072 staging: ccree: remove descriptor context definitions
Remove definitions of descriptor context which are not used
in the driver.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:26 +02:00
Gilad Ben-Yossef da38a83ba7 staging: ccree: remove last remnants of sblkcipher
The cipher code had some left overs of an attempt to support
synch. cipher API with the HW. Remove the code handling this.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:26 +02:00
Gilad Ben-Yossef d3eff5722c staging: ccree: remove last remnants of sash algo
The hash code had some left overs from a misguided attempt
to support shash API with the HW. Remove the code handling
this.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:26 +02:00
Gilad Ben-Yossef 087fabd1cd staging: ccree: fix wrong whitespace usage
Some of the register definition files had none
kernel coding style usage of tabs vs. spaces in macro
definitions. This patch fixes them.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:26 +02:00
Gilad Ben-Yossef ee15d16946 staging: ccree: remove spurious blank line
Remove spurious blank line from cc_regs.h

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:26 +02:00
Gilad Ben-Yossef 1c0cccd9aa staging: ccree: remove dead code
Remove some unused macro definitions from hash definitions.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef ef78342266 staging: ccree: drop no longer used macro
MSB64 macro is no longer used or needed. Drop it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 84d69a7b03 staging: ccree: use snake_case for hash enums
Hash enum were named using CamelCase, move over to snake_case.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef c928f1d7cb staging: ccree: remove unused struct
struct SepHashPrivateContext is not used anywhere in the code.
Remove it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef ed7443911e staging: ccree: remove custom bitfield macros
With all users removed or re-factored to use the standard
kernel bit fields ops we can now drop the custom
bit field macros.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 37a99c9831 staging: ccree: move request_mgr to generic bitfield ops
request_mgr was using custom bit field macros. move over to
standard kernel bitfield ops.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 7f821f0c6f staging: ccree: remove cycle count debug support
The ccree driver had support for rough performance debugging
via cycle counting which has bit rotted and can easily be
replcaed with perf. Remove it from the driver.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 841d1d806c staging: ccree: remove unused debug macros
The DUMP_SGL() and DUMP_MLLI_TABLE() debug macros were
defined but not used anywhere and the difference of their
definitions for debug vs. none debug indicated this has
not being used in a while.

Remove the dead code.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef b953295421 staging: ccree: move M/LLI defines to header file
A bunch of macros used to define M/LLI descriptors where
being defined in the C file. Move them over to private
include file where other relevant definitions are stored.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef c6f7f2f459 staging: ccree: refactor LLI access macros
The Linked List Item descriptors were being programmed via
a set of macros which suffer a few problems:
- Use of macros rather than inline leaves out parameter type
  checking and risks multiple macro parameter evaluation side
  effects.
- Implemented via hand rolled versions of bitfield operations.

This patch refactors LLI programming into a set of
of inline functions using generic kernel bitfield access
infrastructure, thus resolving the above issues and opening
the way later on to drop the hand rolled bitfield macros
once additional users are dropped in later patches in the
series.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 13ddf62156 staging: ccree: remove 48 bit dma addr sim
Remove no longer needed code used to simulate 48 bit dma addresses
on 32 bit platforms for development purposes.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 8b64e512de staging: ccree: refactor HW command FIFO access
The programming of the HW command FIFO in ccree was done via
a set of macros which suffer a few problems:
- Use of macros rather than inline leaves out parameter type
  checking and risks multiple macro parameter evaluation side
  effects.
- Implemented via hand rolled versions of bitfield operations.

This patch refactors the HW command queue access into a set
of inline functions using generic kernel bitfield access
infrastructure, thus resolving the above issues and opening
the way later on to drop the hand rolled bitfield macros
once additional users are dropped in later patches in the
series.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Gilad Ben-Yossef 6562e7db13 staging: ccree: replace bit shift with BIT macro
CC_CTX_SIZE was being defined using a hand rolled bit shift operation.
Replace with use of BIT macro.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:16:25 +02:00
Derek Robson ed5210cb07 Drivers: ccree: cc_hw_queue_defs.h - align block comments
Fixed block comment alignment, Style fix only
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03 17:53:19 +09:00