Skip to content

Commit

Permalink
rpmsg_virtio.c: replace metal_cpu_yield to metal_sleep_usec
Browse files Browse the repository at this point in the history
according to OpenAMP upgrade, metal_cpu_yield() is define by NULL
in nuttx/openamp/libmetal/lib/processor/generic/cpu.h, so use it
will cause a busy loop

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
  • Loading branch information
wyr-7 committed Sep 19, 2024
1 parent c468328 commit 01ed340
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/remoteproc/remoteproc_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <metal/cpu.h>
#include <metal/utilities.h>
#include <metal/alloc.h>
#include <metal/sleep.h>

static void rproc_virtio_delete_virtqueues(struct virtio_device *vdev)
{
Expand Down Expand Up @@ -412,6 +413,6 @@ void rproc_virtio_wait_remote_ready(struct virtio_device *vdev)
status = rproc_virtio_get_status(vdev);
if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
return;
metal_cpu_yield();
metal_sleep_usec(1000);
}
}
4 changes: 2 additions & 2 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ static int rpmsg_virtio_wait_remote_ready(struct rpmsg_virtio_device *rvdev)
} else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
return 0;
}
/* TODO: clarify metal_cpu_yield usage*/
metal_cpu_yield();
/* TODO: clarify metal_sleep_usec usage*/
metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
}
}

Expand Down

0 comments on commit 01ed340

Please sign in to comment.