For POLICY_0, when a pipe only has a reader and no writer,
if the pipe is empty, set POLLHUP.
For POLICY_1, when a pipe only has a reader but no writer,
if the pipe is empty, POLLHUP will not be set.
This change corrects poll() behavior to match the two pipe policies.
No API changes.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
If ns_msg->flags == RPMSG_NS_CREATE_ACK, means already know peer's address
so direclty use usr_ept->dest_addr
Signed-off-by: yintao <yintao@xiaomi.com>
fist free when rpmsg_port_unregister at rpmsg spi thread
<free+12>
<rpmsg_router_hub_ept_release+6>
<rpmsg_ept_decref+28>
<rpmsg_unregister_endpoint+120>
<rpmsg_destroy_ept+40>
<rpmsg_router_hub_unbind+22>
<rpmsg_device_destory+172>
<rpmsg_port_unregister+26>
this thread will free r:droid and r:audio at last;
But in this process,
rpmsg_destroy_ept "r:droid" will send NS_destroy to audio;
audio will response NS_destroy to ap; if r:droid has not been
removed from the ept list yet, the rptun_audio thread on ap will
occur as follows:
3 0x103016fa in kasan_check_report
4 0x103018b6 in __asan_store4_noabort
5 0x106ca352 in metal_list_del
6 in rpmsg_unregister_endpoint
7 0x106ca77a in rpmsg_destroy_ept
8 0x102db232 in rpmsg_router_hub_unbind
9 0x106cabb2 in rpmsg_virtio_ns_callback
10 0x106cad5c in rpmsg_virtio_rx_callback
11 0x106cc190 in virtqueue_notification
12 0x106ca064 in rproc_virtio_notified
13 0x106c9ad0 in remoteproc_get_notification
14 0x102dd4ba in rptun_worker at rptun/rptun.c:334
15 rptun_worker (arg=<optimized out>) at rptun/rptun.c:328
16 0x102dd974 in rptun_thread rptun/rptun.c:353
17 0x102cd558 in nxtask_start () at task/task_start.c:1
this will lead to r:audio be freed again.
Signed-off-by: yintao <yintao@xiaomi.com>
Use rpmsg_send_offchannel_raw to fix stuck issue avoid getting stuck
when remote destroy ept.
When send messages from ap to android in Rptun thread, Android may
have sent NS_DESTROY through rpmsg_port and changed ept->dst to
RPMSG_ADDR_ANY in rpmsg_port_ns_callback; So rptun thread may be
stuck at this time because rpmsg_send detected dst_ept's dst_addr
is RPMSG_ADDR_ANY.
rpmsg_virtio_thread(rptun audio):
rpmsg_virtio_rx_callback -> rpmsg_router_cb -> rpmsg_send(dst_ept)
send to android
rpmsg_port_thread (android send NS_DESTROY):
rpmsg_port_ns_callback -> dst_ept->dest_addr = RPMSG_ADDR_ANY
Signed-off-by: yintao <yintao@xiaomi.com>
when edge_ept received NS_DESTROY message to sync the behavior with
other rpmsg transport
if (ns_msg.flags == RPMSG_NS_DESTROY) {
if (_ept)
_ept->dest_addr = RPMSG_ADDR_ANY;
...
Signed-off-by: yintao <yintao@xiaomi.com>
since creating resources on the remote core takes time,
we need to wait for the remote core to return ack.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Add null pointer check for ioctl operations in RTC driver.
Return -ENOTTY when ioctl function pointer is NULL to prevent crashes.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Fix potential crash when removing client from server list.
Add proper list initialization check before deletion operation.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
without rpmsg rtc client driver
Avoid sending rpmsg messages to cores that don't have RTC client driver.
Check endpoint availability before attempting to send messages.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Export rpmsg endpoint to allow remote CPU to access RTC services.
Simplify the initialization flow and remove unnecessary Kconfig options.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
implement the pm feature in rpmsg virtio common part, now the rpmsg
virtio can use in the low power case.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Previously the ioctl-based configuration was not encoded properly.
It lacked the three command bits selecting the "set volatile
configuration" mode.
Thus, configuration the reference, power-down or gain resulted in no
change.
Now the configuration is properly applied.
The DAC value to be send is now combined with the proper command prefix
bits, too.
But this operation was already working, since the command prefix is zero.
Signed-off-by: Lars Kruse <devel@sumpfralle.de>
This commit fixes a typo in the capture.h header file. This is a
breaking change, but the fix is trivial (replace macro with new one).
Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
Add spinlock protection to sched_note_preemption and nxsched_critmon_preemption.
Ensures thread-safe access to global state in preemption notification and critical
monitoring, preventing race conditions in SMP and interrupt contexts.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Already copy the rpmsg_internal.h from openamp to the nuttx/include,
so do not need add the include patch for .c files.
Signed-off-by: yangao1 <yangao1@xiaomi.com>
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
there is no SERIAL_DMA option, it was removed long time ago in:
0d203fd535
It should be SERIAL_TXDMA and SERIAL_RXDMA
Signed-off-by: raiden00pl <raiden00@railab.me>
Because virtio device do not need manager the share memory heap
for now.
But later we will make the virtio device be able to manager a
standalone heap, so let this logic can be easily to extend.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
If there are multiple virtio devices in rsc, it must wait for the previous
device to be created before creating the next one. In this case, if the
driver configuration of a device is not be set Y, the subsequent virtio
devices cannot be created.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Use share memory to send PANIC and RESET command to peer if the rptun
driver do not support panic() and reset ops.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
Previous patch is not corrected:
5518135: mm/mm_heap: add nokasan flag in mm_heap_config_s structure |
https://gerrit.pt.mioffice.cn/c/vela/nuttx/+/5518135
Because rptun do not want part of the share memory is used by the
struct mm_heap_s to:
1. Save the share memory;
2. Some platfrom can't use atomic operation at the share memory,
and struct mm_heap_s contains a mutex.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Support enable/disable the kasan when initialize the heap.
This requirement is from rptun, because rptun use share memory init
the heap and share memory is precious, so we need disable the kasan
feature for rptun's heap to save the share memory.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
virtio and vhost rpmsg device as standalone device registered to
the virtio and vhost bus.
virtio-rpmsg and vhost-rpmsg use the common virtio_rpmsg_common.c
implementation in rpmsg dir.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
1. modify the da to FW_RSC_U32_ADDR_ANY, linux support daynamic calculate
the da when da == FW_RSC_U32_ADDR_ANY;
2. modify the carveout name to vdev%dbuffer, linux remoteproc framework
use these fixed name to handle the craveout for virtio devices;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
1. Use reserved[0] filed in struct fw_rsc_vdev and the driver
master/slave to judge the device role;
2. Use struct fw_rsc_carveout in resource table to provide the
share memory to virtio driver side;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Call rpmsg_virtio_probe() directly if device is is rpmsg virtio
and config CONFIG_DRIVERS_VIRTIO/VHOST are not enabled, so the
virtio/vhost frameworks related code do not need be compiled and
used, and can save the code size if user only want to use rpmsg
virtio device.
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
When vring->da is specified, do not need reserve the memory for the vring,
so do not need increase the shmbase and leave more share memory to the
carveout.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Now rptun only as remoteproc and remoteproc_virtio transport layer,
because the rpmsg virtio device should be a stand alone virtio/vhost
driver in the virtio bus
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This is the virtio-rpmsg and vhost-rpmsg common implementation for
VirtIO-Rpmsg: drivers/virtio/virtio-rpmsg.c
Vhost-Rpmsg: drivers/vhost/vhost-rpmsg.c
Later we will seperate the rpmsg virtio from the rptun framework to
make the rpmsg virtio can work with all the virtio transport layer.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
of driver information.
When the local core is a virtual sensor, attempt to retrieve
information from a remote core.
Signed-off-by: likun17 <likun17@xiaomi.com>