In metal_sys_io_mem_map() if the I/O region size
is a multiple of (1<<page_shift) will result in a
buffer overflow in the for loop.
Therefore, adjust loop termination condition to
prevent accessing an out-of-bounds page.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
lib/errno.h: defined(__ARMCC_VERSION) for use GCC compile
lib/autmoic:fix compiler error:
nuttx/include/metal/compiler/gcc/atomic.h:19:13: error: conflicting type
qualifiers for 'atomic_flag'
19 | typedef int atomic_flag;
| ^~~~~~~~~~~
In file included from nuttx/include/nuttx/net/netdev_lowerhalf.h:38,
from virtio/virtio-net.c:33:
prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/
stdatomic.h:233:3: note: previous declaration of 'atomic_flag' with
type 'atomic_flag'
233 | } atomic_flag;
| ^~~~~~~~~~~
nuttx/include/metal/compiler/gcc/atomic.h:20:14: error: conflicting
type qualifiers for 'atomic_char'
20 | typedef char atomic_char;
^~~~~~~~~~~
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
The metal_yield API needs also to be declared for the baremetal systems.
This fix build issue in Open-amp for generic system:
/github/workspace/open-amp/lib/rpmsg/rpmsg_virtio.c:275:17:
error: implicit declaration of function 'metal_yield'
275 | metal_yield();
| ^~~~~~~~~~~
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Define metal_yield in sys.h files is more flexible to manage this
in libmetal, metal_yield would be managed at the OS level and
dispatched to metal_cpu_yield, metal_sleep_usec, or others.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
This return code is for system calls only, and checkpatch warns about the
same. Remove the use of this return code.
Signed-off-by: Andrew Davis <afd@ti.com>
These functions are labeled METAL_INTERNAL so should have no external
users, but they are not used internally either. Remove these functions.
Signed-off-by: Andrew Davis <afd@ti.com>
Simplify logic that coordinates when to pull in Xilinx-AMD BSP and setup code
basedd on new CMake variable 'PROJECT_VENDOR'.
Add PROJECT_VENDOR check in cmake/options.cmake for case where PROJECT_VENDOR
is not defined.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
fix following warning:
lib/log.h:91: warning: argument 'args...' of command @param is not found
in the argumentlist of metal_log(level, fmt, args...)
lib/log.h:98: warning: The following parameter of
metal_log(level, fmt, args...) is not documented:
parameter 'args...'
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Check if valid MPU flag is set or not. Current condition checks
if flag is 0 or not, which is not intended use of flags
Signed-off-by: Rajiv Mohan <rajiv.mohan@amd.com>
Follow the virtio spec v1.2:
The driver MUST only use 32 bit wide and aligned reads and writes to access
the control registers described in table 4.1. For the device-specific
configuration space, the driver MUST use 8 bit wide accesses for 8 bit
wide fields, 16 bit wide and aligned accesses for 16 bit wide fields
and 32 bit wide and aligned accesses for 32 and 64 bit wide fields.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
FreeRTOS patch for Avoiding memory mapping in MPU config table for region
that are already mapped by bsp and no change in attribute property
Signed-off-by: Rajiv Mohan <rajiv.mohan@amd.com>
Avoiding memory mapping in MPU config table for region that are already
mapped by bsp and no change in attribute property.
Signed-off-by: Rajiv Mohan <rajiv.mohan@amd.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
For AMD-Xilinx tooling, there is a new System Device Tree (SDT) BSP
with different symbols for GIC than the classic BSP. This causes issues
when linking Libmetal against the SDT Flow BSP. Note that there is a
planned deprecation of the classic BSP.
For AMD-Xilinx System Device Tree (SDT) Flow, one of the files provided
by BSP is bspconfig.h. This file provides reference to the symbols that
describe GIC Device ID and GIC distributor Base Address. AMD-Xilinx
tools that use the SDT Flow BSP will provide symbol 'SDT' to signal that
the SDT Flow BSP is present. If SDT symbol is present then the Libmetal
build will include the new header "lib/system/generic/xlnx/sdt.h" to
preserve library build.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
This define should be used instead of the Kconfig option to determine if
the k_malloc family of functions are available.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
arch_cpu_idle() is an internal API that should not be used
outside of the main Zephyr. Use k_cpu_idle() instead, which
is the same thing (at least for now).
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Refactor all processor headers which had the same content
into a generic set, to reduce the number of duplicates.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add a new hosted test environment "processor".
This is meant as a build target used when the
code is not built for a real target
but as part of a test in a hosted environment
(for ex. as a test environment like Zephyr's
native_sim target).
When building for this target PROJECT_PROCESSOR
should be set as "hosted".
In this, the "metal_sleep_usec()" call
is expected to be provided by the system folder
headers.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The new guards prevent redefinition of errno values which have already
been defined in the standard libraries.
Signed-off-by: Ledion Daja <ledion.daja@arm.com>
The predefined macro __CC_ARM available on 5.x is migrated to the
macro __arm__ for the version 6.x. Add defines to support both versions.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
CPU0 CPU1
create_ept1:addr1 create_ept1
OK <====== msg1
OK <====== msg2
OK <====== msg3
msg4
<====== msg4 on the virtioqueue
close_ept1 close_ept1
create_ept2:addr1 create_ept1
(same addr with ept1)
msg4
ept2 recv ept1 msg ERROR <======
The msg4 which belong to ep1, error received by ept2.
For the issue, I give a resolve method,
for the rpmsg_get_address(), always return a new increased num.
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Move common code in Xilinx area to consolidated location to remove
redundant code.
Enable A72 and A78 build in BSP for FreeRTOS OS.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Move common code in Xilinx area to consolidated location to remove
redundant code.
Enable A72 and A78 build in Standalone BSP.
lib: generic: Add support for a78 with System Device Tree flow
System Device Tree workflow is AMD-Xilinx workflow whereby the BSP,
libraries and applications in software are derived from a
hardware-design. The hardware-design is used to generate a system
device tree (SDT) that describes information for Linux and other
processing environments.
The xreg/xcpu files are not generated for SDT workflow. Because of
this do not include if SDT symbol is present in BSP.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
lib/utilities.h provided MB and GB macros so include from there
instead of providing the definition again for a53 platforms.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Remove all remaining instances of "# vim: ..." in files.
This vim settings were part of the initial commit. But no reason
to keep them.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Add convenience macros metal_err, metal_warn, metal_info, metal_dbg
to avoid using excessively long and redundant metal_log(METAL_LOG_*).
Add "function-name:line-number" prefix to all messages if the option
WITH_FUNC_LINE_LOG is set ON during the configuration phase.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
As lib/system/generic/sys.h has metal/errno.h add this to the freertos
equivalent.
This fixes some compilation issues when linking against certain FreeRTOS port
BSPs.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
The lib/atomic.h exports memory_order enum into the global namespace,
but none of its enumerators. According to Section 7.3.3 "The using
declaration" of the C++ standard: "specifying an enumeration name
in a using-declaration does not declare its enumerators in
the using-declaration's declarative region." See also:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0943r1.html
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
This should have no functional change, but makes this header consistent
with how the other headers are organized.
Signed-off-by: Andrew Davis <afd@ti.com>
Enable cache, IPI, exception and shared-memory operations on Versal A72
for Libmetal.
Additionally, as the code for A72 and A53 is almost identical, move
the common code to generic/xlnx_common/zynqmp_aarch64 and differentiate
the slight differences with macro checks.
Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Acked-by: tanmay.shah@xilinx.com
The METAL_MUTEX_INIT macro has been deprecated in release 2021.04.0
Remove it after it has been in a deprecated state for 2 years.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Missing header became evident after a code refactor in another NuttX
component, which resulted in build warnings.
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Declare PROJECT_EC_FLAGS to be a global property
to simplify code for target_compile_options.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
The metal_machine_io_mem_map() used to call Xil_SetMPURegion directly
and could get into an infinite loop. Replace the faulty code in
metal_machine_io_mem_map() with Xil_MemMap() call and assert it succeeds.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>