From: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
"ohad@wizery.com" <ohad@wizery.com>,
"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
"guennadi.liakhovetski@linux.intel.com"
<guennadi.liakhovetski@linux.intel.com>
Cc: Loic PALLARDY <loic.pallardy@st.com>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 05/10] rpmsg: virtio: Move virtio RPMSG structures to private header
Date: Tue, 22 Sep 2020 16:27:56 +0200 [thread overview]
Message-ID: <b4eb29ad-2a7a-487d-c753-5e10a3d70811@st.com> (raw)
In-Reply-To: <20200922001000.899956-6-mathieu.poirier@linaro.org>
On 9/22/20 2:09 AM, Mathieu Poirier wrote:
> Move structure virtiproc_info and virtio_rpmsg_channel to rpmsg_internal.h
> so that they can be used by rpmsg_ns.c
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> drivers/rpmsg/rpmsg_internal.h | 62 ++++++++++++++++++++++++++++++++
> drivers/rpmsg/virtio_rpmsg_bus.c | 57 -----------------------------
> 2 files changed, 62 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
> index 587f723757d4..3ea9cec26fc0 100644
> --- a/drivers/rpmsg/rpmsg_internal.h
> +++ b/drivers/rpmsg/rpmsg_internal.h
> @@ -12,12 +12,74 @@
> #ifndef __RPMSG_INTERNAL_H__
> #define __RPMSG_INTERNAL_H__
>
> +#include <linux/idr.h>
> +#include <linux/mutex.h>
> #include <linux/rpmsg.h>
> +#include <linux/types.h>
> +#include <linux/virtio.h>
This also creates a dependency with virtio
This file is included by several drivers...
Regards,
Arnaud
> +#include <linux/wait.h>
> #include <linux/poll.h>
>
> #define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
> #define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
>
> +/**
> + * struct virtproc_info - virtual remote processor state
> + * @vdev: the virtio device
> + * @rvq: rx virtqueue
> + * @svq: tx virtqueue
> + * @rbufs: kernel address of rx buffers
> + * @sbufs: kernel address of tx buffers
> + * @num_bufs: total number of buffers for rx and tx
> + * @buf_size: size of one rx or tx buffer
> + * @last_sbuf: index of last tx buffer used
> + * @bufs_dma: dma base addr of the buffers
> + * @tx_lock: protects svq, sbufs and sleepers, to allow concurrent senders.
> + * sending a message might require waking up a dozing remote
> + * processor, which involves sleeping, hence the mutex.
> + * @endpoints: idr of local endpoints, allows fast retrieval
> + * @endpoints_lock: lock of the endpoints set
> + * @sendq: wait queue of sending contexts waiting for a tx buffers
> + * @sleepers: number of senders that are waiting for a tx buffer
> + * @ns_ept: the bus's name service endpoint
> + *
> + * This structure stores the rpmsg state of a given virtio remote processor
> + * device (there might be several virtio proc devices for each physical
> + * remote processor).
> + */
> +struct virtproc_info {
> + struct virtio_device *vdev;
> + struct virtqueue *rvq, *svq;
> + void *rbufs, *sbufs;
> + unsigned int num_bufs;
> + unsigned int buf_size;
> + int last_sbuf;
> + dma_addr_t bufs_dma;
> + struct mutex tx_lock;
> + struct idr endpoints;
> + struct mutex endpoints_lock;
> + wait_queue_head_t sendq;
> + atomic_t sleepers;
> + struct rpmsg_endpoint *ns_ept;
> +};
> +
> +/**
> + * struct virtio_rpmsg_channel - rpmsg channel descriptor
> + * @rpdev: the rpmsg channel device
> + * @vrp: the virtio remote processor device this channel belongs to
> + *
> + * This structure stores the channel that links the rpmsg device to the virtio
> + * remote processor device.
> + */
> +struct virtio_rpmsg_channel {
> + struct rpmsg_device rpdev;
> +
> + struct virtproc_info *vrp;
> +};
> +
> +#define to_virtio_rpmsg_channel(_rpdev) \
> + container_of(_rpdev, struct virtio_rpmsg_channel, rpdev)
> +
> /**
> * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
> * @create_channel: create backend-specific channel, optional
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index eaf3b2c012c8..0635d86d490f 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -32,63 +32,6 @@
>
> #include "rpmsg_internal.h"
>
> -/**
> - * struct virtproc_info - virtual remote processor state
> - * @vdev: the virtio device
> - * @rvq: rx virtqueue
> - * @svq: tx virtqueue
> - * @rbufs: kernel address of rx buffers
> - * @sbufs: kernel address of tx buffers
> - * @num_bufs: total number of buffers for rx and tx
> - * @buf_size: size of one rx or tx buffer
> - * @last_sbuf: index of last tx buffer used
> - * @bufs_dma: dma base addr of the buffers
> - * @tx_lock: protects svq, sbufs and sleepers, to allow concurrent senders.
> - * sending a message might require waking up a dozing remote
> - * processor, which involves sleeping, hence the mutex.
> - * @endpoints: idr of local endpoints, allows fast retrieval
> - * @endpoints_lock: lock of the endpoints set
> - * @sendq: wait queue of sending contexts waiting for a tx buffers
> - * @sleepers: number of senders that are waiting for a tx buffer
> - * @ns_ept: the bus's name service endpoint
> - *
> - * This structure stores the rpmsg state of a given virtio remote processor
> - * device (there might be several virtio proc devices for each physical
> - * remote processor).
> - */
> -struct virtproc_info {
> - struct virtio_device *vdev;
> - struct virtqueue *rvq, *svq;
> - void *rbufs, *sbufs;
> - unsigned int num_bufs;
> - unsigned int buf_size;
> - int last_sbuf;
> - dma_addr_t bufs_dma;
> - struct mutex tx_lock;
> - struct idr endpoints;
> - struct mutex endpoints_lock;
> - wait_queue_head_t sendq;
> - atomic_t sleepers;
> - struct rpmsg_endpoint *ns_ept;
> -};
> -
> -/**
> - * struct virtio_rpmsg_channel - rpmsg channel descriptor
> - * @rpdev: the rpmsg channel device
> - * @vrp: the virtio remote processor device this channel belongs to
> - *
> - * This structure stores the channel that links the rpmsg device to the virtio
> - * remote processor device.
> - */
> -struct virtio_rpmsg_channel {
> - struct rpmsg_device rpdev;
> -
> - struct virtproc_info *vrp;
> -};
> -
> -#define to_virtio_rpmsg_channel(_rpdev) \
> - container_of(_rpdev, struct virtio_rpmsg_channel, rpdev)
> -
> /*
> * Local addresses are dynamically allocated on-demand.
> * We do not dynamically assign addresses from the low 1024 range,
>
next prev parent reply other threads:[~2020-09-22 14:28 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 0:09 [PATCH 00/10] rpmsg: Make RPMSG name service modular Mathieu Poirier
2020-09-22 0:09 ` [PATCH 01/10] rpmsg: virtio: rename rpmsg_create_channel Mathieu Poirier
2020-09-22 7:06 ` Guennadi Liakhovetski
2020-09-22 19:22 ` Mathieu Poirier
2020-09-22 0:09 ` [PATCH 02/10] rpmsg: core: Add channel creation internal API Mathieu Poirier
2020-09-30 6:35 ` Guennadi Liakhovetski
2020-10-01 14:46 ` Arnaud POULIQUEN
2020-09-22 0:09 ` [PATCH 03/10] rpmsg: virtio: Add rpmsg channel device ops Mathieu Poirier
2020-09-22 0:09 ` [PATCH 04/10] rpmsg: Move common structures and defines to headers Mathieu Poirier
2020-09-22 14:26 ` Arnaud POULIQUEN
2020-09-22 19:36 ` Mathieu Poirier
2020-09-30 6:54 ` Guennadi Liakhovetski
2020-09-22 0:09 ` [PATCH 05/10] rpmsg: virtio: Move virtio RPMSG structures to private header Mathieu Poirier
2020-09-22 14:27 ` Arnaud POULIQUEN [this message]
2020-09-30 7:03 ` Guennadi Liakhovetski
2020-10-07 17:14 ` Mathieu Poirier
2020-09-22 0:09 ` [PATCH 06/10] rpmsg: Turn name service into a stand alone driver Mathieu Poirier
2020-09-23 1:23 ` kernel test robot
2020-09-30 7:09 ` Guennadi Liakhovetski
2020-10-01 16:14 ` Arnaud POULIQUEN
2020-09-22 0:09 ` [PATCH 07/10] rpmsg: virtio: use rpmsg ns device for the ns announcement Mathieu Poirier
2020-09-22 0:09 ` [PATCH 08/10] rpmsg: core: Add RPMSG byte conversion operations Mathieu Poirier
2020-09-22 1:07 ` Randy Dunlap
2020-09-22 14:34 ` Arnaud POULIQUEN
2020-09-22 19:46 ` Mathieu Poirier
2020-09-23 11:56 ` Dan Carpenter
2020-09-30 7:11 ` Guennadi Liakhovetski
2020-09-22 0:09 ` [PATCH 09/10] rpmsg: virtio: Make endianness conversion virtIO specific Mathieu Poirier
2020-09-23 1:08 ` kernel test robot
2020-09-22 0:10 ` [PATCH 10/10] rpmsg: ns: Make Name service module transport agnostic Mathieu Poirier
2020-09-23 2:39 ` kernel test robot
2020-09-30 7:13 ` Guennadi Liakhovetski
2020-10-07 17:26 ` Mathieu Poirier
2020-09-22 8:09 ` [PATCH 00/10] rpmsg: Make RPMSG name service modular Guennadi Liakhovetski
2020-09-22 19:12 ` Mathieu Poirier
2020-09-24 6:53 ` Guennadi Liakhovetski
2020-09-24 18:18 ` Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4eb29ad-2a7a-487d-c753-5e10a3d70811@st.com \
--to=arnaud.pouliquen@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=loic.pallardy@st.com \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).