Commit Graph

7078 Commits

Author SHA1 Message Date
yinshengkai
d7f02a8cb6 sched: change pthread_mutex implementation from sem to mutex
Since pthread_mutex is implemented by sem, it is impossible to see in ps who holds the lock and causes the wait.
Replace sem with mutex implementation to solve the above problems

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:42:53 +08:00
hujun5
608b59e401 smp: enable smp_call in all smp arch
reason:
In subsequent implementations, we will replace up_cpu_pause with smp_call.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-06 07:11:38 +09:00
hujun5
874c0b002c spinlock: spin_initialize should add memory barrier
reason:
spin_initialize is often used to release a lock,
and if we don't include a memory barrier,
it may lead to the lock being released prematurely.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-05 21:28:52 +08:00
hujun5
b1884d2fa2 wqueue: add interface work_queue_priority_wq and work_queue_priority
reason:
These interfaces are used when we assign interrupt
handling of the same priority to the corresponding priority work queues.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-30 21:40:55 +08:00
ligd
ce2ad51b3a wqueue: expose wqueue API for customization
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-08-30 01:52:22 +08:00
ligd
04e746967a wqueue: remove unused work_foreach() API
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-08-30 01:52:22 +08:00
daichuan
b5753d06f2 support rss/arfs with device
Signed-off-by: daichuan <daichuan@xiaomi.com>
2024-08-30 01:45:06 +08:00
yangsong8
5a39e83c05 usbdev: extend the usb req len to size_t
Some USB controllers can receive or send multiple data packets then
generate one interrupt. This mechanism can reduce the number of data
copies. Extend req buf to accommodate this.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-30 01:32:02 +08:00
chenzhijia
1086a05e50 libc/sysconf: add _SC_GETPW_R_SIZE_MAX
pass tlpi example: https://man7.org/tlpi/code/online/dist/users_groups/t_getpwnam_r.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 09:05:45 +08:00
yangguangcai
efbf43cdfa driver/mem:add Mem Driver.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-28 13:59:04 +08:00
yangsong8
fa1c094e65 usbdev: add usb3.0 ep companion struct and descriptor
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
1dd38fe974 usbdev: unify the parameter of mkconfdesc function
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
07aa8a5c57 usbdev: modify usb device support USB3.0 MaxPacketSize
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
0788e68285 usbdev: usb device descriptor support USB3.0
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
hujun5
572daf46c2 irq: add isr thread
purpose:
To improve the real-time performance of the system, we prefer to perform
as few operations as possible within the interrupt function.
We have designed an interrupt thread for each interrupt,
where all the operations that are not necessary to be handled
in the interrupt function are delegated to be processed by the interrupt thread.
Up_enable_irq will be invoked after isrthread started.

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-08-27 21:49:53 +08:00
pangzhen1
8bb62e532c nuttx/syscall: delete getrandom in syscall.csv
delete getrandom in syscall.csv, because it has been moved to libc.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-27 21:44:33 +08:00
likun17
7913b249ca drivers/regmap: add exit function interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-08-27 21:43:58 +08:00
makejian
8de247543f crypto: export interfaces abort aes-cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
28974b8a21 crypto: export crc32 from /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
Zhe Weng
90c0acce05 net/tun: Support changing carrier state of TUN/TAP
Add TUNSETCARRIER ioctl, then we may change the carrier state of TUN dynamically. Note that we don't need an ioctl for getting carrier, it can be done by SIOCGIFFLAGS already.

Ref: https://github.com/torvalds/linux/blob/v6.10/drivers/net/tun.c#L3374-L3380

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-26 17:34:23 -03:00
yanghuatao
91e341dbda toolchain/ghs: ioexpander_dev_s "declaration is not visible outside of function" warning
CC:  serial/serial_io.c "/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/power/regulator.h", line 227: warning #231-D:
          declaration is not visible outside of function
  int regulator_gpio_init(FAR struct ioexpander_dev_s *iodev,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
edce454d55 toolchain/ghs: Fix trailing comma is nonstandard warnings
"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
ac26e83a45 toolchain/ghs: Fix unknown attribute warnings
"string/lib_strlen.c", line 54: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncpy.c", line 81: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncmp.c", line 58: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strchr.c", line 73: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strcpy.c", line 68: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address

"procfs/fs_procfstcbinfo.c", line 185: warning #1097-D: unknown attribute
          "optimize"
  nooptimiziation_function

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
Xiang Xiao
fcb3e84c24 can: Merge netpacket/can.h into nuttx/can.h
To align with the layout of Linux can header file.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-26 05:05:31 -04:00
Petro Karashchenko
282cf2f7d0 sys/socket: implement compiler agnostic sockaddr_storage alignment
'aligned_data' is compiler dependent, but Open Group Base Specifications
describe compiler agnostic solution that can be used:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:25:05 +08:00
Petro Karashchenko
1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
meijian
a4b4fd16e9 netlib/route: add length for add/del route-func to reduce caller stack usage
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-26 01:54:10 +08:00
yinshengkai
84333881d7 mm: add mm_largest api to get the current largest available memory block
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
2cdfda149a mm: memory pressure support returns the maximum available memory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
49d1b4198f mm: add memory pressure notification support
Add mm_heap_free interface to pass remaining memory to memory pressure

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
f44a31c337 procfs: add memory pressure notification support
This is a memory monitoring interface implemented with reference to Linux's PSI (Pressure Stall Information),
which can send notifications when the system's remaining memory is below the threshold.

The following example code sets two different thresholds.
When the system memory is below 10MB, a notification is triggered.
When the system memory is below 20 MB, a notification (POLLPRI event) is triggered every 1s.

```
int main(int argc, FAR char *argv[])
{
  struct pollfd fds[2];
  int ret;

  if (argc == 2)
    {
      char *ptr = malloc(1024*1024*atoi(argv[1]));
      printf("Allocating %d MB\n", atoi(argv[1]));
      ptr[0] = 0;
      return 0;
    }

  fds[0].fd = open("/proc/pressure/memory", O_RDWR);
  fds[1].fd = open("/proc/pressure/memory", O_RDWR);
  fds[0].events = POLLPRI;
  fds[1].events = POLLPRI;

  dprintf(fds[0].fd, "%llu -1", 1024LLU*1024 * 10);
  dprintf(fds[1].fd, "%llu 1000000", 1024LLU*1024 * 20);

  while (1)
    {
      ret = poll(fds, 2, -1);
      if (ret > 0)
        {
          printf("Memory pressure: POLLPRI, %d\n", ret);
        }
    }

  return 0;
}
```

https://docs.kernel.org/accounting/psi.html
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
guoshichao
dd7ecd9aef greenhills: fix the ioexpander/gpio.h build warning
CC:  mm_heap/mm_brkaddr.c "/home/guoshichao/work_profile/vela_os/vela_car_4/nuttx/include/nuttx/ioexpander/gpio.h", line 159: warning #381-D:
          extra ";" ignored
    uint8_t gp_pintype;  /* See enum gpio_pintype_e */;
                                                      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
a06c97d599 greenhills: fix the netdev.h build warning
"/home/guoshichao/work_profile/vela_os/vela_car_4/nuttx/include/nuttx/net/netdev.h", line 493: warning #231-D:
          declaration is not visible outside of function
                                            FAR struct netdev_ifaddr6_s *addr,
                                                       ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
e5835d6ce8 greenhills: fix the macro undefined warning
CC:  mount/fs_foreachmountpoint.c "/home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/include/nuttx/mqueue.h", line 40: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_MQ_MAXMSGSIZE"
  #if CONFIG_MQ_MAXMSGSIZE > 0
      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
daichuan
fe01d7c462 modify for offload checksum and add macro with tcp/icmp/icmpv6/igmp checksum
Signed-off-by: daichuan <daichuan@xiaomi.com>
2024-08-24 20:41:40 +08:00
meijian
099ced4c83 [wireless] add pmksa get IOCTL id
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-24 18:09:07 +08:00
meijian
7cebfd0059 [wireless][header] Normalize IOCTL id
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-24 18:09:07 +08:00
guohao15
fb72fe6364 include/fcntl.h: add O_LARGEFILE flags
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-24 18:06:14 +08:00
guohao15
99c6f2e568 sys/shm.h: add macro define for posix
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-24 18:04:22 +08:00
yinshengkai
a72c9a41e1 include/debug.h: fix _alert log level error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-24 11:20:59 +08:00
makejian
10168903cc crypto/bn: add method to calculate inv mod and gcd
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-24 11:20:17 +08:00
makejian
21514e266a crypto/bn: bignum supports negative number operations
1.Add sign to indicate negative and positive
2.Fix case where there are negative numbers in the operation
3.expand to 512 bytes to support rsa2048

Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-24 11:20:17 +08:00
zhangkai25
9e388d1d00 Capture adds the function of edges counting
Description: Add the function of counting cap edges

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-08-24 11:18:05 +08:00
Zhe Weng
a591adc6d5 drivers/pipes: Add offset support for PIPEIOC_PEEK
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-23 16:14:39 -03:00
makejian
9769816385 crypto: fix wrong implementation in crypto module
(1) RSA_PKCS15_VERIFY Misspell
(2) if iv not provided during decryption, iv should get from data.
It was not discovered before because all symmetric decryption comes with iv.
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-23 12:57:37 -03:00
gaohedong
12a44bd974 can: CAN code optimization
Some macro definitions have already been defined in other header files, redundant macro definitions have been removed in include/nuttx/can.h. Align some code. Remove no use struct (can_response_s) and some variables.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-23 20:18:17 +08:00
chao an
75fac7dbc6 sched/nxevent: add support of kernel event group
Events groups are synchronization primitives that allow tasks to wait
for multiple conditions to be met before proceeding. They are particularly
useful in scenarios where a task needs to wait for several events to occur
simultaneously.

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-23 17:00:35 +08:00
renjianguang
7ff17d0627 nuttx/audio: ap_buffer_s add nsamples Field for non-pcm formats
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
renjianguang
87e24d13b4 nuttx/audio: add opus format support
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00