Skip to content

Commit

Permalink
options: add option for all cache operations
Browse files Browse the repository at this point in the history
Add WITH_DCACHE operation used for all cache operations:
vrings, buffers and resource table.
The other options will be deprecated - add warning
message for this.

Add info for WITH_DCACHE option in README.

Signed-off-by: Iuliana Prodan <[email protected]>
  • Loading branch information
iuliana-prodan authored and arnopo committed Sep 18, 2023
1 parent b4f10fb commit f2162a6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ library for it project:
enabled on buffers.
* **WITH_DCACHE_RSC_TABLE** (default OFF): Build with data cache operations
enabled on resource table.
* **WITH_DCACHE** (default OFF): Build with all cache operations
enabled. When set to ON, cache operations for vrings, buffers and resource
table are enabled.
* **RPMSG_BUFFER_SIZE** (default 512): adjust the size of the RPMsg buffers.
The default value of the RPMsg size is compatible with the Linux Kernel hard
coded value. If you AMP configuration is Linux kernel host/ OpenAMP remote,
Expand Down
9 changes: 9 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,31 @@ if (WITH_VIRTIO_MMIO_DRV)
add_definitions(-DWITH_VIRTIO_MMIO_DRV)
endif (WITH_VIRTIO_MMIO_DRV)

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

if (WITH_DCACHE)
add_definitions(-DVIRTIO_USE_DCACHE)
endif (WITH_DCACHE)

option (WITH_DCACHE_VRINGS "Build with vrings cache operations enabled" OFF)

if (WITH_DCACHE_VRINGS)
add_definitions(-DVIRTIO_CACHED_VRINGS)
message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...)
endif (WITH_DCACHE_VRINGS)

option (WITH_DCACHE_BUFFERS "Build with buffers cache operations enabled" OFF)

if (WITH_DCACHE_BUFFERS)
add_definitions(-DVIRTIO_CACHED_BUFFERS)
message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...)
endif (WITH_DCACHE_BUFFERS)

option (WITH_DCACHE_RSC_TABLE "Build with resource table cache operations enabled" OFF)

if (WITH_DCACHE_RSC_TABLE)
add_definitions(-DVIRTIO_CACHED_RSC_TABLE)
message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...)
endif (WITH_DCACHE_RSC_TABLE)

# Set the complication flags
Expand Down
5 changes: 4 additions & 1 deletion lib/include/openamp/remoteproc_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ extern "C" {

/* cache invalidation helpers for resource table */
#ifdef VIRTIO_CACHED_RSC_TABLE
#warning "VIRTIO_CACHED_RSC_TABLE is deprecated, please use VIRTIO_USE_DCACHE"
#endif
#if defined(VIRTIO_CACHED_RSC_TABLE) || defined(VIRTIO_USE_DCACHE)
#define RSC_TABLE_FLUSH(x, s) CACHE_FLUSH(x, s)
#define RSC_TABLE_INVALIDATE(x, s) 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_CACHED_RSC_TABLE */
#endif /* VIRTIO_CACHED_RSC_TABLE || VIRTIO_USE_DCACHE */

/* define vdev notification function user should implement */
typedef int (*rpvdev_notify_func)(void *priv, uint32_t id);
Expand Down
5 changes: 4 additions & 1 deletion lib/include/openamp/rpmsg_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ extern "C" {
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */

#ifdef VIRTIO_CACHED_BUFFERS
#warning "VIRTIO_CACHED_BUFFERS is deprecated, please use VIRTIO_USE_DCACHE"
#endif
#if defined(VIRTIO_CACHED_BUFFERS) || defined(VIRTIO_USE_DCACHE)
#define BUFFER_FLUSH(x, s) CACHE_FLUSH(x, s)
#define BUFFER_INVALIDATE(x, s) CACHE_INVALIDATE(x, s)
#else
#define BUFFER_FLUSH(x, s) do { } while (0)
#define BUFFER_INVALIDATE(x, s) do { } while (0)
#endif /* VIRTIO_CACHED_BUFFERS */
#endif /* VIRTIO_CACHED_BUFFERS || VIRTIO_USE_DCACHE */

/**
* struct rpmsg_virtio_shm_pool - shared memory pool used for rpmsg buffers
Expand Down
5 changes: 4 additions & 1 deletion lib/include/openamp/virtqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ extern "C" {
#define CACHE_INVALIDATE(x, s) metal_cache_invalidate(x, s)

#ifdef VIRTIO_CACHED_VRINGS
#warning "VIRTIO_CACHED_VRINGS is deprecated, please use VIRTIO_USE_DCACHE"
#endif
#if defined(VIRTIO_CACHED_VRINGS) || defined(VIRTIO_USE_DCACHE)
#define VRING_FLUSH(x, s) CACHE_FLUSH(x, s)
#define VRING_INVALIDATE(x, s) CACHE_INVALIDATE(x, s)
#else
#define VRING_FLUSH(x, s) do { } while (0)
#define VRING_INVALIDATE(x, s) do { } while (0)
#endif /* VIRTIO_CACHED_VRINGS */
#endif /* VIRTIO_CACHED_VRINGS || VIRTIO_USE_DCACHE */

struct virtqueue_buf {
void *buf;
Expand Down

0 comments on commit f2162a6

Please sign in to comment.