aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/arch/aarch64
AgeCommit message (Collapse)Author
2023-02-13linux-gen: crypto: implement out-of-place crypto operation typeJanne Peltonen
Add support for ODP_CRYPTO_OP_TYPE_OOP operation type. In openssl crypto, implement out-of-place operations as combinations of packet data copies and in-place operations. This is done for simplicity and to ensure correct semantics for API validation test development. In other crypto modules, do not support out-of-place operations yet, but fail gracefully by returning ODP_CRYPTO_SES_ERR_PARAMS error in session creation if creation of an out-of-place session is attempted. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
2023-02-13linux-gen: crypto: implement basic crypto operation typeJanne Peltonen
Add support for ODP_CRYPTO_OP_TYPE_BASIC operation type. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
2023-02-06linux-gen: crypto: arm: remove deprecated per-session IVsJanne Peltonen
Stop supporting deprecated per-session IVs. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
2022-12-29linux-gen: crypto: inline odp_crypto_result() implementationMatias Elo
Inline odp_crypto_result() function implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-12-29linux-gen: crypto: inline event conversion functionsMatias Elo
Inline odp_crypto_packet_from_event() and odp_crypto_packet_to_event() function implementations. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-12-22linux-gen: crypto: arm: fix out-of-bounds IV read accessJanne Peltonen
The Arm crypto library may read up to 16 bytes of data when it is reading a 12 byte IV. If the IV provided by the caller ends at a page boundary and the next page is not mapped to readable memory, bad things can happen. Fix the problem by always copying the user provided IV to a bigger temporary buffer that is passed to the crypto library. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2022-12-22linux-gen: crypto: arm: use macro for the constant AES-GCM IV lengthJanne Peltonen
The only supported IV length for AES-GCM is 12 bytes. Define it as a macro to benefit from constant expressions and to get rid of some magic numbers. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2022-10-07linux-gen: debug: prefix implementation internal debug macrosMatias Elo
Prefix implementation internal debug macro names with underscore. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-10-07linux-gen: debug: enable debug function usage in inline headersMatias Elo
Enable usage of implementation internal debug macros in inline API headers by moving the macros into an inline header. _odp_log_fn and _odp_abort_fn function pointers are moved out of odp_global_data_ro_t to avoid having to expose the internal data structure. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-28linux-gen: crypto: reuse input packet as output packet if possibleJanne Peltonen
Do not allocate a new packet but reuse the input packet when a crypto operation is requested to allocate the output packet and the input packet and the session use the same packet pool. Make the code cleaner by moving output packet allocation and preparation to its own function from crypto_int(). Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-09-28linux-gen: crypto: fix pool checking before metadata copyingJanne Peltonen
The packet metadata copying check in a crypto operation assumes that the pool of the output packet is the pool configured in the session, but that is not necessarily the case when an ODP application passes an explicit output packet to a crypto operation. In that case the pool of the session could even be ODP_POOL_INVALID. Fix the bug by reading destination pool from the output packet. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-09-09linux-gen: aarch64: atomic: avoid conversion warningsJere Leppänen
Use an explicit cast to avoid conversion warnings, when application is compiled with -Wconversion option. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-05-02linux-gen: sysinfo: use helper macro for calculating array sizeMatias Elo
Use _ODP_ARRAY_SIZE() helper macro for calculating array sizes. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-04-20linux-gen: crypto: arm: remove unused return value from crypto functionsJanne Peltonen
Remove the unused return value from crypto functions. Indicate error in crypto result if required IV is totally missing with deprecated API support. Do not bother setting the error code accurately since the behaviour is anyway undefined after the API usage error. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-04-20linux_gen: remove crypto error from packet error flagsJanne Peltonen
Remove the unnecessary crypto_err parse flag from packet header. odp_packet_has_error() is supposed to indicate parse errors not crypto processing errors, which are indicated through odp_crypto_result_t. Remove the flag and its setting in crypto implementations as the flag is not needed and may cause subtle API spec violations. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-04-13api: crypto: deprecate odp_crypto_operation()Janne Peltonen
Depracate odp_crypto_operation() and the associated data structures and the completion event. The odp_crypto_operation() function is a bit problematic since it can be synchronous or asynchronous on per-packet basis without application having control on it. Uncontrolled sync versus async behaviour can have adverse effects on packet ordering and application design in general. The function is also somewhat redundant with the newer odp_crypto_op() and odp_crypto_op_enq() functions that provide explicit control on the crypto operation completion behavior. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
2022-03-16linux-gen: crypto: arm: combine cipher and auth into one functionJanne Peltonen
Have only one cipher algorithm specific function pointer in the session instead of separate cipher and auth functions. It fits well AEAD algorithms like AES-GCM which is the only algorithm currently supported. Single crypto processing function per session makes sense also for combinations of individual algorithms that are processed in single pass. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-03-16linux-gen: crypto: arm: optimize authentication tag handlingJanne Peltonen
Use a stack buffer instead of a thread local buffer for the tag to avoid possible overhead of accessing thread-local storage. Use memcpy() instead of the slower packet data copy functions to copy tag to/from a packet when packet data is continuous. Use a compile time constant for tag length since only one tag length is supported. This improves optimization of memcpy() etc. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-03-16linux-gen: crypto: arm: use constant length memcpy for AADJanne Peltonen
Call memcpy() with a constant length when copying AAD to a temporary buffer. This way the generic memcpy call gets optimized away and replaced by a couple of loads and stores. Take advantage of the fact that the implementation currently supports only 8 and 12 byte AAD. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-03-16linux-gen: crypto: arm: avoid unneeded packet data copyJanne Peltonen
When a packet is not segmented, perform crypto operation in-place to avoid copying output data from a temporary buffer back to the packet. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-03-08linux-gen: use _odp_u128_t instead of __int128Jere Leppänen
Replace usage of __int128 and __int128_t with _odp_u128_t. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-08linux-gen: use new 128-bit integer typeJere Leppänen
Use _odp_u128_t instead of various ad hoc typedefs. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-02api: crypto: remove deprecated authentication algorithm fieldsMatias Elo
Remove deprecated fields 'md5_96', 'sha256_128', and 'aes128_gcm' from odp_crypto_auth_algos_t. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-02api: crypto: remove deprecated cipher algorithm fieldsMatias Elo
Remove deprecated fields 'aes128_cbc' and 'aes128_gcm' from odp_crypto_cipher_algos_t. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-02api: crypto: remove deprecated crypto authentication algorithmsMatias Elo
Remove deprecated crypto authentication algorithms ODP_AUTH_ALG_MD5_96, ODP_AUTH_ALG_SHA256_128, and ODP_AUTH_ALG_AES128_GCM. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-02api: crypto: remove deprecated crypto cipher algorithmsMatias Elo
Remove deprecated crypto cipher algorithms ODP_CIPHER_ALG_AES128_CBC and ODP_CIPHER_ALG_AES128_GCM. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-04linux-gen: packet: add common packet metadata copy functionMatias Elo
Use a single inlined _odp_packet_copy_md() function for copying metadata for both packets and segments. This function is assumed to never fail. A new _odp_packet_copy_md_possible() function may be called beforehand to check that copying packet metadata is possible. For packets the implementation has been optimized as the user area may not have to be always copied. The previous segment metadata copy function wrote only the destination segment's user area pointer, which caused both source and destination segments to use the same area. The old copy function was also missing classifer mark metadata. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-03linux-gen: crypto: add AES-GCM to armv8cryptoMalvika Gupta
Implement AES-GCM in armv8crypto using the AArch64cryptolib. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan <govindarajan.mohandoss@arm.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
2022-02-03linux-gen: crypto: integrate Aarch64cryptolibMalvika Gupta
Integrate Aarch64cryptolib in the build using pkg-config. Add an autoconf config option to select the crypto implementation to be used and add armv8crypto as an alternative to openssl and null. Add a null crypto based skeleton crypto implementation to be used with the Aarch64cryptolib. Signed-off-by: Govindarajan <govindarajan.mohandoss@arm.com> Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
2022-01-25linux-gen: random: implement true random number generation on aarch64Malvika Gupta
Implement true random data on aarch64 via RNDR register introduced as an extension in Armv8.5-a ISA. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan <govindarajan.mohandoss@arm.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-11-23linux-gen: arch: add new aarch64 CPU enumerationsPetri Savolainen
Added part number enumerations for ARM V1, N2, A510 and A710 CPUs. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-11-08linux-gen: sysinfo: dump aarch64 cpu hardware flagsMalvika Gupta
CPU specific hardware/software features are exposed by the kernel to the userspace through a set of flags called hwcaps, exposed in the auxiliary vector. Userspace software can test for features by acquiring the AT_HWCAP and AT_HWCAP2 entry of the auxiliary vector. These hwcaps are defined in terms of architected system register fields and those exposed in AT_HWCAP and AT_HWCAP2 typically have feature flags associated with them. These mapped feature flags are printed. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan <govindarajan.mohandoss@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-11-08linux-gen: sysinfo: add compile-time cpu flagsMalvika Gupta
More compile-time CPU flags have been added to test the support for newer AArch64 features. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-11-08linux-gen: sysinfo: move compile-time cpu flags to cpu_flags.cMalvika Gupta
Detection and printing of compile-flags has been moved to a new file, cpu_flags.c in preparation for dumping the CPU hardware flags. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-10-21linux-gen: llsc: fix casts to union type build errorsMatias Elo
Fix "ISO C forbids casts to union type" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: fix braced-groups within expressions build errorsMatias Elo
Fix "ISO C forbids braced-groups within expressions" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: fix unsupported types build errorsMatias Elo
Fix "ISO C does not support '__int128' types" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-12linux-gen: atomic: explicitly use staddl for 64-bit add/sub release opsMatias Elo
GCC generates LDADDL instructions when using __atomic_fetch_add() on aarch64. Explicitly use STADDL to implement odp_atomic_add_rel_u64() and odp_atomic_sub_rel_u64() functions for better performance. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-12linux-gen: atomic: explicitly use staddl for 32-bit add/sub release opsMatias Elo
GCC generates LDADDL instructions when using __atomic_fetch_add() on aarch64. Explicitly use STADDL to implement odp_atomic_add_rel_u32() and odp_atomic_sub_rel_u32() functions for better performance. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-04linux-gen: atomic: use STADD explicitly for aarch64 atomic add operationsMalvika Gupta
By default, GCC generates the LDADD/LDADDL instruction for atomic add/sub/inc/dec functions. These functions could also be implemented on ARMv8.1 ISA (and above) with the store version, STADD/STADDL instruction which result in better performance for fastpath applications. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30linux-gen: cpu: refactor inlining codeMatias Elo
Refactor CPU ABI and implementation files to follow common project inlining style. odp_cpu_pause() function is now defined only once per architecture. After this clean-up it's simpler for an implementation to add inlined versions of CPU module functions. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-09-03linux-gen: atomic: add missing inline function includeMatias Elo
Previously, inlined atomic functions (atomic_inlines.h) were not included through the API headers in non-ABI compat mode on aarch64 platforms. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-05-31linux-gen: time: implement strict time stamp read functionsPetri Savolainen
Implemented strict versions of local and global time stamp read functions. Moved time register read code into inline functions on ARMv8. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-04-16linux-gen: detect cpu cache line size during configureMatias Elo
Detect CPU cache line size automatically on aarch64 systems when abi- compatibility is disabled. Automatic cache line size detection is disabled when cross-compiling. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-03-31linux-gen: sysinfo: add new ARMv8 and v9 enumerationsPetri Savolainen
Added support for ARM ISA versions: ARMv8.7-A, ARMv9.0-A, ARMv9.1-A and ARMv9.2-A. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-03-29linux-gen: bitset: move aarch64 specific code to arch filesMalvika Gupta
On arm64 systems, the build fails with the --disable-host-optimization compiler flag as it is unable to locate definitions of lockless APIs used in atomic bit operations since these declarations are present in arch/aarch64/odp_atomic.h files Consequently, the aarch64 specific code has been moved to the arch-specific file while the reminder code has been moved under the default linux-generic implementation. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-03-23linux-gen: queue_lf: move aarch64 specific code to arch filesMalvika Gupta
On arm64 systems, the build fails with the --disable-host-optimization compiler flag as it is unable to locate definitions of lockless APIs present in arch/aarch64/odp_atomic.h files. Consequently, the aarch64 specific code in odp_queue_lf.c has been moved to the arch-specific file while the reminder code has been added to a new file under the default linux-generic implementation. Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com> Reviewed-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-03-19linux-gen: atomic: optimize arm64 128-bit implementationMatias Elo
Optimize arm64 specific 128-bit atomics implementation. The init function doesn't have to be atomic and CAS operations' 'old_val' needs to be updated only on failure. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-03-19linux-gen: atomics: implement 128-bit operations using gcc builtinsMatias Elo
Add new implementation for the 128-bit atomic operations using GCC builtin atomics. This improves performance considerably compared to the basic lock-based implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-03-19linux-gen: atomic: move odp_atomic_lock_free implementations under archMatias Elo
Enables architecture specific implementations. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>