Commit Graph

265 Commits

Author SHA1 Message Date
Gilad Ben-Yossef
b3ec9a6736 staging: ccree: staging: ccree: replace sysfs by debugfs interface
The ccree driver has had a none standard sysfs interface for debugging.
Replace it with a proper debugfs interface.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 15:15:53 +01:00
Gilad Ben-Yossef
31aeaca4d2 staging: ccree: add explicit module init/exit func
We need to do a module global scope init/exit operation to support
the debugfs interface we are about to introduce in the next patch,
so wean the module of the boiler plate saving macro as it will no
longer be sufficient.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 15:15:53 +01:00
Gilad Ben-Yossef
4ba5895bd3 staging: ccree: clean up PM registration
Clean up power management registration.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 15:15:53 +01:00
Gilad Ben-Yossef
16bcccb774 staging: ccree: drop ifdef CONFIG_OF in code
As we already depend on CONFIG_OF via Kconfig no need to
support conditional build without it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 15:15:53 +01:00
Greg Kroah-Hartman
7f9d04bc56 Merge 4.15-rc4 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-18 09:12:51 +01:00
Gilad Ben-Yossef
6dc4d30252 staging: ccree: fix FIPS mgr naming convention
The FIPS manager files were using a naming convention which was
inconsistent (ssi vs. cc) and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
e24673641e staging: ccree: simplify freeing SRAM memory address
The code freeing the SRAM memory address was zeroing the address
on release although there is nothing secret about it. Simplify
the code by simply calling kfree directly.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
7358733a5c staging: ccree: fix sram mgr naming convention
The SRAM manager files were using a naming convention which was
inconsistent (ssi vs. cc) and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
84d39a90b8 staging: ccree: fix buf mgr naming convention
The buffer manager files were using a func naming convention which was
inconsistent (ssi vs. cc) and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
961559f317 staging: ccree: rename vars/structs/enums from ssi_ to cc_
Unify naming convention by renaming all ssi_ vars/structs/enums
and variables to cc_*

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
9021a014bd staging: ccree: rename all DX to CC
Unify naming convention by renaming all DX macros to CC.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
d79da0aad0 staging: ccree: rename all SSI to CC
Unify naming convention by renaming all SSI macros to CC.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
6fe633e909 staging: ccree: remove SSI_CC_HAS_ macros
Remove macro controlling build of various features. This
needs to happen dynamically in registration time.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
60c926321e staging: ccree: drop unsupported MULTI2 mode code
Remove the code support for MULTI2 mode which is not supported
by the current hardware.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
752145b57e staging: ccree: fix ivgen func def coding style
Fix ivgen functions definition indentation according to coding
style guide lines for better code readability

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
a6df50dc0b staging: ccree: fix ivgen naming convention
The ivgen files were using a func naming convention which was
inconsistent (ssi vs. cc), included a long prefix (ssi_ivgen)
and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
200f806475 staging: ccree: fix cipher func def coding style
Fix cipher functions definition indentation according to coding
style guide lines for better code readability

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:38 +01:00
Gilad Ben-Yossef
aebae88197 staging: ccree: fix cipher naming convention
The blkcipher files were using a func naming convention which was
inconsistent (ssi vs. cc), included a long prefix (ssi_ablkcipher)
and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
3d035ae090 staging: ccree: remove cipher sync blkcipher remains
Remove the remains of no longer existing support for running
blkcipher is sync mode.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
fc2a36c065 staging: ccree: fix req mgr func def coding style
Fix request manager functions definition indentation according to coding
style guide lines for better code readability

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
5af4f8349c staging: ccree: fix reg mgr naming convention
The request manager files were using a func naming convention which was
inconsistent (ssi vs. cc), included a useless prefix (ssi_request_mgr)
and often too long.

Make the code more readable by switching to a simpler, consistent naming
convention.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
51eef6c175 staging: ccree: fix func call param indentation
Fix function call parameter indentation according to coding
style guide lines.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
eee23916e3 staging: ccree: simplify expression with local var
Simplify expression by using a local variable for better code
readability.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
04294a1c4c staging: ccree: fix func def and decl coding style
Fix functions definition and declaration indentation according to
coding style guide lines for better code readability

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
00d04e1e89 staging: ccree: shorten parameter name
Shorten parameter name for better code readability

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
08c2addf4a staging: ccree: func params should follow func name
Fix some call sites with func params not following func name in AEAD
code.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
d58b69dd3b staging: ccree: amend hash func def for readability
Func definitions in the hash implementation were did not adhere to
coding style. Fix them for better readability.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
3696e851ce staging: ccree: fix hash naming convention
The hash files were using a naming convention which was inconsistent
(ssi vs. cc), included a useless prefix (ssi_hash) and often used too
long function names producing monster such as
ssi_ahash_get_initial_digest_len_sram_addr() that made the call site
hard to read.

Make the code more readable by switching to a simpler, consistent naming
convention for the file.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Gilad Ben-Yossef
7a457d2399 staging: ccree: remove ahash wrappers
Remove a no longer needed abstraction around ccree hash crypto API
internals that used to allow same ops to be used in synchronous and
asynchronous fashion.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:39:37 +01:00
Dan Carpenter
7679458278 staging: ccree: cleanup a small white space issue
The call to set_flow_mode() was supposed to be on the next line.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08 16:36:14 +01:00
Pravin Shedge
b89da27e10 drivers: staging: remove duplicate includes
These duplicate includes have been found with scripts/checkincludes.pl but
they have been removed manually to avoid removing false positives.

Signed-off-by: Pravin Shedge <pravin.shedge4linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 18:26:05 +01:00
Dan Carpenter
aece090244 staging: ccree: Uninitialized return in ssi_ahash_import()
The return value isn't initialized on some success paths.

Fixes: c5f39d0786 ("staging: ccree: fix leak of import() after init()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 15:49:26 +01:00
Greg Kroah-Hartman
e8cd29b774 Merge Linus's staging merge point into staging-next
This resolves the merge issue pointed out by Stephen in
drivers/iio/adc/meson_saradc.c.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 15:27:17 +01:00
Gilad Ben-Yossef
9911bac0cb staging: ccree: amend aead func def for readability
Func definitions in the aead implementation were did not adhere to
coding style. Fix them for better readability.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
a05db75cfa staging: ccree: fix AEAD func naming convention
The aead files was using a func naming convention which was inconsistent
(ssi vs. cc), included a useless prefix (ssi_aead) and often used
too long function names producing monster func names such as
ssi_aead_gcm_setup_ghash_desc() that made the call site code hard
to read.

Make the code more readable by switching to a simpler, consistent naming
conventionfor all the function defined in the file.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
46df882498 staging: ccree: NULLify backup_info when unused
backup_info field is only allocated for decrypt code path.
The field was not nullified when not used causing a kfree
in an error handling path to attempt to free random
addresses as uncovered in stress testing.

Fixes: 737aed947f ("staging: ccree: save ciphertext for CTS IV")
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
0d527ecc48 staging: ccree: update TODO list
Update the ccree staging TODO list in light of recent work.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
d381f94894 staging: ccree: remove interim DT docs
As proper DT bindings doc where submitted and ACKed,
remove the interim one.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
40def03a52 staging: ccree: remove braces for single statement blocks
Remove braces from single statement if clause.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
1b37844735 staging: ccree: fix indentation of var assignment
Fix indentation of var assignment split across lines for
better readability.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
38b6db1b5d staging: ccree: remove more unnecessary parentheses
The removal of likely/unlikely unearthed some more
unnecessary parentheses. Remove them for better readability.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
9db83b4e4e staging: ccree: remove unproven likely/unlikely
The ccree code made a lot of use of likely/unlikely qualifiers without
proven measurements showing any benefits. Remove them all until we
see what is justified and what is not.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
8977c8248f staging: ccree: remove inline qualifiers
The ccree drivers was marking a lot of big functions in C file as
static inline for no good reason. Remove the inline qualifier from
any but the few truly single line functions.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 09:55:15 +01:00
Gilad Ben-Yossef
c5f39d0786 staging: ccree: fix leak of import() after init()
crypto_ahash_import() may be called either after
crypto_ahash_init() or without such call. Right now
we always internally call init() as part of
import(), thus leaking memory and mappings if the
user has already called init() herself.

Fix this by only calling init() internally if the
state is not already initialized.

Fixes: commit 454527d0d9 ("staging: ccree: fix hash import/export")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 14:36:45 +01:00
Arvind Yadav
8b075122ee staging: ccree: Remove a attribute group from a kobject
All attribute group created during sys_init_dir() should be removed
in sys_free_dir()

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 14:20:50 +01:00
Colin Ian King
217f93366e staging: ccree: fix incorrect indentation of break statement
The break statement is indented one level too many, fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00
Gilad Ben-Yossef
d5a2a81868 staging: ccree: drop unused macro
The CC_REG_NAME macro is unused. Drop it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00
Gilad Ben-Yossef
c804f35992 staging: ccree: use local vars for readability
Refactor cc_map_aead_request() to use local vars for addresses
for better readability of code.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00
Gilad Ben-Yossef
d59c6d9cee staging: ccree: replace msleep with a completion
When the driver would try to queue commands to the HW FIFO but ran out of
slots it would use msleep as a delay until the FIFO would clear. This is
messy and not accurate.

Replace the msleep with a proper completion on the event of command
completion which should indicate at least one slot is free.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00
Gilad Ben-Yossef
5a83a3937b staging: ccree: remove unused field
Field monitor_null_cycles of struct drvdata was not being used.
Remove it.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00