Commit graph

410 commits

Author SHA1 Message Date
wangzhi16
d84ba608a1 use small lock in following files:
arch/arm/src/am335x/am335x_can.c
    arch/arm/src/am335x/am335x_gpio.c
    arch/arm/src/am335x/am335x_i2c.c
    arch/arm/src/am335x/am335x_irq.c
    arch/arm/src/am335x/am335x_serial.c
    arch/arm64/src/imx9/imx9_gpio.c
    arch/arm64/src/imx9/imx9_lpi2c.c
    arch/arm64/src/imx9/imx9_lpspi.c
    arch/arm64/src/imx9/imx9_usbdev.c
    arch/x86_64/src/intel64/intel64_tsc_tickless.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:32:23 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
hujun5
57ca4e1789 up_rtc_gettime: add spinlock to protect up_rtc_gettime
reason:
We have removed the critical section protection
for the up_rtc_gettime function in common code.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-06 23:07:58 +08:00
buxiasen
89455bc9a1 arch: up_getusrsp change to inline and implement in irq.h
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
buxiasen
9bdcc4dc4b arch/irq.h: update all inline to inline_function
Inline & inline_function both used make confuze, let's modify all inline
in irq.h to inline_function, also clear the always_inline_funcion
declaration.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
wangzhi16
893c5e92c2 Reduce the size of tcb by four bytes.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-02 23:18:42 +08:00
p-szafonimateusz
eeef185558 arch/x86_64/include/intel64/irq.h: align definitions
align all definitions in intel64/irq.h

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-01-02 23:11:38 +08:00
p-szafonimateusz
cfaeb74dd3 arch/intel64: allow to attach handlers to ISR
arch/intel64: allow to attach handlers to ISR

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-01-02 23:10:14 +08:00
liwenxiang1
1fad0f1654 arch/x86_64: this_task is stored in the CPU private data
By default in SMP, obtaining this_task requires disabling interrupts, obtaining the current CPU index, accessing a global variable, and re-enabling interrupts. Storing this_task in percpu makes retrieval faster.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-01-02 15:19:25 +08:00
liwenxiang1
c748047e25 arch/x86_64: The interrupt context flag is stored in the CPU private data
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-12-31 13:43:38 +08:00
liwenxiang1
4612185cd6 arch/x86_64:g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-12-30 22:59:15 +08:00
hujun5
ecdff659d1 modifyreg[8|32]: use small lock in modifyreg[8|32]
reason:
We would like to replace the big lock with a small lock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-19 21:55:21 +08:00
hujun5
75ddce6e3a modifyreg16: use small lock in modifyreg16
reason:
We would like to replace the big lock with a small lock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-18 20:28:26 +08:00
Alin Jerpelea
658e4ffae2 arch/x86_64: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-18 17:51:57 +08:00
chao an
60636c4666 drivers/pci: fix typo addres -> address
fix typo addres -> address

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-17 20:48:07 +08:00
hujun5
dabf589940 remove redundant judgments *running_task != NULL
reason:
In irq, g_running_tasks is always valid.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 22:50:08 +08:00
hujun5
bc844509e2 addrenv: Ensure that the transmission parameter of addrenv_switch is not NULL
reason:
avoid obtaining this_task multiple times.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 14:20:12 +08:00
Alin Jerpelea
5e0347b20a arch/x86_64: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-02 17:23:25 +08:00
hujun5
0bba53ce12 remove redundant scheduling records
reason:
Since the scheduling records have already been moved to the interrupt exit in this submission,
we need to delete the original records' locations.
This commit fixes the regression from https://github.com/apache/nuttx/pull/13651

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-28 18:56:13 +08:00
p-szafonimateusz
eca40ff053 arch/x86_64/intel64: re-enable interrupts before syscall handle
arch/x86_64/intel64: re-enable interrupts before syscall handle
2024-11-27 13:32:23 -03:00
p-szafonimateusz
908ac756ea arch/x86_64/intel64: remove unnecessary nested syscalls logic
remove unnecessary nested syscalls logic, it's already handled different way
2024-11-27 13:32:23 -03:00
p-szafonimateusz
e7d6f2c044 arch/x86_64/intel64_irq.c: remove some magic numbers
arch/x86_64/intel64_irq.c: remove some magic numbers

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
e95ea6fbc4 arch/x86_64: handle TLB shootdown
arch/x86_64: handle TLB shootdown

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
ce22c28e88 arch/x86_64: add kernel stack support
arch/x86_64: add kernel stack support

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
712e8d9cc7 arch/x86_64: add kernel build support
arch/x86_64: add kernel build support

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
8702fbef8d arch/x86_64/include/intel64/arch.h: align definitions
arch/x86_64/include/intel64/arch.h: align definitions

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
d51ceccd7b arch/x86_64: add syscalls support
arch/x86_64: add syscalls support

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
7f4279b8af arch/x86_64/: fix broken set_cr3()
arch/x86_64/: fix broken set_cr3()

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 13:32:23 -03:00
p-szafonimateusz
825ba8ed7b arch/x86_64/intel64: fix revoke_low_memory
fix revoke_low_memory, problem found by Xiangzhen Ouyang.

g_pt_low mapping is removed during revoke_low_memory so we can't access this memory area with 1:1 mapping.
This logic has been broken for a long time, but for some reason it worked without any crash at boot.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 03:28:37 +08:00
p-szafonimateusz
894b0f956b arch/x86_64/intel64: up_disable_irq should work from any CPU
simplify interrupt logic and allow any CPU
to disable interrupt, not only CPU that enabled it.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 03:03:05 +08:00
hujun5
ef313755e7 sched: replace up_cpu_index with this_cpu
Make this_cpu is arch independent and up_cpu_index do that.
In AMP mode, up_cpu_index() may return the index of the physical core.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-27 03:00:32 +08:00
yinshengkai
0194c2f88a gcov: update gcov compilation parameters
profile-generate is used to generate compilation feedback optimization data, not just code coverage data

It will rely on the toolchain library:
nuttx/libs/libc/misc/lib_utsname.c:94:(.text.uname+0x2c): undefined reference to `__gcov_indirect_call_profiler_v4'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x178): undefined reference to `__gcov_indirect_call'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x188): undefined reference to `__gcov_time_profiler_counter'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_utsname.o):(.data..LPBX0+0x30): undefined reference to `__gcov_merge_time_profile'

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
wangmingrong1
1f2d1e97e8 x86-64: Added KASan compilation options
Sorry for this commit: 6cd43777c3
This is the real x86-64 modification, and this patch is x86
Fortunately, except for the error in the previous modification, the actual architecture is supported

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-22 15:06:02 +08:00
hujun5
19b4911d7f arch: remove up_current_regs in common code
reason:

When entering an exception or interrupt, there are two sets of registers:
one is the "running regs", which we need to save,
and the other is the "ready to running regs", which we may soon use.
For consistency in logic, we can always store the "running regs" in the regs field of g_running_tasks,
otherwise it may lead to errors in the storage location of the "running regs."

When we need to access the "running regs," we should uniformly retrieve them from the regs field of g_running_tasks.

As the next step, we will rename the set_current_regs/up_current_regs functions
for each architecture to more appropriate names, solely for the purpose of identifying interrupts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-15 18:25:35 +08:00
wangmingrong1
17ce9b86c1 gcov: Correct existing gcov configuration
1. add CONFIG_COVERAGE_ALL to replace CONFIG_SCHED_GCOV_ALL
2. Correct all SCHED_GCOV, SCHED_GCOV_ALL

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-15 01:05:16 +08:00
p-szafonimateusz
bb98911a11 arch/x86_64/intel64: add support for framebuffer
arch/x86_64/intel64: add support for framebuffer

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-15 01:04:52 +08:00
ligd
561e1fc879 x86_64: fix compile warning
In function ‘void* std::__1::__libcpp_operator_new(_Args ...) [with _Args = {long unsigned int}]’,
    inlined from ‘void* std::__1::__libcpp_allocate(size_t, size_t)’ at /home/ligd/platform/trunk/nuttx/include/libcxx/new:294:31,
    inlined from ‘_Tp* std::__1::allocator<_Tp>::allocate(size_t) [with _Tp = char]’ at /home/ligd/platform/trunk/nuttx/include/libcxx/__memory/allocator.h:114:62,
    inlined from ‘constexpr std::__1::__allocation_result<typename std::__1::allocator_traits<_Alloc>::pointer> std::__1::__allocate_at_least(_Alloc&, size_t) [with _Alloc = allocator<char>]’ at /home/ligd/platform/trunk/nuttx/include/libcxx/__memory/allocate_at_least.h:55:27,
    inlined from ‘void std::__1::basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, const value_type*) [with _CharT = char; _Traits = std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’ at /home/ligd/platform/trunk/nuttx/include/libcxx/string:2325:49,
    inlined from ‘std::__1::basic_string<_CharT, _Traits, _Allocator>& std::__1::basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type*, size_type) [with _CharT = char; _Traits = std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’ at /home/ligd/platform/trunk/nuttx/include/libcxx/string:2431:26,
    inlined from ‘std::__1::basic_string<_CharT, _Traits, _Allocator>& std::__1::basic_string<_CharT, _Traits, _Allocator>::assign(const value_type*, size_type) [with _CharT = char; _Traits = std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’ at /home/ligd/platform/trunk/nuttx/include/libcxx/string:2444:35:
/home/ligd/platform/trunk/nuttx/include/libcxx/new:270:24: warning: argument 1 value ‘18446744073709551599’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  270 |   return ::operator new(__args...);

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-11-04 18:06:09 +08:00
ouyangxiangzhen
17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
xuxin19
b8523280c2 cmake(bugfix):fix cxx build error on fastDDS X86_64
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
xuxin19
c60b980968 cmake(bugfix):fix robot openlibm cmake build missing source error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
wangmingrong1
e3d7d23618 gcov: Fix typographical errors
1. CONFIG_ARCH_COVERAGE has been replaced by CONFIG_SCHED_GCOV
2. Delete the SIM-specific GCOV_ALL configuration and change it to a universal configuration for all architectures

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-30 14:45:23 +08:00
chao an
c6591c0f49 driver/serial: remove return value of up_putc()
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, #20                         |  de50: e24dd014  sub sp, sp, #20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, #248  @ 0xf8                  |  de58: e30030f8  movw  r3, #248  @ 0xf8
de5c: e3423000  movt  r3, #8192 @ 0x2000                |  de5c: e3423000  movt  r3, #8192 @ 0x2000
de60: e58d300c  str r3, [sp, #12]                       |  de60: e58d300c  str r3, [sp, #12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, #12]                       |  de68: e59d000c  ldr r0, [sp, #12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, #20
de74: e1a00003  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, #20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
Haiyue Wang
d0f957ae85 qemu-intel64: Fixes the linker 'noexecstack' warning
Fix the linker warning based on these two commits:

 ld: warning: fork.o: missing .note.GNU-stack section implies executable stack
 ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

commit 36ac812114 ("sim: Fixes the following linker warning:"),
commit b5d640acc5 ("fix Cygwin/MSYS2  ld: unrecognized option '-z'")
2024-10-26 11:10:43 +08:00
cuiziwei
12fd5ec472 nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide by toolchain.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-24 01:38:03 +08:00
liwenxiang1
eb722794b5 arch/x86_64:Fix variable used before assignment
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-23 14:28:59 +08:00
cuiziwei
541f30878a arch/x86_64:Add CXX configuration for enabling x86_64 support for C++ applications.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-18 23:53:35 +08:00
Xiang Xiao
c6aed84638 tools: Rename apps-or-nuttx-Make.defs to Make.defs
follow the same pattern as other Make.defs files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-17 07:55:02 +08:00
yangsong8
8c13b8df1d syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-17 02:29:51 +08:00
liwenxiang1
eb27ebba8a arch/x86_64: The AP retrieves this_task after storing the CPU private data
this_task obtains the CPU ID through the GS register, so the initial value of GS needs to be configured in x86_64_cpu_priv_set

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>

x86_64/intel64: fix SMP compilation warnings

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-16 22:09:00 +08:00
liwenxiang1
8a1743d0a6 arch/x86_64: Resolving NUC Boot Failure Issue
The segment of the Xen PVH boot protocol was not specified during linking and was placed before .loader.text, causing the boot to fail

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-16 13:53:11 +08:00