Commit Graph

54410 Commits

Author SHA1 Message Date
buxiasen
fba0324bd7 libc/misc/crc32: crc32 add slow mode, optional decrease size
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-12 16:17:21 +02:00
Jukka Laitinen
08949dec66 arch/arm64/src/imx9/imx9_lpi2c.c: Cleanups and error fixes
Clean up the interrupt-driven logic in the driver; handle error cases properly,
remove dead code and simplify logic.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-12 10:27:12 -03:00
Huang Qi
75e4bd1389 docs: Migrate MPS board documentation
Migrate docs of MPS board from its board directory to
common Documentation place.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-12 10:26:08 -03:00
Jukka Laitinen
9bee10f05e imx9/edma: Fix function prototypes
Change "DMACH_HANDLE *handle" into "DMACH_HANDLE handle". The DMACH_HANDLE is already
defined as "void *".

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-12 10:25:17 -03:00
Jukka Laitinen
201be401c0 arch/arm64/src/imx9/imx9_lowputc.h: Allow linking to C++ by adding extern "C"
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-12 10:24:40 -03:00
Jukka Laitinen
b805b73681 arch/arm64/src/imx9/imx9_lowputc.c: Fix a some preprocessor macros
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-12 10:24:40 -03:00
YAMAMOTO Takashi
419da0209f esp32: retire 0001-esp32-Connect-Xtensa-Instruction-RAM1-to-Cache.patch
This file is no longer used.
2024-09-12 21:17:04 +08:00
YAMAMOTO Takashi
64804be879 arch/xtensa/src/esp32/Bootloader.mk: stop applying a local patch
From @tmedicci
https://github.com/apache/nuttx/pull/13311#issuecomment-2343486553
2024-09-12 21:17:04 +08:00
YAMAMOTO Takashi
e02325a0a6 esp32: Port the bootloader patch
currently esp32 protected mode requires a patched bootloader.
it's a bit cumbersome to build the bootloader for that purpose.

this commit attempts to remove the need of the patched bootloader
by applying the changes by ourselves using esp hal.
2024-09-12 21:17:04 +08:00
ligd
8b4b66ef73 clock: fix clock_timespec_subtract() error when use TIME32
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29
fc5e37e57b math32: Integer overflow occurs in arithmetic on constant operands
https://coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1266083

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
7fc03e0084 lib: generic optimization for constant divisor on 32-bit machines
64-by-32-bit divisions are prominent in the NuttX, even on 32-bit
machines.  Luckily, many of them use a constant divisor that allows
for a much faster multiplication by the divisor's reciprocal.

The compiler already performs this optimization when compiling a 32-by-32
division with a constant divisor. Unfortunately, on 32-bit machines, gcc
does not optimize 64-by-32 divisions in that case, except for constant
divisors that happen to be a power of 2.

Let's avoid the slow path whenever the divisor is constant by manually
computing the reciprocal ourselves and performing the multiplication
inline.  In most cases, this improves performance of 64-by-32 divisions
by about two orders of magnitude compared to the __div64_32() fallback,
especially on architectures lacking a native div instruction.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
849b2e8c10 clock.h: use roundup to handle clock_time2ticks()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
f0d3c8ab2b usleep: use div_const to optimize the usleep
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
yinshengkai
62047aa3d0 time: fix 32-bit integer truncation warning
CID 1266677: (#2 of 2): Use 32-bit time_t (Y2K38_SAFETY)
1. declaration_with_small_time_t: Declare use of time_t, which is defined as 32 bits wide on this platform, while the minimum safe width is 64.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29
f4a650a1c0 clock: Incorrect use of unsigned number
https: //coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1275849

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
a4ffa84974 clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
cce5280ebf clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
48f2a07ce7 clock: generic optimization for constant divisor on 32-bit machines
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
fae6a00e02 clock: refactor clock_systime_timespec() & clock_systime_ticks()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
76e807560e clock: take clock_abstime2ticks() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
07a4233d1d clock: refactor clock_gettime clock_settime
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
6a2c03732f clock: Replace all ts and tick conversion functions
Using the ts/tick conversion functions provided in clock.h

Do this caused we want speed up the time calculation, so change:
clock_time2ticks, clock_ticks2time, clock_timespec_add,
clock_timespec_compare, clock_timespec_subtract... to MACRO

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
a10c46d02e clock: use clock_timespec_add/subtract to optimize code
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
liaoao
45d6b5f8f2 clock: remove cast
Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
f2a77bbcea clock: take clock_timespec_compare/add/subtract() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
chao an
7223a1d0d4 serial/uart_16550: remove up_putc spinlock
putc atomicity should be guaranteed by common code rather than add similar hack to lower half driver

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-12 18:11:30 +08:00
p-szafonimateusz
ff2fe986cf cmake: add support for PCI
PCI framework can be build with cmake

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-12 18:11:13 +08:00
p-szafonimateusz
53d0425ae3 boards/x86_64/qemu-intel64: enable debug messages for PCI test configs
enable debug messages for PCI configuration in qemu-intel64
so we know exactly what happen during execution

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-12 18:10:46 +08:00
Bowen Wang
4fe2a0daf8 pci/pci.c: fix some pci BUGs
fix some pci BUGs that make it impossible to match PCI device

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-12 18:10:46 +08:00
Ville Juven
8e7c0617ff arm64/Kconfig: Make the ARM64_PA/VA_BITS a true Kconfig variable
Enforcing the default 48-bit VA for everyone also implies a 4 page table
translation system. However, if less than 40 bits are needed, a full
translation table level can be dropped, making the translations faster.

Thus, make this into a configurable option, instead of enforcing the same
address widht for everyone.
2024-09-12 17:16:20 +08:00
chao an
c19bdf204c serial/uart_pl011: default syslog needs to check flow control in up_putc
default syslog needs to check flow control in up_putc(), otherwise
up_puts() will lose character if the hardware fifo is full.
2024-09-12 17:15:40 +08:00
wangyingdong
1fe0542711 Expose IPTOS_xxx to the application layer
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2024-09-12 17:15:31 +08:00
wangyingdong
f30e28cafc ipfrag:fix warnig
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2024-09-12 17:15:13 +08:00
Stuart Ianna
779d4af3e9 arch/risc-v/src/litex: Claim all pending PLIC interrupts.
Attempt to service all interrupts pending in the PLIC's claim register. Ideally, this is more efficient than switching context for each interrupt received.
2024-09-12 15:06:04 +08:00
Stuart Ianna
29ee9aacb3 arch/risc-v/common: provide architecture specific perfmon bindings.
Provides two implementations:
 - CSR_CYCLE: Cores which implement hardware performance monitoring.
 - CSR_TIME: Uses the machine time registers.

Using the up_perf_xx bindings directory is more efficient than performing a nanosecond conversion on every gettime event.
2024-09-12 15:04:02 +08:00
caijie
fe4526c7f9 mtd:ramtron MB85RS256B address length is 2 2024-09-12 13:41:51 +08:00
Alin Jerpelea
75ed9a4539 syscall: 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-09-12 02:25:00 +08:00
JianyuWang
a2dd0638b3 Documentation: Add guide for fastboot
See https://github.com/apache/nuttx-apps/pull/2562

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-12 01:35:52 +08:00
hujun5
3619e61c31 sched: adjust the scheduling strategy
1 Only the idle task can have the flag TCB_FLAG_CPU_LOCKED.
  According to the code logic, btcb cannot be an idle task, so this check can be removed.
2 Optimized the preemption logic check and removed the call to nxsched_add_prioritized.
3 Speed up the scheduling time while avoiding the potential for
  tasks to be moved multiple times between g_assignedtasks and g_readytorun.

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-12 01:34:56 +08:00
Alin Jerpelea
eb9030c891 sched: 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-09-12 01:10:14 +08:00
Alin Jerpelea
67d02a45eb net: 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-09-12 01:08:11 +08:00
dongjiuzhu1
881cd3f7db driver/usbdev: support userspace to access ep0
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-11 22:00:26 +08:00
Ville Juven
ca4bd482a0 arm64/task/pthread_start: Fix rare issue with context register location
There is a tiny possibility that when a process is started a trap is
taken which causes a context switch. This moves the kernel stack
unexpectedly and the task start logic no longer works.

Fix this by recording the initial context location, and use that to
trampoline into the user process with interrupts disabled. This ensures
the context stays intact AND the kernel stack is fully unwound before
the user process starts.
2024-09-11 08:59:01 -03:00
Ville Juven
87d9dac817 arm64/syscall: (Re-)enable interrupts only if they were previously enabled
Don't change the CPU state unexpectedly
2024-09-11 19:51:35 +08:00
Ville Juven
498275ca43 arm64/irq: Add mask for DAIF and SPSR DAIF bits
Use them for critical section handling, removes a bit of copy&pasted
code behind CONFIG_ARM64_DECODEFIQ flag
2024-09-11 19:51:35 +08:00
Huang Qi
fc5a029e44 riscv: Unify the extended context save/restore
This patch unifies the extended context save/restore for RISC-V,
allowing the customized context save/restore to be used, for example,
the extended context in rv32m1.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-11 19:50:07 +08:00
Alin Jerpelea
9369b42a65 video: 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-09-11 19:49:53 +08:00
Alin Jerpelea
db49370189 wireless: 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-09-11 19:49:34 +08:00
Ville Juven
48f545d54a arm64/crt0.c: Fix stack alignment when executing signal trampoline
The stack alignment requirement is 16-bytes, not 8-bytes.
2024-09-11 19:49:24 +08:00