spinlock: extend guard with spinlock_bh variants
Subsystems (5)
Christian Marangi
maintainerRFC PATCH v3 1/3 spinlock: extend guard with spinlock_bh variants
Extend guard APIs with missing raw/spinlock_bh variants.
---
Changes v2:
- Add this patch
include/linux/spinlock.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/linux/spinlock.h +13 -0
@@ -548,6 +548,12 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irq, raw_spinlock_t, DEFINE_LOCK_GUARD_1_COND(raw_spinlock_irq, _try, raw_spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1 (raw_spinlock_bh, raw_spinlock_t, +raw_spin_lock_bh (_T->lock), + raw_spin_unlock_bh(_T->lock)) + +DEFINE_LOCK_GUARD_1_COND(raw_spinlock_bh, _try, raw_spin_trylock_bh(_T->lock)) + DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t, raw_spin_lock_irqsave(_T->lock, _T->flags), raw_spin_unlock_irqrestore(_T->lock, _T->flags),
@@ -569,6 +575,13 @@ DEFINE_LOCK_GUARD_1(spinlock_irq, spinlock_t,DEFINE_LOCK_GUARD_1_COND (spinlock_irq, _try, spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1 (spinlock_bh, spinlock_t, +spin_lock_bh (_T->lock), + spin_unlock_bh(_T->lock)) + +DEFINE_LOCK_GUARD_1_COND (spinlock_bh, _try, + spin_trylock_bh(_T->lock)) + DEFINE_LOCK_GUARD_1(spinlock_irqsave, spinlock_t, spin_lock_irqsave(_T->lock, _T->flags), spin_unlock_irqrestore(_T->lock, _T->flags),
Signature · 1 line
2.45.2
Christian Marangi
maintainerRFC PATCH v3 2/3 dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine
Add bindings for the Inside Secure SafeXcel EIP-93 crypto engine.
The IP is present on Airoha SoC and on various Mediatek devices and other SoC under different names like mtk-eip93 or PKTE.
---
Changes v3:
- Add SoC compatible with generic one
Changes v2:
- Change to better compatible
- Add description for EIP93 models
.../crypto/inside-secure,safexcel-eip93.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/inside-secure,safexcel-eip93.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Inside Secure SafeXcel EIP-93 cryptographic engine + +maintainers: + - Christian Marangi <[email protected]> + +description: | + The Inside Secure SafeXcel EIP-93 is a cryptographic engine IP block + integrated in varios devices with very different and generic name from + PKTE to simply vendor+EIP93. The real IP under the hood is actually + developed by Inside Secure and given to license to vendors. + + The IP block is sold with different model based on what feature are + needed and are identified with the final letter. Each letter correspond + to a specific set of feature and multiple letter reflect the sum of the + feature set. + + EIP-93 models: + - EIP-93i: (basic) DES/Triple DES, AES, PRNG, IPsec ESP, SRTP, SHA1 + - EIP-93ie: i + SHA224/256, AES-192/256 + - EIP-93is: i + SSL/DTLS/DTLS, MD5, ARC4 + - EIP-93ies: i + e + s + - EIP-93iw: i + AES-XCB-MAC, AES-CCM + +properties: + compatible: + items: + - const: airoha,crypto-eip93 + - enum: + - inside-secure,safexcel-eip93i + - inside-secure,safexcel-eip93ie + - inside-secure,safexcel-eip93is + - inside-secure,safexcel-eip93ies + - inside-secure,safexcel-eip93iw + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + crypto@1e004000 { + compatible = "airoha,crypto-eip93", "inside-secure,safexcel-eip93ies"; + reg = <0x1fb70000 0x1000>; + + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.45.2
Re: [RFC PATCH v3 2/3] dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine
Quoted 5 lines · Christian Marangi
Add bindings for the Inside Secure SafeXcel EIP-93 crypto engine.
The IP is present on Airoha SoC and on various Mediatek devices and other SoC under different names like mtk-eip93 or PKTE.
Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>---
Changes v3:
- Add SoC compatible with generic one
Changes v2:
- Change to better compatible
- Add description for EIP93 models
RFC v3, but I don't see any comments explaining what you're seeking comments on.
Christian Marangi
maintainerRe: [RFC PATCH v3 2/3] dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine
Quoted 14 lines · Conor Dooley
Quoted 5 lines · Christian Marangi
Add bindings for the Inside Secure SafeXcel EIP-93 crypto engine.
The IP is present on Airoha SoC and on various Mediatek devices and other SoC under different names like mtk-eip93 or PKTE.
Quoted 7 lines
Signed-off-by Christian Marangi <[email protected]>---
Changes v3:
- Add SoC compatible with generic one
Changes v2:
- Change to better compatible
- Add description for EIP93 models
Quoted 2 lines
RFC v3, but I don't see any comments explaining what you're seeking comments on.
I feel comments for the DT part are finished, if Rob is ok with the following compatibles.
The RFC is more for the driver part and this is patch part of the series.
Signature · 1 line
Ansuel
Re: [RFC PATCH v3 2/3] dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine
Quoted 15 lines · Christian Marangi
Quoted 14 lines · Conor Dooley
Quoted 12 lines · Christian Marangi
Add bindings for the Inside Secure SafeXcel EIP-93 crypto engine.
The IP is present on Airoha SoC and on various Mediatek devices and other SoC under different names like mtk-eip93 or PKTE.
Signed-off-by Christian Marangi <[email protected]>---
Changes v3:
- Add SoC compatible with generic one
Changes v2:
- Change to better compatible
- Add description for EIP93 models
Quoted 7 lines
Quoted 2 lines
RFC v3, but I don't see any comments explaining what you're seeking comments on.
I feel comments for the DT part are finished, if Rob is ok with the following compatibles.
The RFC is more for the driver part and this is patch part of the series.
I didn't see anything there either, that pointed out what made it an RFC. Please be more explicit in the future - possibly in your cover letter.
Re: [RFC PATCH v3 2/3] dt-bindings: crypto: Add Inside Secure SafeXcel EIP-93 crypto engine
In reply to Christian MarangiQuoted 41 lines · Christian Marangi
Add bindings for the Inside Secure SafeXcel EIP-93 crypto engine.
The IP is present on Airoha SoC and on various Mediatek devices and other SoC under different names like mtk-eip93 or PKTE.
Signed-off-by Christian Marangi <[email protected]>---
Changes v3:
- Add SoC compatible with generic one
Changes v2:
- Change to better compatible
- Add description for EIP93 models.../crypto/inside-secure,safexcel-eip93.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yamlDocumentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml new file +18
-0@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/inside-secure,safexcel-eip93.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Inside Secure SafeXcel EIP-93 cryptographic engine + +maintainers: + - Christian Marangi <[email protected]> + +description: | + The Inside Secure SafeXcel EIP-93 is a cryptographic engine IP block + integrated in varios devices with very different and generic name from + PKTE to simply vendor+EIP93. The real IP under the hood is actually + developed by Inside Secure and given to license to vendors. + + The IP block is sold with different model based on what feature are
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml new file +10
-0+ needed and are identified with the final letter. Each letter correspond + to a specific set of feature and multiple letter reflect the sum of the + feature set. + + EIP-93 models: + - EIP-93i: (basic) DES/Triple DES, AES, PRNG, IPsec ESP, SRTP, SHA1 + - EIP-93ie: i + SHA224/256, AES-192/256 + - EIP-93is: i + SSL/DTLS/DTLS, MD5, ARC4 + - EIP-93ies: i + e + s + - EIP-93iw: i + AES-XCB-MAC, AES-CCM
This implies that you should have a non-trivial set of fallbacks, with the "i" model as the base for that. eg:
"ie", "i"
"is", "i"
"iw", "i"
"ies", "ie, "is", "i" (I dunno which would be a better order here)
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml line 39
Quoted 11 lines
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml new file +11
-0+ +properties: + compatible: + items: + - const: airoha,crypto-eip93 + - enum: + - inside-secure,safexcel-eip93i + - inside-secure,safexcel-eip93ie + - inside-secure,safexcel-eip93is + - inside-secure,safexcel-eip93ies + - inside-secure,safexcel-eip93iw
I don't really get what's going on here. Why is the first compatible the generic one? That seems suspect to me, as I doubt the crypto block on a particular SoC varies? I'd expect to see some soc-specific compatibles with a fallback to the inside-secure IP version that it integrates.
Cheers,
Conor.
Quoted 27 lines
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml new file +24
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + crypto@1e004000 { + compatible = "airoha,crypto-eip93", "inside-secure,safexcel-eip93ies"; + reg = <0x1fb70000 0x1000>; + + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + };Signature · 1 line
2.45.2
Christian Marangi
maintainerRFC PATCH v3 3/3 crypto: Add Mediatek EIP-93 crypto engine support
In reply to Christian MarangiAdd support for the Mediatek EIP-93 crypto engine used on MT7621 and new Airoha SoC.
EIP-93 IP supports AES/DES/3DES ciphers in ECB/CBC and CTR modes as well as authenc(HMAC(x), cipher(y)) using HMAC MD5, SHA1, SHA224 and SHA256.
EIP-93 provide regs to signal support for specific chipers and the driver dynamically register only the supported one by the chip.
---
Changes v3:
- Mute warning from Clang about C23
- Fix not inizialized err
- Drop unused variable
Changes v2:
- Rename all variables from mtk to eip93
- Move to inside-secure directory
- Check DMA map errors
- Use guard API for spinlock
- Minor improvements to code
drivers/crypto/Kconfig | 1 + drivers/crypto/Makefile | 1 + drivers/crypto/inside-secure/eip93/Kconfig | 20 + drivers/crypto/inside-secure/eip93/Makefile | 5 + .../crypto/inside-secure/eip93/eip93-aead.c | 702 ++++++++++++++ .../crypto/inside-secure/eip93/eip93-aead.h | 38 + .../crypto/inside-secure/eip93/eip93-aes.h | 16 + .../crypto/inside-secure/eip93/eip93-cipher.c | 407 ++++++++ .../crypto/inside-secure/eip93/eip93-cipher.h | 60 ++ .../crypto/inside-secure/eip93/eip93-common.c | 824 ++++++++++++++++ .../crypto/inside-secure/eip93/eip93-common.h | 25 + .../crypto/inside-secure/eip93/eip93-des.h | 16 + .../crypto/inside-secure/eip93/eip93-hash.c | 912 ++++++++++++++++++ .../crypto/inside-secure/eip93/eip93-hash.h | 72 ++ .../crypto/inside-secure/eip93/eip93-main.c | 502 ++++++++++ .../crypto/inside-secure/eip93/eip93-main.h | 155 +++ .../crypto/inside-secure/eip93/eip93-regs.h | 335 +++++++ 17 files changed, 4091 insertions(+) create mode 100644 drivers/crypto/inside-secure/eip93/Kconfig create mode 100644 drivers/crypto/inside-secure/eip93/Makefile create mode 100644 drivers/crypto/inside-secure/eip93/eip93-aead.c create mode 100644 drivers/crypto/inside-secure/eip93/eip93-aead.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-aes.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-cipher.c create mode 100644 drivers/crypto/inside-secure/eip93/eip93-cipher.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-common.c create mode 100644 drivers/crypto/inside-secure/eip93/eip93-common.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-des.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-hash.c create mode 100644 drivers/crypto/inside-secure/eip93/eip93-hash.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-main.c create mode 100644 drivers/crypto/inside-secure/eip93/eip93-main.h create mode 100644 drivers/crypto/inside-secure/eip93/eip93-regs.h
drivers/crypto/Kconfig +1 -0
@@ -851,5 +851,6 @@ config CRYPTO_DEV_SA2UL source "drivers/crypto/aspeed/Kconfig" source "drivers/crypto/starfive/Kconfig" +source "drivers/crypto/inside-secure/eip93/Kconfig" endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
@@ -52,3 +52,4 @@ obj-y += hisilicon/ obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/ obj-y += intel/ obj-y += starfive/ +obj-y += inside-secure/eip93/
drivers/crypto/inside-secure/eip93/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0 +config CRYPTO_DEV_EIP93 + tristate "Support for EIP93 crypto HW accelerators" + depends on SOC_MT7621 || ARCH_AIROHA ||COMPILE_TEST + select CRYPTO_LIB_AES + select CRYPTO_LIB_DES + select CRYPTO_SKCIPHER + select CRYPTO_AEAD + select CRYPTO_AUTHENC + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_SHA256 + help + EIP93 have various crypto HW accelerators. Select this if + you want to use the EIP93 modules for any of the crypto algorithms. + + If the IP supports it, this provide offload for AES - ECB, CBC and + CTR crypto. Also provide DES and 3DES ECB and CBC. + + Also provide AEAD authenc(hmac(x), cipher(y)) for supported algo.
drivers/crypto/inside-secure/eip93/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +obj-$(CONFIG_CRYPTO_DEV_EIP93) += crypto-hw-eip93.o + +crypto-hw-eip93-y += eip93-main.o eip93-common.o +crypto-hw-eip93-y += eip93-cipher.o eip93-aead.o +crypto-hw-eip93-y += eip93-hash.o
drivers/crypto/inside-secure/eip93/eip93-aead.c new file +702 -0
702 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-aead.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2019 - 2021 +* +* Richard van Schagen <[email protected]> +* Christian Marangi <[email protected] +*/ +#ifndef _EIP93_AEAD_H_ +#define _EIP93_AEAD_H_ + +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_cbc_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_cbc_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_cbc_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_cbc_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_ctr_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_ctr_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_ctr_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_ctr_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_rfc3686_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_rfc3686_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_rfc3686_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_rfc3686_aes; +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_cbc_des; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_cbc_des; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_cbc_des; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_cbc_des; +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_cbc_des3_ede; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_cbc_des3_ede; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_cbc_des3_ede; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_cbc_des3_ede; +extern struct eip93_alg_template eip93_alg_authenc_hmac_md5_ecb_null; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha1_ecb_null; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha224_ecb_null; +extern struct eip93_alg_template eip93_alg_authenc_hmac_sha256_ecb_null; + +void eip93_aead_handle_result (struct crypto_async_request *async,int err); + +#endif /* _EIP93_AEAD_H_ */
drivers/crypto/inside-secure/eip93/eip93-aes.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2019 - 2021 +* +* Richard van Schagen <[email protected]> +* Christian Marangi <[email protected] +*/ +#ifndef _EIP93_AES_H_ +#define _EIP93_AES_H_ + +extern struct eip93_alg_template eip93_alg_ecb_aes; +extern struct eip93_alg_template eip93_alg_cbc_aes; +extern struct eip93_alg_template eip93_alg_ctr_aes; +extern struct eip93_alg_template eip93_alg_rfc3686_aes; + +#endif /* _EIP93_AES_H_ */
drivers/crypto/inside-secure/eip93/eip93-cipher.c new file +407 -0
407 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-cipher.h new file +60 -0
60 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-common.c new file +824 -0
824 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-common.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2019 - 2021 +* +* Richard van Schagen <[email protected]> +* Christian Marangi <[email protected] +*/ + +#ifndef _EIP93_COMMON_H_ +#define _EIP93_COMMON_H_ + +#include "eip93-main.h" + +void *eip93_get_descriptor (struct eip93_device *mtk); +int eip93_put_descriptor (struct eip93_device *mtk,struct eip93_descriptor *desc); + +void eip93_set_sa_record (struct sa_record *sa_record,const unsigned int keylen, +const u32 flags); + +int eip93_parse_ctrl_stat_err (struct eip93_device *mtk,int err); + +int eip93_authenc_setkey (struct crypto_aead *aead,struct sa_record *sa, +const u8 *authkey,unsigned int authkeylen); + +#endif /* _EIP93_COMMON_H_ */
drivers/crypto/inside-secure/eip93/eip93-des.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2019 - 2021 +* +* Richard van Schagen <[email protected]> +* Christian Marangi <[email protected] +*/ +#ifndef _EIP93_DES_H_ +#define _EIP93_DES_H_ + +extern struct eip93_alg_template eip93_alg_ecb_des; +extern struct eip93_alg_template eip93_alg_cbc_des; +extern struct eip93_alg_template eip93_alg_ecb_des3_ede; +extern struct eip93_alg_template eip93_alg_cbc_des3_ede; + +#endif /* _EIP93_DES_H_ */
drivers/crypto/inside-secure/eip93/eip93-hash.c new file +912 -0
877 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-hash.h new file +72 -0
72 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-main.c new file +502 -0
502 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-main.h new file +155 -0
155 lines not on this page · raw message
drivers/crypto/inside-secure/eip93/eip93-regs.h new file +335 -0
335 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.45.2
Part of the diff is not shown here. View the raw message.
kernel test robot
build botRe: [RFC PATCH v3 3/3] crypto: Add Mediatek EIP-93 crypto engine support
kernel test robot noticed the following build errors:
Hi Christian,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master tip/locking/core robh/for-next linus/master v6.12-rc4 next-20241024] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/dt-bindings-crypto-Add-Inside-Secure-SafeXcel-EIP-93-crypto-engine/20241021-230034 base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master patch link: https://lore.kernel.org/r/20241021145642.16368-3-ansuelsmth%40gmail.com patch subject: [RFC PATCH v3 3/3] crypto: Add Mediatek EIP-93 crypto engine support config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20241025/[email protected]/config) compiler: sh4-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
drivers/crypto/inside-secure/eip93/eip93-main.c: In function 'eip93_handle_result_descriptor':
>> drivers/crypto/inside-secure/eip93/eip93-main.c:210:26: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
210 | } while (FIELD_GET(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN, pe_ctrl_stat) !=
| ^~~~~~~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-main.h:18,
from drivers/crypto/inside-secure/eip93/eip93-main.c:21:
drivers/crypto/inside-secure/eip93/eip93-main.c: In function 'eip93_initialize':
>> drivers/crypto/inside-secure/eip93/eip93-regs.h:102:49: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
102 | #define EIP93_PE_TARGET_AUTO_RING_MODE FIELD_PREP(EIP93_PE_CONFIG_PE_MODE, 0x3)
| ^~~~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:293:16: note: in expansion of macro 'EIP93_PE_TARGET_AUTO_RING_MODE'
293 | val |= EIP93_PE_TARGET_AUTO_RING_MODE;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:8,
from drivers/crypto/inside-secure/eip93/eip93-main.c:12:
drivers/crypto/inside-secure/eip93/eip93-main.c: In function 'eip93_crypto_probe':
>> drivers/crypto/inside-secure/eip93/eip93-main.c:459:28: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:9: note: in expansion of macro 'dev_info'
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:34: note: format string is defined here
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~^
| |
| long unsigned int
| %u
>> drivers/crypto/inside-secure/eip93/eip93-main.c:459:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:9: note: in expansion of macro 'dev_info'
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:38: note: format string is defined here
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~^
| |
| long unsigned int
| %x
drivers/crypto/inside-secure/eip93/eip93-main.c:459:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:9: note: in expansion of macro 'dev_info'
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:42: note: format string is defined here
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~^
| |
| long unsigned int
| %x
drivers/crypto/inside-secure/eip93/eip93-main.c:459:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'int' [-Wformat=]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:9: note: in expansion of macro 'dev_info'
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ^~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:459:46: note: format string is defined here
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~^
| |
| long unsigned int
| %x
--
drivers/crypto/inside-secure/eip93/eip93-common.c: In function 'eip93_parse_ctrl_stat_err':
>> drivers/crypto/inside-secure/eip93/eip93-common.c:47:19: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
47 | ext_err = FIELD_GET(EIP93_PE_CTRL_PE_EXT_ERR_CODE, err);
| ^~~~~~~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-main.h:18,
from drivers/crypto/inside-secure/eip93/eip93-cipher.h:11,
from drivers/crypto/inside-secure/eip93/eip93-common.c:19:
drivers/crypto/inside-secure/eip93/eip93-common.c: In function 'eip93_set_sa_record':
drivers/crypto/inside-secure/eip93/eip93-regs.h:207:49: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
207 | #define EIP93_SA_CMD_IV_FROM_STATE FIELD_PREP(EIP93_SA_CMD_IV_SOURCE, 0x2)
| ^~~~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-common.c:302:36: note: in expansion of macro 'EIP93_SA_CMD_IV_FROM_STATE'
302 | sa_record->sa_cmd0_word |= EIP93_SA_CMD_IV_FROM_STATE;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
--
drivers/crypto/inside-secure/eip93/eip93-aead.c: In function 'eip93_aead_setkey':
>> drivers/crypto/inside-secure/eip93/eip93-aead.c:132:36: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
132 | sa_record->sa_cmd0_word |= FIELD_PREP(EIP93_SA_CMD_OPCODE,
| ^~~~~~~~~~vim +/FIELD_GET +210 drivers/crypto/inside-secure/eip93/eip93-main.c
174
175 static void eip93_handle_result_descriptor(struct eip93_device *mtk)
176 {
177 struct crypto_async_request *async;
178 struct eip93_descriptor *rdesc;
179 u16 desc_flags, crypto_idr;
180 bool last_entry;
181 int handled, left, err;
182 u32 pe_ctrl_stat;
183 u32 pe_length;
184
185 get_more:
186 handled = 0;
187
188 left = readl(mtk->base + EIP93_REG_PE_RD_COUNT) & EIP93_PE_RD_COUNT;
189
190 if (!left) {
191 eip93_irq_clear(mtk, EIP93_INT_RDR_THRESH);
192 eip93_irq_enable(mtk, EIP93_INT_RDR_THRESH);
193 return;
194 }
195
196 last_entry = false;
197
198 while (left) {
199 rdesc = eip93_get_descriptor(mtk);
200 if (IS_ERR(rdesc)) {
201 dev_err(mtk->dev, "Ndesc: %d nreq: %d\n",
202 handled, left);
203 err = -EIO;
204 break;
205 }
206 /* make sure DMA is finished writing */
207 do {
208 pe_ctrl_stat = READ_ONCE(rdesc->pe_ctrl_stat_word);
209 pe_length = READ_ONCE(rdesc->pe_length_word);
> 210 } while (FIELD_GET(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN, pe_ctrl_stat) != 211 EIP93_PE_CTRL_PE_READY || 212 FIELD_GET(EIP93_PE_LENGTH_HOST_PE_READY, pe_length) != 213 EIP93_PE_LENGTH_PE_READY); 214 215 err = rdesc->pe_ctrl_stat_word & (EIP93_PE_CTRL_PE_EXT_ERR_CODE | 216 EIP93_PE_CTRL_PE_EXT_ERR | 217 EIP93_PE_CTRL_PE_SEQNUM_ERR | 218 EIP93_PE_CTRL_PE_PAD_ERR | 219 EIP93_PE_CTRL_PE_AUTH_ERR);
220
221 desc_flags = FIELD_GET(EIP93_PE_USER_ID_DESC_FLAGS, rdesc->user_id);
222 crypto_idr = FIELD_GET(EIP93_PE_USER_ID_CRYPTO_IDR, rdesc->user_id);
223
224 writel(1, mtk->base + EIP93_REG_PE_RD_COUNT);
225 eip93_irq_clear(mtk, EIP93_INT_RDR_THRESH);
226
227 handled++;
228 left--;
229
230 if (desc_flags & EIP93_DESC_LAST) {
231 last_entry = true;
232 break;
233 }
234 }
235
236 if (!last_entry)
237 goto get_more;
238
239 /* Get crypto async ref only for last descriptor */
240 scoped_guard(spinlock_bh, &mtk->ring->idr_lock) {
241 async = idr_find(&mtk->ring->crypto_async_idr, crypto_idr);
242 idr_remove(&mtk->ring->crypto_async_idr, crypto_idr);
243 }
244
245 /* Parse error in ctrl stat word */
246 err = eip93_parse_ctrl_stat_err(mtk, err);
247
248 if (desc_flags & EIP93_DESC_SKCIPHER)
249 eip93_skcipher_handle_result(async, err);
250
251 if (desc_flags & EIP93_DESC_AEAD)
252 eip93_aead_handle_result(async, err);
253
254 if (desc_flags & EIP93_DESC_HASH)
255 eip93_hash_handle_result(async, err);
256
257 goto get_more;
258 }
259
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [RFC PATCH v3 3/3] crypto: Add Mediatek EIP-93 crypto engine support
In reply to Christian Marangikernel test robot noticed the following build errors:
Hi Christian,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master tip/locking/core robh/for-next linus/master v6.12-rc4 next-20241024] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/dt-bindings-crypto-Add-Inside-Secure-SafeXcel-EIP-93-crypto-engine/20241021-230034 base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master patch link: https://lore.kernel.org/r/20241021145642.16368-3-ansuelsmth%40gmail.com patch subject: [RFC PATCH v3 3/3] crypto: Add Mediatek EIP-93 crypto engine support config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241025/[email protected]/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 5886454669c3c9026f7f27eab13509dd0241f2d6) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
In file included from drivers/crypto/inside-secure/eip93/eip93-main.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-main.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-main.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-main.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/crypto/inside-secure/eip93/eip93-main.c:210:12: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
210 | } while (FIELD_GET(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN, pe_ctrl_stat) !=
| ^
drivers/crypto/inside-secure/eip93/eip93-main.c:273:6: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
273 | if (FIELD_GET(EIP93_INT_RDR_THRESH, irq_status)) {
| ^
>> drivers/crypto/inside-secure/eip93/eip93-main.c:293:9: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
293 | val |= EIP93_PE_TARGET_AUTO_RING_MODE;
| ^
drivers/crypto/inside-secure/eip93/eip93-regs.h:102:42: note: expanded from macro 'EIP93_PE_TARGET_AUTO_RING_MODE'
102 | #define EIP93_PE_TARGET_AUTO_RING_MODE FIELD_PREP(EIP93_PE_CONFIG_PE_MODE, 0x3)
| ^
drivers/crypto/inside-secure/eip93/eip93-main.c:378:8: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
378 | val = FIELD_PREP(EIP93_PE_RING_SIZE, EIP93_RING_NUM - 1);
| ^
drivers/crypto/inside-secure/eip93/eip93-main.c:460:4: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
460 | FIELD_GET(EIP93_PE_REVISION_EIP_NO, ver),
| ^
>> drivers/crypto/inside-secure/eip93/eip93-main.c:460:4: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~~
| %d
460 | FIELD_GET(EIP93_PE_REVISION_EIP_NO, ver),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:461:4: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~~
| %x
460 | FIELD_GET(EIP93_PE_REVISION_EIP_NO, ver),
461 | FIELD_GET(EIP93_PE_REVISION_MAJ_HW_REV, ver),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:462:4: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~~
| %x
460 | FIELD_GET(EIP93_PE_REVISION_EIP_NO, ver),
461 | FIELD_GET(EIP93_PE_REVISION_MAJ_HW_REV, ver),
462 | FIELD_GET(EIP93_PE_REVISION_MIN_HW_REV, ver),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
drivers/crypto/inside-secure/eip93/eip93-main.c:463:4: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
459 | dev_info(mtk->dev, "EIP%lu:%lx:%lx:%lx,PE(0x%x:0x%x)\n",
| ~~~
| %x
460 | FIELD_GET(EIP93_PE_REVISION_EIP_NO, ver),
461 | FIELD_GET(EIP93_PE_REVISION_MAJ_HW_REV, ver),
462 | FIELD_GET(EIP93_PE_REVISION_MIN_HW_REV, ver),
463 | FIELD_GET(EIP93_PE_REVISION_HW_PATCH, ver),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~ 11 warnings and 5 errors generated.
--
In file included from drivers/crypto/inside-secure/eip93/eip93-common.c:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-common.c:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-common.c:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-common.c:16:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/crypto/inside-secure/eip93/eip93-common.c:47:12: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
47 | ext_err = FIELD_GET(EIP93_PE_CTRL_PE_EXT_ERR_CODE, err);
| ^
>> drivers/crypto/inside-secure/eip93/eip93-common.c:302:29: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
302 | sa_record->sa_cmd0_word |= EIP93_SA_CMD_IV_FROM_STATE;
| ^
drivers/crypto/inside-secure/eip93/eip93-regs.h:207:39: note: expanded from macro 'EIP93_SA_CMD_IV_FROM_STATE'
207 | #define EIP93_SA_CMD_IV_FROM_STATE FIELD_PREP(EIP93_SA_CMD_IV_SOURCE, 0x2)
| ^
drivers/crypto/inside-secure/eip93/eip93-common.c:474:27: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
474 | cdesc->pe_length_word = FIELD_PREP(EIP93_PE_LENGTH_HOST_PE_READY,
| ^ drivers/crypto/inside-secure/eip93/eip93-common.c:586:28: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
586 | cdesc.pe_ctrl_stat_word = FIELD_PREP(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN,
| ^
7 warnings and 4 errors generated.
--
In file included from drivers/crypto/inside-secure/eip93/eip93-aead.c:23:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-aead.c:23:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-aead.c:23:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-aead.c:23:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/crypto/inside-secure/eip93/eip93-aead.c:132:29: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
132 | sa_record->sa_cmd0_word |= FIELD_PREP(EIP93_SA_CMD_OPCODE,
| ^
drivers/crypto/inside-secure/eip93/eip93-aead.c:159:34: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
159 | ctx->sa_record->sa_cmd0_word |= FIELD_PREP(EIP93_SA_CMD_DIGEST_LENGTH,
| ^
drivers/crypto/inside-secure/eip93/eip93-aead.c:171:29: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
171 | sa_record->sa_cmd1_word |= FIELD_PREP(EIP93_SA_CMD_HASH_CRYPT_OFFSET,
| ^ 7 warnings and 3 errors generated.
--
In file included from drivers/crypto/inside-secure/eip93/eip93-hash.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/crypto/inside-secure/eip93/eip93-hash.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-hash.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/crypto/inside-secure/eip93/eip93-hash.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/crypto/inside-secure/eip93/eip93-hash.c:140:29: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
140 | sa_record->sa_cmd0_word |= EIP93_SA_CMD_HASH_FROM_STATE;
| ^
drivers/crypto/inside-secure/eip93/eip93-regs.h:203:41: note: expanded from macro 'EIP93_SA_CMD_HASH_FROM_STATE'
203 | #define EIP93_SA_CMD_HASH_FROM_STATE FIELD_PREP(EIP93_SA_CMD_HASH_SOURCE, 0x2)
| ^ drivers/crypto/inside-secure/eip93/eip93-hash.c:257:28: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
257 | cdesc.pe_ctrl_stat_word = FIELD_PREP(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN,
| ^
7 warnings and 2 errors generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
vim +/FIELD_GET +210 drivers/crypto/inside-secure/eip93/eip93-main.c
174
175 static void eip93_handle_result_descriptor(struct eip93_device *mtk)
176 {
177 struct crypto_async_request *async;
178 struct eip93_descriptor *rdesc;
179 u16 desc_flags, crypto_idr;
180 bool last_entry;
181 int handled, left, err;
182 u32 pe_ctrl_stat;
183 u32 pe_length;
184
185 get_more:
186 handled = 0;
187
188 left = readl(mtk->base + EIP93_REG_PE_RD_COUNT) & EIP93_PE_RD_COUNT;
189
190 if (!left) {
191 eip93_irq_clear(mtk, EIP93_INT_RDR_THRESH);
192 eip93_irq_enable(mtk, EIP93_INT_RDR_THRESH);
193 return;
194 }
195
196 last_entry = false;
197
198 while (left) {
199 rdesc = eip93_get_descriptor(mtk);
200 if (IS_ERR(rdesc)) {
201 dev_err(mtk->dev, "Ndesc: %d nreq: %d\n",
202 handled, left);
203 err = -EIO;
204 break;
205 }
206 /* make sure DMA is finished writing */
207 do {
208 pe_ctrl_stat = READ_ONCE(rdesc->pe_ctrl_stat_word);
209 pe_length = READ_ONCE(rdesc->pe_length_word);
> 210 } while (FIELD_GET(EIP93_PE_CTRL_PE_READY_DES_TRING_OWN, pe_ctrl_stat) !=
211 EIP93_PE_CTRL_PE_READY ||
212 FIELD_GET(EIP93_PE_LENGTH_HOST_PE_READY, pe_length) !=
213 EIP93_PE_LENGTH_PE_READY);
214
215 err = rdesc->pe_ctrl_stat_word & (EIP93_PE_CTRL_PE_EXT_ERR_CODE |
216 EIP93_PE_CTRL_PE_EXT_ERR |
217 EIP93_PE_CTRL_PE_SEQNUM_ERR |
218 EIP93_PE_CTRL_PE_PAD_ERR |
219 EIP93_PE_CTRL_PE_AUTH_ERR);
220
221 desc_flags = FIELD_GET(EIP93_PE_USER_ID_DESC_FLAGS, rdesc->user_id);
222 crypto_idr = FIELD_GET(EIP93_PE_USER_ID_CRYPTO_IDR, rdesc->user_id);
223
224 writel(1, mtk->base + EIP93_REG_PE_RD_COUNT);
225 eip93_irq_clear(mtk, EIP93_INT_RDR_THRESH);
226
227 handled++;
228 left--;
229
230 if (desc_flags & EIP93_DESC_LAST) {
231 last_entry = true;
232 break;
233 }
234 }
235
236 if (!last_entry)
237 goto get_more;
238
239 /* Get crypto async ref only for last descriptor */
240 scoped_guard(spinlock_bh, &mtk->ring->idr_lock) {
241 async = idr_find(&mtk->ring->crypto_async_idr, crypto_idr);
242 idr_remove(&mtk->ring->crypto_async_idr, crypto_idr);
243 }
244
245 /* Parse error in ctrl stat word */
246 err = eip93_parse_ctrl_stat_err(mtk, err);
247
248 if (desc_flags & EIP93_DESC_SKCIPHER)
249 eip93_skcipher_handle_result(async, err);
250
251 if (desc_flags & EIP93_DESC_AEAD)
252 eip93_aead_handle_result(async, err);
253
254 if (desc_flags & EIP93_DESC_HASH)
255 eip93_hash_handle_result(async, err);
256
257 goto get_more;
258 }
259
260 static void eip93_done_task(unsigned long data)
261 {
262 struct eip93_device *mtk = (struct eip93_device *)data;
263
264 eip93_handle_result_descriptor(mtk);
265 }
266
267 static irqreturn_t eip93_irq_handler(int irq, void *data)
268 {
269 struct eip93_device *mtk = data;
270 u32 irq_status;
271
272 irq_status = readl(mtk->base + EIP93_REG_INT_MASK_STAT);
273 if (FIELD_GET(EIP93_INT_RDR_THRESH, irq_status)) {
274 eip93_irq_disable(mtk, EIP93_INT_RDR_THRESH);
275 tasklet_schedule(&mtk->ring->done_task);
276 return IRQ_HANDLED;
277 }
278
279 /* Ignore errors in AUTO mode, handled by the RDR */
280 eip93_irq_clear(mtk, irq_status);
281 if (irq_status)
282 eip93_irq_disable(mtk, irq_status);
283
284 return IRQ_NONE;
285 }
286
287 static void eip93_initialize(struct eip93_device *mtk, u32 supported_algo_flags)
288 {
289 u32 val;
290
291 /* Reset PE and rings */
292 val = EIP93_PE_CONFIG_RST_PE | EIP93_PE_CONFIG_RST_RING;
> 293 val |= EIP93_PE_TARGET_AUTO_RING_MODE;
294 /* For Auto more, update the CDR ring owner after processing */
295 val |= EIP93_PE_CONFIG_EN_CDR_UPDATE;
296 writel(val, mtk->base + EIP93_REG_PE_CONFIG);
297
298 /* Wait for PE and ring to reset */
299 usleep_range(10, 20);
300
301 /* Release PE and ring reset */
302 val = readl(mtk->base + EIP93_REG_PE_CONFIG);
303 val &= ~(EIP93_PE_CONFIG_RST_PE | EIP93_PE_CONFIG_RST_RING);
304 writel(val, mtk->base + EIP93_REG_PE_CONFIG);
305
306 /* Config Clocks */
307 val = EIP93_PE_CLOCK_EN_PE_CLK;
308 if (supported_algo_flags & EIP93_PE_OPTION_TDES)
309 val |= EIP93_PE_CLOCK_EN_DES_CLK;
310 if (supported_algo_flags & EIP93_PE_OPTION_AES)
311 val |= EIP93_PE_CLOCK_EN_AES_CLK;
312 if (supported_algo_flags &
313 (EIP93_PE_OPTION_MD5 | EIP93_PE_OPTION_SHA_1 | EIP93_PE_OPTION_SHA_224 |
314 EIP93_PE_OPTION_SHA_256))
315 val |= EIP93_PE_CLOCK_EN_HASH_CLK;
316 writel(val, mtk->base + EIP93_REG_PE_CLOCK_CTRL);
317
318 /* Config DMA thresholds */
319 val = FIELD_PREP(EIP93_PE_OUTBUF_THRESH, 128) |
320 FIELD_PREP(EIP93_PE_INBUF_THRESH, 128);
321 writel(val, mtk->base + EIP93_REG_PE_BUF_THRESH);
322
323 /* Clear/ack all interrupts before disable all */
324 eip93_irq_clear(mtk, EIP93_INT_ALL);
325 eip93_irq_disable(mtk, EIP93_INT_ALL);
326
327 /* Setup CRD threshold to trigger interrupt */
328 val = FIELD_PREP(EIPR93_PE_CDR_THRESH, EIP93_RING_NUM - EIP93_RING_BUSY);
329 /*
330 * Configure RDR interrupt to be triggered if RD counter is not 0
331 * for more than 2^(N+10) system clocks.
332 */
333 val |= FIELD_PREP(EIPR93_PE_RD_TIMEOUT, 5) | EIPR93_PE_TIMEROUT_EN;
334 writel(val, mtk->base + EIP93_REG_PE_RING_THRESH);
335 }
336
337 static void eip93_desc_free(struct eip93_device *mtk)
338 {
339 writel(0, mtk->base + EIP93_REG_PE_RING_CONFIG);
340 writel(0, mtk->base + EIP93_REG_PE_CDR_BASE);
341 writel(0, mtk->base + EIP93_REG_PE_RDR_BASE);
342 }
343
344 static int eip93_set_ring(struct eip93_device *mtk, struct eip93_desc_ring *ring)
345 {
346 ring->offset = sizeof(struct eip93_descriptor);
347 ring->base = dmam_alloc_coherent(mtk->dev,
348 sizeof(struct eip93_descriptor) * EIP93_RING_NUM,
349 &ring->base_dma, GFP_KERNEL);
350 if (!ring->base)
351 return -ENOMEM;
352
353 ring->write = ring->base;
354 ring->base_end = ring->base + sizeof(struct eip93_descriptor) * (EIP93_RING_NUM - 1);
355 ring->read = ring->base;
356
357 return 0;
358 }
359
360 static int eip93_desc_init(struct eip93_device *mtk)
361 {
362 struct eip93_desc_ring *cdr = &mtk->ring->cdr;
363 struct eip93_desc_ring *rdr = &mtk->ring->rdr;
364 int ret;
365 u32 val;
366
367 ret = eip93_set_ring(mtk, cdr);
368 if (ret)
369 return ret;
370
371 ret = eip93_set_ring(mtk, rdr);
372 if (ret)
373 return ret;
374
375 writel((u32 __force)cdr->base_dma, mtk->base + EIP93_REG_PE_CDR_BASE);
376 writel((u32 __force)rdr->base_dma, mtk->base + EIP93_REG_PE_RDR_BASE);
377
> 378 val = FIELD_PREP(EIP93_PE_RING_SIZE, EIP93_RING_NUM - 1); 379 writel(val, mtk->base + EIP93_REG_PE_RING_CONFIG);
380
381 atomic_set(&mtk->ring->free, EIP93_RING_NUM - 1);
382
383 return 0;
384 }
385
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki