aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/arch/x86
AgeCommit message (Collapse)Author
2024-04-16linux-gen: hash: use unaligned types in _odp_hash_crc32c()Jere Leppänen
Since the data is not necessarily aligned, use unaligned types to read it, in order to avoid undefined behavior. Fixes GCC undefined sanitizer errors: hash_crc32.h:35:24: runtime error: load of misaligned address 0x0000005e12d4 for type 'const uint64_t', which requires 8 byte alignment hash_crc32.h:40:14: runtime error: load of misaligned address 0x0000005ff879 for type 'const uint32_t', which requires 4 byte alignment hash_crc32.h:51:47: runtime error: load of misaligned address 0x0000005e67af for type 'const uint16_t', which requires 2 byte alignment Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
2024-03-18linux-gen: update copyright formatMatias Elo
Update all implementation files to use the new shorter copyright format: /* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) <YEAR> <COPYRIGHT HOLDER> */ Inherited DPDK copyright messages have also been updated to utilize SPDX format and now list the original source files. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2024-03-08linux-gen: use _odp_strcpy() instead of strncpy()Jere Leppänen
Use _odp_strcpy() instead of strncpy(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2024-01-25linux-gen: time: improve TSC frequency measurementJanne Peltonen
Speed up TSC frequency measurement and thus ODP startup by reducing the measurement duration. Make the result more accurate despite the decreased duration by using a busyloop instead of nanosleep and by taking the median of several measurements. Using a busyloop instead of nanosleep also fixes the measurement in (old) systems that have constant but not invariant TSC which may stop or change frequency in C-states. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2023-07-12linux-gen: sync: implement new memory barriersPetri Savolainen
Implement the new load and store synchronization barriers with x86 and aarch64 instructions. The default implementation falls back to the strongest GCC built-in (__sync_synchronize()), which would be the strong enough on x86 (mfence), but too weak on aarch64 (dmb). 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>
2023-07-03linux-gen: cpu: detect constant_tsc from cpuinfoMatias Elo
INVTSC x86 CPU flag may not be always available with VMs. So, try also to find 'constant_tsc' flag from /proc/cpuinfo. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2023-06-21linux-gen: time: refactor implementationMatias Elo
Refactor time codebase to enable more optimized architecture specific implementations. After this commit x86 and aarch64 architectures are assumed to always have support for HW time. The fallback to POSIX time functions has been removed from these architectures for improved performance. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2023-06-13linux-gen: cpu: update x86 CPU flags codeMatias Elo
Update x86 CPU flags code from DPDK v23.03. DPDK copyright has been updated to the currently used format. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@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>
2021-11-25linux-gen: random: implement crypto random and true random data on x86Jere Leppänen
Implement crypto random data using rdrand, and true random data using rdseed, via compiler builtin functions. Add architecture-specific file for crypto random and true random functions. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@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-06-01linux-gen: hash: fix conversion warningMatias Elo
Fix conversion warning "uint32_t {aka unsigned int}' from 'long long unsigned int' may alter its value". Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@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-07linux-gen: hash: use x86 crc32 instructionsJere Leppänen
Use x86 SSE 4.2 crc32 instructions via gcc builtin functions, if available. These instructions support crc32c only. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-02-12linux-gen: introduce _ODP_UNALIGNED macroJere Leppänen
The _ODP_UNALIGNED pre-processor macro is defined as 1 if the CPU features efficient unaligned memory access, 0 otherwise. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-12-23linux-gen: rename some global symbols in the static libraryJere Leppänen
Rename some symbols that are global in the static library, in order to avoid clashes with application code. The prefix "_odp_" is added to the existing names. This patch renames most of the global symbols, a few more still remain to be renamed. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-11-18linux-gen: sysinfo: implement system info callPetri Savolainen
Implement the new odp_system_info() function. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Govindarajan Mohandoss <Govindarajan.Mohandoss@arm.com>
2020-05-04linux-gen: config: rename CONFIG_NUM_CPU to CONFIG_NUM_CPU_IDSMatias Elo
Rename internal define CONFIG_NUM_CPU to CONFIG_NUM_CPU_IDS to avoid confusion. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2019-09-27linux-gen: include config.h header in install directoryMatias Elo
Previously, config.h header was not included in install dir. This caused a compilation failure when an application tried to include ODP helper headers. config.h has been moved to include/odp subdirectory to avoid naming conflicts and unnecessary includes have been removed. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reported-by: Mikko Parpala <mikko.parpala@nokia.com>
2018-11-14linux-gen: run without /proc mountedMaxim Uvarov
Some systems may have /proc interface not mounted, let odp linux generic run there with dummy values. https://bugs.linaro.org/show_bug.cgi?id=3989 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
2018-09-10linux-gen: x86: as a last resort parse max cpu freq from bogomips valueDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-07-05linux-gen: sysinfo: use cpufreq for max freq by defaultPetri Savolainen
Usually, maximum CPU frequency is found from a cpufreq file. Read that file first, if it's not found use cpuinfo instead. If max freq cannot be found, use hard coded value and print a warning. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-07-05linux-gen: cpu: move num cpu into config header filePetri Savolainen
Rename and move number of CPUs define into the config header file. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-31linux-gen: time: inline arch cpu time on x86Petri Savolainen
Inline cpu HW time counter read function on x86. Time global data structure is visible to applications, but Posix types (timespec) or header files are not. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-28linux-gen: cpu: inline cpu cycle functions on x86Petri Savolainen
Moved cpu cycle and pause functions into arch/x86/odp_arch_cpu_inlines.h. Uncommented pause function in spec file and removed it from ABI file. It's safer for ABI compat mode to not have code included into ABI spec files. Other architectures use the default odp_arch_cpu_inlines.h, which does not change the current implementation. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-28linux-gen: cpu: add cpu cycles init globalPetri Savolainen
Add global init function to check e.g. if CPU cycle counter instruction is available on x86. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-28linux-gen: init: split odp_internal.hPetri Savolainen
odp_internal.h contained code for three different purposes. Split file into three different headers, so that it's no more a place for random type/function prototype additions. New files are: * odp_init_internal.h which holds global/local init function prototypes * odp_global_data.h which defines global data structure * odp_sysinfo_internal.h which contains system info internal function prototypes Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-02-26update Linaro Copyrights to 2018 year part2Maxim Uvarov
update Copyrights with the same script in rebased branch. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-02-26update Linaro Copyrights to 2018 yearMaxim Uvarov
Using simple commands: find . -not -path .git -type f -exec \ sed -i -E 's/ (201[0-9]), Linaro/ \1-2018, Linaro/g' {} + find . -not -path .git -type f -exec \ sed -i -E 's/ (201[0-9])(-201[0-9]), Linaro/ \1-2018, Linaro/g' {} + Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
2018-01-18linux-gen, include: drop interm _ODP_CACHE_LINE_SIZE defineDmitry Eremin-Solenikov
_ODP_CACHE_LINE_SIZE is only used to define ODP_CACHE_LINE_SIZE. Drop interim define and make cpu.h directly define ODP_CACHE_LINE_SIZE. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-01-18linux-gen, include: switch cpu.h to api+abiDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-12-27linux-gen: update api-next to follow merged changesDmitry Eremin-Solenikov
There were changes in master branch on the way architecture files are treated. Update api-next after merging in master to follow those changes. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-12-27linux-gen: sched scalable: add arch filesBrian Brooks
Signed-off-by: Brian Brooks <brian.brooks@arm.com> Signed-off-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-and-tested-by: Yi He <yi.he@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-12-27linux-gen: arch: single cpu cycles filePetri Savolainen
CPU cycle functions were mixed over odp_cpu_cycles.c and odp_cpu_arch.c files. Implement all three cpu cycle API functions in odp_cpu_cycles.c. odp_cpu_arch.c is deleted. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-12-27linux-gen: arch: cpu arch specific time headerPetri Savolainen
Rename odp_time_internal.h to odp_arch_time_internal.h, and move it under arch directory. This header specifies internal CPU arch specific time counter functions. All architectures must implement these functions. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-10-11linux-gen: x86: fix on odp_cpu_arch_hz_current() declaration for x86Ilias Apalodimas
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-10-11linux-gen: use /proc/cpuinfo if sysfs is not available to get cpu infoIlias Apalodimas
PR#171 broke some of the functionality we had on getting cpu speed. This patch reverts parts of that commit adding a fallback when /sys/devices/system/cpu/cpuX/cpufreq/ is not available. Solves https://bugs.linaro.org/show_bug.cgi?id=3249 Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-10-03linux-gen: deduplicate arch-specific filesDmitry Eremin-Solenikov
Rewrite ARCH-specific files so that there is no significant code duplication between different arch files and default files set. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-09-15linux-gen: system: correctly set CPU frequencyKelvin Cheung
When CPU frequency info under /sys is available, use the real value instead of default value. Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-08-25automake: move nostdinc Automake option to configure.acDmitry Eremin-Solenikov
It is quite logical to enable nostdinc option non global level instead of defining it only for some of the tests. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-08-25linux-gen: use config.h headerDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-06-16linux-gen: time: improve x86 TSC freq measurement accuracyPetri Savolainen
Add short warm up round and measure over a longer period of time (250ms vs 100ms). Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-06-16linux-gen: time: use hw time counter when availablePetri Savolainen
Use 64 bit HW time counter when available. It is used on x86 when invariant TSC CPU flag indicates that TSC frequency is constant. Otherwise, the system time is used as before. Direct HW time counter usage avoids system call, and related latency and performance issues. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-06-16linux-gen: system: implement system info printPetri Savolainen
Print API, impl name, CPU model/freq, cache line size and CPU count by default. Print CPU flags in case of x86. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-06-16linux-gen: cpu_flags: added x86 cpu flag read functionsPetri Savolainen
When building on x86 CPU flags can be used to determine which CPU features are supported. CPU flag definitions and the code to read the flags is from DPDK. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-07-27linux-generic: internal cache line sizeBrian Brooks
Define the ODP API for cache line size to the cache line size defined in the internal architecture directories. Prefix internal cache line size identifier with '_odp'. Signed-off-by: Brian Brooks <brian.brooks@linaro.org> Reviewed-by: Christophe Milard <christophe.milard@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-05-17linux-generic: drop odp_ prefix for internal cpuinfoMaxim Uvarov
A little bit code clean up to drop odp_ prefix from internal things and rename huge_pages to default_huge_pages internal struct. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bll.fischofer@linaro.org>
2016-03-31linux-generic: sysinfo: handle missing @ sign in CPU modelJuha-Matti Tilli
Previously, the sysinfo cpuinfo parser assumed that every CPU model has an @ sign, after which comes the maximum CPU frequency. However, many environments such as virtualized KVM environments have CPU models not having @ sign such as "Intel Xeon E312xx (Sandy Bridge)". The result of the missing @ sign was that the ODP program crashed. The fix is to not assume the @ sign is always there. This may leave cpu_hz_max uninitialized, but then again this is already what is done if the string after @ does not conform to the pattern. Signed-off-by: Juha-Matti Tilli <juha-matti.tilli@nokia.com> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-03-04linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch fileHongbo Zhang
Currently all ODP_CACHE_LINE_SIZE macros for different architectures are held in one header file, they should be moved to their own arch file. This patch moves ODP_CACHE_LINE_SIZE for x86. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-03-04linux-generic: Makefile: fix broken include pathAnders Roxell
Fix build error while building an application against ODP /media/data/src/install-odp-api-next/include/odp/api/cpu.h:20:26: fatal error: odp/cpu_arch.h: No such file or directory #include <odp/cpu_arch.h> compilation terminated. Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Reviewed-by: Christophe Milard <christophe.milard@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>