
Verifying driver operation and correctness
Other than noting the performance advantages due to the crypto offload, one can also ensure the hardware is doing the crypto
by looking for driver messages in dmesg.
The driver emits console messages at initialization time:
caam algorithms registered in /proc/crypto
caam_jr 1710000.jr: registering rng-caam
caam 1700000.crypto: caam pkc algorithms registered in /proc/crypto
If the messages are not present in the logs, either the driver is not configured in the kernel, or no SEC compatible device tree
node is present in the device tree.
Incrementing IRQs in /proc/interrupts
Given a time period when crypto requests are being made, the SEC hardware will fire completion notification interrupts on the
corresponding Job Ring:
$ cat /proc/interrupts | grep jr
CPU0 CPU1 CPU2 CPU3
[...]
78: 1007 0 0 0 GICv2 103 Level 1710000.jr
79: 7 0 0 0 GICv2 104 Level 1720000.jr
80: 0 0 0 0 GICv2 105 Level 1730000.jr
81: 0 0 0 0 GICv2 106 Level 1740000.jr
If the number of interrupts fired increment, then the hardware is being used to do the crypto.
If the numbers do not increment, then first check the algorithm being exercised is supported by the driver. If the algorithm is
supported, there is a possibility that the driver is in polling mode (NAPI mechanism) and the hardware statistics in debugfs
(inbound / outbound bytes encrypted / protected - see below) should be monitored.
Verifying the 'self test' fields say 'passed' in /proc/crypto
An entry such as the one below means the driver has successfully registered support for the algorithm with the kernel crypto API:
name : cbc(aes)
driver : cbc-aes-caam
module : kernel
priority : 3000
refcnt : 1
selftest : passed
internal : no
type : givcipher
async : yes
blocksize : 16
min keysize : 16
max keysize : 32
ivsize : 16
geniv : <built-in>
Note that although a test vector may not exist for a particular algorithm supported by the driver, the kernel will emit messages
saying which algorithms weren't tested, and mark them as 'passed' anyway:
[...]
alg: No test for authenc(hmac(sha224),ecb(cipher_null)) (authenc-hmac-sha224-ecb-cipher_null-caam)
alg: No test for authenc(hmac(sha256),ecb(cipher_null)) (authenc-hmac-sha256-ecb-cipher_null-caam)
[...]
alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-caam)
alg: No test for echainiv(authenc(hmac(md5),cbc(aes))) (echainiv-authenc-hmac-md5-cbc-aes-caam)
alg: No test for echainiv(authenc(hmac(sha1),cbc(aes))) (echainiv-authenc-hmac-sha1-cbc-aes-caam)
[...]
Device Drivers
Layerscape LS1028A BSP User Guide, Rev. 0.3, 04/2019
NXP Semiconductors
73
Содержание Layerscape LS1028A BSP
Страница 135: ......