diff --git a/README.md b/README.md index 35ce24308..74b9b7157 100644 --- a/README.md +++ b/README.md @@ -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, diff --git a/cmake/options.cmake b/cmake/options.cmake index 0c2b80aa8..35a3333fd 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -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 diff --git a/lib/include/openamp/remoteproc_virtio.h b/lib/include/openamp/remoteproc_virtio.h index 770b428cc..ab06bb5a7 100644 --- a/lib/include/openamp/remoteproc_virtio.h +++ b/lib/include/openamp/remoteproc_virtio.h @@ -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); diff --git a/lib/include/openamp/rpmsg_virtio.h b/lib/include/openamp/rpmsg_virtio.h index 9179add20..6dfe905a1 100644 --- a/lib/include/openamp/rpmsg_virtio.h +++ b/lib/include/openamp/rpmsg_virtio.h @@ -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 diff --git a/lib/include/openamp/virtqueue.h b/lib/include/openamp/virtqueue.h index 2bc1ff1e8..1b44e5417 100644 --- a/lib/include/openamp/virtqueue.h +++ b/lib/include/openamp/virtqueue.h @@ -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;