From 600b25b4214523b7aa51420e920526174dc04405 Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Wed, 3 Jul 2024 10:00:34 +0800 Subject: [PATCH] rpmsg_virtio.c: replace metal_cpu_yield to new libmetal API metal_yield The CPU yield is not supported by all OSes/processors. If not supported, this causes a busy loop that monopolizes the CPU. Replace it with the new metal_yield, it would be managed at the OS level and dispatched to metal_cpu_yield, metal_sleep_usec, or others. Signed-off-by: Yongrong Wang --- lib/remoteproc/remoteproc_virtio.c | 4 ++-- lib/rpmsg/rpmsg_virtio.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/remoteproc/remoteproc_virtio.c b/lib/remoteproc/remoteproc_virtio.c index ef39c49e5..f7948848e 100644 --- a/lib/remoteproc/remoteproc_virtio.c +++ b/lib/remoteproc/remoteproc_virtio.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -412,6 +412,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_yield(); } } diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index 7baaedd5b..6747b5e28 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -271,8 +272,7 @@ 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(); + metal_yield(); } }