Skip to content

Commit

Permalink
lib: update open-amp lib to release v2021.10.0
Browse files Browse the repository at this point in the history
Origin:
	https://github.com/OpenAMP/open-amp

Commit:
	3c223735ea969199b3c9e2e2a85c9fa7c022b6c0

Status:
	merge open-amp new version after removing the apps dir.

Release Description:
	https://github.com/OpenAMP/open-amp/releases/tag/v2021.10.0

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
  • Loading branch information
carlocaione authored and galak committed Nov 2, 2021
1 parent 6010f05 commit cfd050f
Show file tree
Hide file tree
Showing 12 changed files with 561 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ URL:
https://github.com/OpenAMP/open-amp/

commit:
c3f12991991d187d47637d88e8a66076f23d0c8c
3c223735ea969199b3c9e2e2a85c9fa7c022b6c0

Maintained-by:
External
Expand Down
20 changes: 7 additions & 13 deletions open-amp/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
# OpenAMP Maintainers

OpenAMP project is maintained by the OpenAMP open source community. Everyone
is encouraged to submit issues and changes to improve OpenAMP.
The OpenAMP project is maintained by the OpenAMP open source
community. Everyone is encouraged to submit issues and changes to
improve OpenAMP.

The intention of this file is to provide a set of names that developers can
consult when they have a question about OpenAMP and to provide a a set of
names to be CC'd when submitting a patch.
The intention of this file is to provide a set of names that developers
can consult when they have a question about OpenAMP and to provide a
set of names to be CC'd when submitting a patch.


## Project Administration
Ed Mooring <ed.mooring@linaro.org>
Ed Mooring <ed.mooring@gmail.com>
Arnaud Pouliquen <arnaud.pouliquen@st.com>

### All patches CC here
openamp-rp@lists.openampproject.org

## Machines
### Xilinx Platform - Zynq-7000
Ed Mooring <ed.mooring@linaro.org>

### Xilinx Platform - Zynq UltraScale+ MPSoC
Ed Mooring <ed.mooring@linaro.org>
4 changes: 4 additions & 0 deletions open-amp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ library for it project:
* **WITH_SHARED_LIB** (default ON): Build with a shared library.
* **WITH_ZEPHYR** (default OFF): Build open-amp as a zephyr library. This option
is mandatory in a Zephyr environment.
* **WITH_DCACHE_VRINGS** (default OFF): Build with data cache operations
enabled on vrings.
* **WITH_DCACHE_BUFFERS** (default OFF): Build with data cache operations
enabled on buffers.
* **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 master/ OpenAMP remote,
Expand Down
2 changes: 1 addition & 1 deletion open-amp/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_MINOR = 1
VERSION_PATCH = 0
12 changes: 12 additions & 0 deletions open-amp/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ if (NOT WITH_VIRTIO_SLAVE)
add_definitions(-DVIRTIO_MASTER_ONLY)
endif (NOT WITH_VIRTIO_SLAVE)

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

if (WITH_DCACHE_VRINGS)
add_definitions(-DVIRTIO_CACHED_VRINGS)
endif (WITH_DCACHE_VRINGS)

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

if (WITH_DCACHE_BUFFERS)
add_definitions(-DVIRTIO_CACHED_BUFFERS)
endif (WITH_DCACHE_BUFFERS)

# Set the complication flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")

Expand Down
1 change: 1 addition & 0 deletions open-amp/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_subdirectory (remoteproc)

if (WITH_PROXY)
add_subdirectory (proxy)
add_subdirectory (service/rpmsg/rpc)
endif (WITH_PROXY)

set (OPENAMP_LIB open_amp)
Expand Down
207 changes: 207 additions & 0 deletions open-amp/lib/include/openamp/rpmsg_rpc_client_server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
/*
* Copyright (c) 2021, L&T Technology Services Ltd.
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef RPMSG_RPC_CLIENT_SERVER_H
#define RPMSG_RPC_CLIENT_SERVER_H

#include <openamp/open_amp.h>
#include <metal/compiler.h>

#if defined __cplusplus
extern "C" {
#endif

#define RPMSG_RPC_OK 0
#define RPMSG_RPC_INVALID_ID (-1L)
#define RPMSG_RPC_SERVICE_NAME "rpmsg-rpc"

/* RPMSG_BUFFER_SIZE = 512
* sizeof(struct rpmsg_hdr) = 16
* RPMSG_BUFFER_SIZE - sizeof(struct rpmsg_hdr) - 1 = 495
* Aligning to 64 bits -> 488UL
*/
#define MAX_BUF_LEN 488UL
#define MAX_FUNC_ID_LEN sizeof(unsigned long int)

struct rpmsg_rpc_clt;
struct rpmsg_rpc_svr;

typedef void (*rpmsg_rpc_shutdown_cb)(struct rpmsg_rpc_clt *rpc);
typedef void (*app_cb)(struct rpmsg_rpc_clt *rpc, int statust, void *data,
size_t len);
typedef int (*rpmsg_rpc_syscall_cb)(void *data, struct rpmsg_rpc_svr *rpcs);

/**
* struct rpmsg_rpc_request - rpc request message
*
* @id: service id
* @params: request params
*
*/
struct rpmsg_rpc_request {
uint32_t id;
unsigned char params[MAX_BUF_LEN];
};

/**
* struct rpmsg_rpc_answer - rpc request message
*
* @id: service id
* @status: status of rpc
* @params: answer params
*
*/
METAL_PACKED_BEGIN
struct rpmsg_rpc_answer {
uint32_t id;
int32_t status;
unsigned char params[MAX_BUF_LEN];
} METAL_PACKED_END;

/**
* struct rpmsg_rpc_services - table for services
*
* @id: service id
* @cb_function: id callback
*
*/
struct rpmsg_rpc_services {
uint32_t id;
rpmsg_rpc_syscall_cb cb_function;
};

/**
* struct rpmsg_rpc_client_services - table for client services
*
* @id: service id
* @app_cb: id callback
*
*/
struct rpmsg_rpc_client_services {
uint32_t id;
app_cb cb;
};

/**
* struct rpmsg_rpc_svr - server remote procedure call data
*
* RPMsg RPC will send request to endpoint
*
* @ept: rpmsg_endpoint structure
* @services: service table
* @n_services: number of services
*
*/
struct rpmsg_rpc_svr {
struct rpmsg_endpoint ept;
const struct rpmsg_rpc_services *services;
unsigned int n_services;
};

/**
* struct rpmsg_rpc_clt - client remote procedure call data
*
* RPMsg RPC will send request to remote and
* wait for callback.
*
* @ept: rpmsg_endpoint structure
* @shutdown_cb: shutdown callback function
* @services: service table
* @n_services: number of services
*
*/
struct rpmsg_rpc_clt {
struct rpmsg_endpoint ept;
rpmsg_rpc_shutdown_cb shutdown_cb;
const struct rpmsg_rpc_client_services *services;
unsigned int n_services;
};

/**
* rpmsg_rpc_client_release - release RPMsg remote procedure call
*
* This function is to release remoteproc procedure call service
*
* @rpc: pointer to the client remote procedure call data
*
*/
void rpmsg_rpc_client_release(struct rpmsg_rpc_clt *rpc);

/**
* rpmsg_rpc_client_init - initialize RPMsg remote procedure call
*
* This function is to initialize the remote procedure call
* client data. RPMsg RPC will send request to remote and
* wait for callback and load services to table
*
* @rpc: pointer to the client remote procedure call data
* @rdev: pointer to the rpmsg device
* @shutdown_cb: shutdown callback function
* @services: pointer to service table
* @len: length of table
*
* return 0 for success, and negative value for failure
*/
int rpmsg_rpc_client_init(struct rpmsg_rpc_clt *rpc,
struct rpmsg_device *rdev,
rpmsg_rpc_shutdown_cb shutdown_cb,
const struct rpmsg_rpc_client_services *services,
int len);

/**
* rpmsg_rpc_server_init - initialize RPMsg rpc for server
*
* This function create endpoint and loads services into table
*
* @rpcs: pointer to the server rpc
* @rdev: pointer to the rpmsg device
* @services: pointer to service table
* @len: length of table
* @rpmsg_service_server_unbind: unbind function callback
*
* return 0 for success, and negative value for failure
*/
int rpmsg_rpc_server_init(struct rpmsg_rpc_svr *rpcs, struct rpmsg_device *rdev,
const struct rpmsg_rpc_services *services, int len,
rpmsg_ns_unbind_cb rpmsg_service_server_unbind);

/**
* rpmsg_rpc_client_send - Request RPMsg RPC call
*
* @rpc: pointer to client remoteproc procedure call data
* @rpc_id: function id
* @request_param: pointer to request buffer
* @req_param_size: length of the request data
*
* return length of the received response, negative value for failure.
*/
int rpmsg_rpc_client_send(struct rpmsg_rpc_clt *rpc,
unsigned int rpc_id, void *request_param,
size_t req_param_size);

/**
* rpmsg_rpc_server_send - Request RPMsg RPC call
*
* This function sends RPC request
*
* @rpcs: pointer to server rpc data
* @rpc_id: function id
* @status: status of rpc
* @request_param: pointer to request buffer
* @param_size: length of the request data
*
* return length of the received response, negative value for failure.
*/
int rpmsg_rpc_server_send(struct rpmsg_rpc_svr *rpcs, uint32_t rpc_id,
int status, void *request_param,
size_t param_size);

#if defined __cplusplus
}
#endif

#endif /* RPMSG_RPC_CLIENT_SERVER_H */
11 changes: 11 additions & 0 deletions open-amp/lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions open-amp/lib/service/rpmsg/rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
collect (PROJECT_LIB_SOURCES rpmsg_rpc_client.c)
collect (PROJECT_LIB_SOURCES rpmsg_rpc_server.c)
Loading

0 comments on commit cfd050f

Please sign in to comment.