Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ project (open_amp C)

include (CheckIncludeFiles)
include (CheckCSourceCompiles)
include (CMakeDependentOption)
include (collect)
include (options)
include (depends)
Expand Down
17 changes: 14 additions & 3 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,20 @@ endif (NOT WITH_VQ_RX_EMPTY_NOTIFY)

option (WITH_DCACHE "Build with all cache operations enabled" OFF)

if (WITH_DCACHE)
add_definitions(-DVIRTIO_USE_DCACHE)
endif (WITH_DCACHE)
cmake_dependent_option(WITH_DCACHE_VRINGS "Build with vrings cache operations enabled" OFF "NOT WITH_DCACHE" ON)
if (WITH_DCACHE_VRINGS)
add_definitions(-DVIRTIO_CACHED_VRINGS)
endif (WITH_DCACHE_VRINGS)

cmake_dependent_option (WITH_DCACHE_BUFFERS "Build with buffers cache operations enabled" OFF "NOT WITH_DCACHE" ON)
if (WITH_DCACHE_BUFFERS)
add_definitions(-DVIRTIO_CACHED_BUFFERS)
endif (WITH_DCACHE_BUFFERS)

cmake_dependent_option (WITH_DCACHE_RSC_TABLE "Build with resource table cache operations enabled" OFF "NOT WITH_DCACHE" ON)
if (WITH_DCACHE_RSC_TABLE)
add_definitions(-DVIRTIO_CACHED_RSC_TABLE)
endif (WITH_DCACHE_RSC_TABLE)

# Set the complication flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
Expand Down
4 changes: 2 additions & 2 deletions lib/include/openamp/remoteproc_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ extern "C" {
#define RPROC_MAX_VRING_DESC USHRT_MAX

/* cache invalidation helpers for resource table */
#if defined(VIRTIO_USE_DCACHE)
#if defined(VIRTIO_CACHED_RSC_TABLE)
#define RSC_TABLE_FLUSH(x, s) metal_cache_flush(x, s)
#define RSC_TABLE_INVALIDATE(x, s) metal_cache_invalidate(x, s)
#else
#define RSC_TABLE_FLUSH(x, s) do { } while (0)
#define RSC_TABLE_INVALIDATE(x, s) do { } while (0)
#endif /* VIRTIO_USE_DCACHE */
#endif /* VIRTIO_CACHED_RSC_TABLE */

/* define vdev notification function user should implement */
typedef int (*rpvdev_notify_func)(void *priv, uint32_t id);
Expand Down
5 changes: 3 additions & 2 deletions lib/include/openamp/rpmsg_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ extern "C" {
/* The feature bitmap for virtio rpmsg */
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */

#if defined(VIRTIO_USE_DCACHE)
/* cache invalidation helpers for virtio buffers */
#if defined(VIRTIO_CACHED_BUFFERS)
#define BUFFER_FLUSH(x, s) metal_cache_flush(x, s)
#define BUFFER_INVALIDATE(x, s) metal_cache_invalidate(x, s)
#else
#define BUFFER_FLUSH(x, s) do { } while (0)
#define BUFFER_INVALIDATE(x, s) do { } while (0)
#endif /* VIRTIO_USE_DCACHE */
#endif /* VIRTIO_CACHED_BUFFERS */

/* Callback handler for rpmsg virtio service */
typedef int (*rpmsg_virtio_notify_wait_cb)(struct rpmsg_device *rdev, uint32_t id);
Expand Down
5 changes: 3 additions & 2 deletions lib/include/openamp/virtqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ extern "C" {
/* Support to suppress interrupt until specific index is reached. */
#define VIRTIO_RING_F_EVENT_IDX (1 << 29)

#if defined(VIRTIO_USE_DCACHE)
/* cache invalidation helpers for vrings */
#if defined(VIRTIO_CACHED_VRINGS)
#define VRING_FLUSH(x, s) metal_cache_flush(x, s)
#define VRING_INVALIDATE(x, s) metal_cache_invalidate(x, s)
#else
#define VRING_FLUSH(x, s) do { } while (0)
#define VRING_INVALIDATE(x, s) do { } while (0)
#endif /* VIRTIO_USE_DCACHE */
#endif /* VIRTIO_CACHED_VRINGS */

/** @brief Buffer descriptor. */
struct virtqueue_buf {
Expand Down
Loading