summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ccree
Commit message (Collapse)AuthorAgeFilesLines
* staging: ccree: Fix missing blank line after declarationKamal Heib2018-01-251-0/+1
| | | | | | | | | | | Fix the following warning found by checkpatch.pl WARNING: Missing a blank line after declarations + struct cc_cipher_handle *blkcipher_handle = drvdata->blkcipher_handle; + if (blkcipher_handle) { Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix memory leaks in cc_ivgen_initColin Ian King2018-01-151-2/+2
| | | | | | | | | | | | | | | The current error exit path in function cc_ivgen_init via label 'out' free's resources from the drvdata->ivgen_handle context. However, drvdata->ivgen_handle has not been assigned to the context ivgen_ctx at this point, so the resources are not freed. Fix this by setting drvdata->ivgen_handle to ivgen_ctx as early as possible so that the clean up error exit return path can free the resources. Detected by CoveritScan, CID#1463795 ("Resource leak") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove redundant dev_err call in init_cc_resources()Wei Yongjun2018-01-151-3/+1Star
| | | | | | | | | There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: don't break lines unnecessarilyDan Carpenter2018-01-157-23/+12Star
| | | | | | | | These lines are less than 80 characters so we don't need to break them up into chunks. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: dma mask is type u64Gilad Ben-Yossef2018-01-091-2/+2
| | | | | | | | | The dma mask var was defined as dma_addr_t but should be u64. This showed as a sparse warning when building for 32 bit. Fix it by changing type to u64 and drop the cast. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: make stub function static inlineGilad Ben-Yossef2018-01-091-4/+4
| | | | | | | | | The debugfs interface defines stub function if debugfs is not enabled, which were missing the 'static inline' qualifiers causing sparse warnings. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: add missing includeGilad Ben-Yossef2018-01-091-0/+1
| | | | | | | Add the missing include of include file with function declarations. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unneeded includesGilad Ben-Yossef2018-01-098-58/+0Star
| | | | | | | Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use a consistent file naming conventionGilad Ben-Yossef2018-01-0925-69/+69
| | | | | | | | | | | | The ccree driver source files were using an inconsistent naming convention stemming from what the company was called when they were added. Move to a single consistent naming convention for better code readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: update TODOGilad Ben-Yossef2018-01-081-1/+1
| | | | | | | Update TODO to reflect work done Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* stating: ccree: fix allocation of void sized bufGilad Ben-Yossef2018-01-082-8/+10
| | | | | | | | | We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: put pointer next to var nameGilad Ben-Yossef2018-01-081-1/+1
| | | | | | | Put pointer next to var name as per coding style. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fold common code into service funcGilad Ben-Yossef2018-01-081-223/+116Star
| | | | | | | Fold common code in hash call into service functions. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix indentation of func paramsGilad Ben-Yossef2018-01-081-26/+20Star
| | | | | | | | Fix indentation of some function params in hash code for better readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: do not map bufs in ahash_initGilad Ben-Yossef2018-01-081-89/+103
| | | | | | | | | | | | | | | hash_init was mapping DMA memory that were then being unmap in hash_digest/final/finup callbacks, which is against the Crypto API usage rules (see discussion at https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg30077.html) Fix it by moving all buffer mapping/unmapping or each Crypto API op. This also properly deals with hash_import() not knowing if hash_init was called or not as it now no longer matters. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: allocate hash bufs inside req ctxGilad Ben-Yossef2018-01-082-68/+12Star
| | | | | | | | | Move to allocating the buffers needed for requests as part of the request structure instead of malloc'ing each one on it's own, making for simpler (and more efficient) code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use array for double bufferGilad Ben-Yossef2018-01-083-37/+46
| | | | | | | | | | | | The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unused fieldGilad Ben-Yossef2018-01-081-1/+0Star
| | | | | | | Remove unused struct field. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use Makefile to include PM codeGilad Ben-Yossef2018-01-084-32/+37
| | | | | | | | | Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: handle end of sg list gracefullyGilad Ben-Yossef2018-01-081-1/+1
| | | | | | | | | If we are asked for number of entries of an offset bigger than the sg list we should not crash. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: check DMA pool buf !NULL before freeGilad Ben-Yossef2018-01-081-1/+2
| | | | | | | | | | If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: failing the suspend is not an errorGilad Ben-Yossef2018-01-081-7/+1Star
| | | | | | | | | PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* stating: ccree: revert "staging: ccree: fix leak of import() after init()"Gilad Ben-Yossef2018-01-081-7/+4Star
| | | | | | | | | | | | | This reverts commit c5f39d07860c ("staging: ccree: fix leak of import() after init()") and commit aece09024414 ("staging: ccree: Uninitialized return in ssi_ahash_import()"). This is the wrong solution and ends up relying on uninitialized memory, although it was not obvious to me at the time. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: add backlog processingGilad Ben-Yossef2018-01-085-42/+163
| | | | | | | | | | | Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: break send_request and fix ret valGilad Ben-Yossef2018-01-085-94/+128
| | | | | | | | | | | | | | | | | | | The send_request() function was handling both synchronous and asynchronous invocations, but were not handling the asynchronous case, which may be called in an atomic context, properly as it was sleeping. Start to fix the problem by breaking up the two use cases to separate functions calling a common internal service function and return error instead of sleeping for the asynchronous case. The next patch will complete the fix by implementing proper backlog handling. 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>
* staging: ccree: remove unused leftover fieldGilad Ben-Yossef2018-01-081-1/+0Star
| | | | | | | Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: tag debugfs init/exit func properlyGilad Ben-Yossef2018-01-081-2/+2
| | | | | | | | | The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: copy larval digest from RAMGilad Ben-Yossef2018-01-083-57/+68
| | | | | | | | The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: pick alloc mem flags based on req flagsGilad Ben-Yossef2018-01-085-35/+54
| | | | | | | | | The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove GFP_DMA flag from mem allocsGilad Ben-Yossef2018-01-082-10/+7Star
| | | | | | | | Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fold reg common defines into driverGilad Ben-Yossef2018-01-083-17/+5Star
| | | | | | | | Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fold hash defs into queue defsGilad Ben-Yossef2018-01-083-24/+13Star
| | | | | | | | Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: SPDXify driverGilad Ben-Yossef2018-01-0831-435/+62Star
| | | | | | | Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: mark debug_regs[] as staticArnd Bergmann2018-01-081-1/+1
| | | | | | | | | | | | | | | | The global array clashes with an existing symbol of the same name: drivers/staging/ccree/cc_debugfs.o:(.data+0x0): multiple definition of `debug_regs' drivers/mmc/host/s3cmci.o:(.data+0x70): first defined here We should fix both, this one addresses the ccree driver by removing the symbol from the global namespace. Fixes: 9bdd203b4dc8 ("s3cmci: add debugfs support for examining driver and hardware state") Fixes: b3ec9a6736f2 ("staging: ccree: staging: ccree: replace sysfs by debugfs interface") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use size_t consistentlyGilad Ben-Yossef2017-12-202-4/+3Star
| | | | | | | | | | Fix declaration, implementation and wrapper function to use the same size_t type we actually define the parameter to be. Fixes: 3f268f5d6669 ("staging: ccree: turn compile time debug log to params") Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: ccree: Add blank line after declarationsKamal Heib2017-12-191-0/+1
| | | | | | | | | | | This patch adds a blank line after declarations to improve code readability. Issue find by checkpatch.pl script. WARNING: Missing a blank line after declarations Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: update TODOGilad Ben-Yossef2017-12-191-2/+1Star
| | | | | | | Update TODO with handling on sysfs -> debugfs transition Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix fips event irq handling buildGilad Ben-Yossef2017-12-191-1/+1
| | | | | | | | | | When moving from internal for kernel FIPS infrastructure the FIPS event irq handling code was left with the old ifdef by mistake. Fix it. Fixes: b7e607bf33a2 ("staging: ccree: move FIPS support to kernel infrastructure") Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove ssi_config.hGilad Ben-Yossef2017-12-1913-42/+3Star
| | | | | | | | | | | Now that the only thing left in ssi_config is the maximum DMA mask length we get move that to ssi_driver.h and get rid of the file. All of ccree is now runtime configurable or under Kbuild control. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: turn compile time debug log to paramsGilad Ben-Yossef2017-12-194-27/+35
| | | | | | | | | | The ccree driver has some support to dump runtime data to kernel log to assist in debugging. The code used to be enabled by a build time flag. Refactor to enable it via module/kernel parameters. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove useless debug codeGilad Ben-Yossef2017-12-194-84/+0Star
| | | | | | | Remove a bunch of useless debug code ifdef'ed out Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove CC_IRQ_DELAY dead codeGilad Ben-Yossef2017-12-192-12/+0Star
| | | | | | | | Remove dead code from older version which is not supported in current hardware. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: staging: ccree: replace sysfs by debugfs interfaceGilad Ben-Yossef2017-12-1912-224/+154Star
| | | | | | | | 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>
* staging: ccree: add explicit module init/exit funcGilad Ben-Yossef2017-12-191-1/+12
| | | | | | | | | | 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>
* staging: ccree: clean up PM registrationGilad Ben-Yossef2017-12-193-13/+10Star
| | | | | | | Clean up power management registration. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: drop ifdef CONFIG_OF in codeGilad Ben-Yossef2017-12-191-4/+0Star
| | | | | | | | 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>
* Merge 4.15-rc4 into staging-nextGreg Kroah-Hartman2017-12-181-1/+1
|\ | | | | | | | | | | We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * staging: ccree: Uninitialized return in ssi_ahash_import()Dan Carpenter2017-12-061-1/+1
| | | | | | | | | | | | | | | | The return value isn't initialized on some success paths. Fixes: c5f39d07860c ("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>
* | staging: ccree: fix FIPS mgr naming conventionGilad Ben-Yossef2017-12-133-9/+9
| | | | | | | | | | | | | | | | | | | | | | 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>
* | staging: ccree: simplify freeing SRAM memory addressGilad Ben-Yossef2017-12-131-6/+1Star
| | | | | | | | | | | | | | | | | | 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>