mirror of
https://github.com/apache/nuttx.git
synced 2026-05-18 00:34:10 +08:00
dac8604f5e
and remove somes libmetal and openamp patches that already merged in the OpenAMP and Libmetal community. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
94 lines
3.3 KiB
Diff
94 lines
3.3 KiB
Diff
From 4f552ae6fa88eec2a42c3933ea201ab71555838c Mon Sep 17 00:00:00 2001
|
|
From: anchao <anchao@pinecone.net>
|
|
Date: Mon, 10 Dec 2018 16:26:39 +0800
|
|
Subject: [PATCH 02/10] Negotiate individual buffer size dynamically
|
|
|
|
Change config type from fw_rsc_config to rpmsg_virtio_config
|
|
to avoid rpmsg_vitio.h couple with remoteproc.h.
|
|
If slave support VIRTIO_RPMSG_F_BUFSZ(0x04) feature, master
|
|
determine the buffer size from config space(first 8 bytes),
|
|
otherwise the default size(512 bytes) will be used.
|
|
|
|
Signed-off-by: anchao <anchao@pinecone.net>
|
|
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
|
|
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
|
---
|
|
lib/include/openamp/remoteproc.h | 15 +++++++++++++++
|
|
lib/include/openamp/rpmsg_virtio.h | 1 +
|
|
lib/rpmsg/rpmsg_virtio.c | 7 +++++++
|
|
3 files changed, 23 insertions(+)
|
|
|
|
diff --git a/lib/include/openamp/remoteproc.h open-amp/lib/include/openamp/remoteproc.h
|
|
index 29b28ed0ad..aadc7a798f 100644
|
|
--- a/lib/include/openamp/remoteproc.h
|
|
+++ open-amp/lib/include/openamp/remoteproc.h
|
|
@@ -361,6 +361,21 @@ struct fw_rsc_vendor {
|
|
uint32_t len;
|
|
} METAL_PACKED_END;
|
|
|
|
+/** @brief Configuration space declaration ((if VIRTIO_RPMSG_F_BUFSZ)) */
|
|
+METAL_PACKED_BEGIN
|
|
+struct fw_rsc_config {
|
|
+ /** The host to remote buffer size */
|
|
+ uint32_t h2r_buf_size;
|
|
+
|
|
+ /** The remote to host buffer size */
|
|
+ uint32_t r2h_buf_size;
|
|
+
|
|
+ /** Reserve for the future use */
|
|
+ uint32_t reserved[14];
|
|
+
|
|
+ /** Put the customize config here */
|
|
+} METAL_PACKED_END;
|
|
+
|
|
struct loader_ops;
|
|
struct image_store_ops;
|
|
struct remoteproc_ops;
|
|
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
|
|
index b738e618cf..a757166082 100644
|
|
--- a/lib/include/openamp/rpmsg_virtio.h
|
|
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
|
|
@@ -30,6 +30,7 @@ extern "C" {
|
|
/* The feature bitmap for virtio rpmsg */
|
|
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
|
|
#define VIRTIO_RPMSG_F_ACK 1 /* RP supports name service acknowledge */
|
|
+#define VIRTIO_RPMSG_F_BUFSZ 2 /* RP supports get buffer size from config space */
|
|
|
|
#if defined(VIRTIO_USE_DCACHE)
|
|
#define BUFFER_FLUSH(x, s) metal_cache_flush(x, s)
|
|
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
|
index d59bad5d79..8654e7d8b8 100644
|
|
--- a/lib/rpmsg/rpmsg_virtio.c
|
|
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <metal/sys.h>
|
|
#include <metal/utilities.h>
|
|
#include <openamp/rpmsg_virtio.h>
|
|
+#include <openamp/remoteproc.h>
|
|
#include <openamp/virtqueue.h>
|
|
|
|
#include "rpmsg_internal.h"
|
|
@@ -802,6 +803,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
|
struct rpmsg_device *rdev;
|
|
const char *vq_names[RPMSG_NUM_VRINGS];
|
|
vq_callback callback[RPMSG_NUM_VRINGS];
|
|
+ struct fw_rsc_config fw_config;
|
|
uint32_t features;
|
|
int status;
|
|
unsigned int i;
|
|
@@ -848,6 +850,11 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
|
return status;
|
|
rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS));
|
|
rdev->support_ack = !!(features & (1 << VIRTIO_RPMSG_F_ACK));
|
|
+ if (features & (1 << VIRTIO_RPMSG_F_BUFSZ)) {
|
|
+ virtio_read_config(rvdev->vdev, 0, &fw_config, sizeof(fw_config));
|
|
+ rvdev->config.h2r_buf_size = fw_config.h2r_buf_size;
|
|
+ rvdev->config.r2h_buf_size = fw_config.r2h_buf_size;
|
|
+ }
|
|
|
|
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
|
|
/*
|
|
--
|
|
2.34.1
|
|
|