Commit Graph

73 Commits

Author SHA1 Message Date
Bowen Wang 69756f277e rptun_dump: do not acquire the lock when has hold the lock
Otherwise, system will crash again when call rptun_dump_all()
after has acquired the lock.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-06-17 19:38:39 +08:00
wangbowen6 41e399aa43 rptun: init the semtx before the thread/workqueue created
If the rptun driver set auto start, the smetx may has been used
in rptun_notify_wait() but not inited.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:38:39 +08:00
wangming9 a7fc26124d arch/arm64: the arm64 perf interface supports pmu
Summary:
- Support arm64 pmu api, Currently only the cycle counter function is supported.
- Using ARM64 PMU hardware capability to implement perf interface, modify all
  perf interface related code.
- Support for pmu init under smp.

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-04-10 16:23:49 -03:00
ligd 8b078d261f rptun: fix rptun_start() failed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-23 22:49:47 +08:00
chao an 4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
Gustavo Henrique Nihei e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
ligd 5b22eba0bd rptun ping: fix warning when open CONFIG_SYSTEM_TIME64
rptun/rptun_ping.c: In function 'rptun_ping':
rptun/rptun_ping.c:171:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'time_t' {aka 'long long int'} [-Werror=format=]
  171 |   syslog(LOG_INFO, "avg: s %" PRIu32 ", ns %ld\n", ts.tv_sec, ts.tv_nsec);
      |                    ^~~~~~~~~~                      ~~~~~~~~~
      |                                                      |
      |

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 10:59:59 +08:00
Xiang Xiao 779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
ligd 8aa5145273 rptun: fix race-condition on g_rptun_cb & g_rptun_priv
both rptun_dev_start() & rpmsg_register_callback() will use
these two lists

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-11 20:04:33 +08:00
ligd f599527e1e rptun: fix rptun sem post too much
_assert
/media/liangchaozhong/ssd/86v1ap/nuttx/libs/libc/assert/lib_assert.c:36
nxsem_post
/media/liangchaozhong/ssd/86v1ap/nuttx/sched/semaphore/sem_post.c:91 (discriminator 1)
rptun_wakeup_rx
/media/liangchaozhong/ssd/86v1ap/nuttx/drivers/rptun/rptun.c:374
rpmsg_virtio_rx_callback
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/rpmsg/rpmsg_virtio.c:377
rproc_virtio_notified
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/remoteproc/remoteproc_virtio.c:342
remoteproc_get_notification
/media/liangchaozhong/ssd/86v1ap/nuttx/openamp/open-amp/lib/remoteproc/remoteproc.c:998
nxtask_start
/media/liangchaozhong/ssd/86v1ap/nuttx/sched/task/task_start.c:129

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-11 20:04:33 +08:00
yinshengkai 85f727f232 tools: replace INCDIR to Makefile variable
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
anjiahao 5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
ligd 8c1fd1df81 rptun: update rptun to openamp 2022.04.0
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
ligd c2c1358fc7 rptun: handle uint16_t overflow
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
ligd e368ce6c07 rptun: add buffer check in RX IRQ
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
ligd cf22dd8688 rptun: divide notify msg
For notify callback has two conditions:
1. new data coming
2. return buffer coming

divide these two msgs

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
ligd 886e10ba3c rptun: unify name
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
Xiang Xiao a9171c77ac drivers/rptun: Add const to image_store_ops and remoteproc_ops
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-08-03 01:22:53 +08:00
ligd 5dcc905f27 rptun: change lock to recursive lock
[ap] [ 6] [<0x2c351a18>] arm_switchcontext+0xc/0x10
[ap] [ 6] [<0x2c321b36>] sem_wait+0x5a/0xbc
[ap] [ 6] [<0x2c333d68>] rptun_ns_bind+0x2c/0x128
[ap] [ 6] [<0x2c5f863c>] rpmsg_virtio_ns_callback+0x9c/0x140
[ap] [ 6] [<0x2c5f84a6>] rpmsg_virtio_rx_callback+0xba/0x1b4
[ap] [ 6] [<0x2c5f7b38>] rproc_virtio_notified+0x44/0x5c
[ap] [ 6] [<0x2c5f7504>] remoteproc_get_notification+0x1c/0x2c
[ap] [ 6] [<0x2c33432c>] rptun_wait_tx+0x11c/0x160
[ap] [ 6] [<0x2c5f8734>] rpmsg_virtio_get_tx_payload_buffer+0x54/0x100
[ap] [ 6] [<0x2c5f87f2>] rpmsg_virtio_send_offchannel_raw+0x12/0x6c
[ap] [ 6] [<0x2c321b4c>] sem_wait+0x70/0xbc
[ap] [ 6] [<0x2c5f8166>] rpmsg_create_ept+0x102/0x1a4
[ap] [ 6] [<0x2c5eafcc>] rpmsgfs_device_created+0x44/0x5c
[ap] [ 6] [<0x2c33407c>] rptun_dev_start.isra.0+0x218/0x3ac
[ap] [ 6] [<0x2c3343f4>] rptun_thread+0x84/0x164
[ap] [ 6] [<0x2c323762>] nxtask_start+0x3a/0x60

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd 8a3683fb9f rptun: add ns_match callback to resolve rptun deadlock
thread A: accept -> net_lock -> socket_rpmsg_accept
          -> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
          -> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
          -> net_lock -> deadlock

fix:
add ns_match callback

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd 033cd4d7df rptun: use seperated lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd 0017758fc1 rptun: add dump vring info support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd a014a19f0e rptun_ping: add sleep param to rptun_ping
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
anjiahao f9bcf1d645 drivers:rptun use strlcpy inside of strcpy
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd 434c49f282 rptun_dump: use METAL_LOG_EMERGENCY log level
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
ligd 4a9bd26317 rptun: merge rptun_ioctl & rptun_ops to one
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
ligd 631eb516c9 rptun_dump: don't get lock in IRQ handler
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
anjiahao b88a8cf39f use rmutex inside of all repeated implementation
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-05-30 19:43:48 +08:00
ligd 86a496d6ff rptun: forward panic/reset to lowerhalf
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 759898c090 rptun: add ping rpmsg support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd a19aef4d36 rptun: enable rx interrupts for virtq
use wait_tx_buffer method need enable rx interrupts

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 1c7e59eafa rptun: pm_stay when send msg & pm_relax when all tx buffer returned
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd f0ba2f0286 rptun: add rptun dump support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 5599f4e24a rptun: divide shram to TX & RX
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd be49f6b87c rptun: add rpmsg_wait/post support for recursive dispatch
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 7471d096cc rptun: add rptun_panic for both master & salve
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd c9404e2705 rptun: use HPWORK instead of thread
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 3ab7ade4ba rptun: add rptun_reset support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 7aba7c3790 rptun: add rptun_force_panic support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
ligd 5b6b748f6d rptun: set rptun thread default stack size to 4K
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:00:07 +03:00
Eero Nurkkala 1caf7d6f17 rptun: fix compile-time warning
Fix this compile-time warning:

rptun/rptun.c:956:22: warning: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Wformat-truncation=]
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |                      ^~~~~
rptun/rptun.c:956:25: note: format string is defined here
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
rptun/rptun.c:956:22: note: directive argument in the range [1, 18446744073709551615]
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |                      ^~~~~
rptun/rptun.c:956:3: note: 'snprintf' output between 4 and 19 bytes into a destination of size 16
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-03-25 22:18:28 +08:00
Petro Karashchenko 68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
Xiang Xiao 2277c18673 Fix rptun/rptun.c:572:7: warning: 'strncpy' specified bound 32 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-22 08:37:33 +02:00
Petro Karashchenko 41c95da594 register_driver: fix driver modes accross the code
State of problem:
 - Some drivers that do not support write operations (does not
   have write handler or ioctl do not perform any write actions)
   are registered with write permissions
 - Some drivers that do not support read operation (does not
   have read handler or ioctl do not perform any read actions)
   are registered with read permissions
 - Some drivers are registered with execute permissions

Solution:
 - Iterate code where register_driver() is used and change 'mode'
   parameter to reflect the actual read/write operations executed
   by a driver
 - Remove execute permissions from 'mode' parameter

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-16 16:15:29 +08:00
Petro Karashchenko a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
ligd 5b369c5cec libs/lbc: remove CHAR_BIT = 16 support
For CEVA platform CHAR_BIT is 16, and will do lots of extra work
when use IPC.
We will not support this platform anymore, so remove all the b2c operations.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 11:08:28 -06:00
ligd f5ddbb317f rptun: support can_recursive check for openamp
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 08:32:57 -06:00
ligd 883d66b906 socket_rpmsg: fix save rp_name error when accept
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-04 13:29:51 -05:00
ligd 9cb994e6dc rptun: add ns_unbind_notify support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-01 06:57:33 -05:00
Jiuzhu Dong a39fb6bc7a rptun: add CONFIG_RPTUN_LOADER to optimize code size
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-12 11:31:11 +08:00