mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-10-02 18:23:21 +08:00
openamp: Introduce cache helpers
To manage shared vring memory behind caches. Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
f2b3fcd2cf
commit
d9b8cefefa
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <metal/alloc.h>
|
||||
#include <metal/cache.h>
|
||||
#include <metal/sleep.h>
|
||||
#include <metal/utilities.h>
|
||||
#include <openamp/rpmsg_virtio.h>
|
||||
@@ -102,6 +103,11 @@ static int rpmsg_virtio_enqueue_buffer(struct rpmsg_virtio_device *rvdev,
|
||||
uint16_t idx)
|
||||
{
|
||||
unsigned int role = rpmsg_virtio_get_role(rvdev);
|
||||
|
||||
#ifdef VIRTIO_CACHED_BUFFERS
|
||||
metal_cache_flush(buffer, len);
|
||||
#endif /* VIRTIO_CACHED_BUFFERS */
|
||||
|
||||
#ifndef VIRTIO_SLAVE_ONLY
|
||||
if (role == RPMSG_MASTER) {
|
||||
struct virtqueue_buf vqbuf;
|
||||
@@ -192,6 +198,11 @@ static void *rpmsg_virtio_get_rx_buffer(struct rpmsg_virtio_device *rvdev,
|
||||
}
|
||||
#endif /*!VIRTIO_MASTER_ONLY*/
|
||||
|
||||
#ifdef VIRTIO_CACHED_BUFFERS
|
||||
/* Invalidate the buffer before returning it */
|
||||
metal_cache_invalidate(data, *len);
|
||||
#endif /* VIRTIO_CACHED_BUFFERS */
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
+103
-8
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user