Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5492465ybi; Tue, 4 Jun 2019 07:28:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMGvsL9hKXuxaGa4vjmfL9hWSQ5xbPwhrjKOTND8VyTeNDqZyv7cNXw4sA4l5/552yDyuN X-Received: by 2002:a17:90a:2ec3:: with SMTP id h3mr37690322pjs.101.1559658515740; Tue, 04 Jun 2019 07:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559658515; cv=none; d=google.com; s=arc-20160816; b=FAhU5G1E0l3EGzqLMDOzMcj3Pfh2j9tI+/cA/GlcXRbzTr5GCWIAJxWh7DYQToQ6mh 9j/ppFmqONJjeqpyBh0Asd0xmZ0AeR3RHQuruaYfT28t35fmCPmmjchXnHS3SZAwO4+P cnU17kAtVEGm4xCUE/FbnswzL7Cp3PQKbBQr1Iq1FfoUPTA97fOeXEG9AoDoYozEHSf9 BTLQzMoBqqjBd09UluGWCpIMzw9m5R16wp+yOw+SkR/bYuAAuWKbCAkUy7U46IvMPDLe NJBOuaavtFQe2A3h0k5v5Yy13kHOwD5lRNmxMznaTzk7Byk85vljmBp7fbNJ/0uvC7OJ Tbvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=QC6tPV18awZTy2e+pl5FKPuFVr7Xair5W1PAMUFPHtQ=; b=EZ955BM1I+MTgQzsM5DGNoas433C4MGhCBajL/n5J9VQ/vD3u7b3bJke+qIPQBiLJL +OqhA/rmMK3tZRm1ZPvliC4t+REyKSiYRdh5i6mSA3bZmhWIctAHnh5t8WbfdCPCh8+H 4wlfeYoNeV3I2RMdfwogzzdBLoGoWbE6tdwo8A8vtKKb23aW09ytFIVRkDU662Ld5/M7 5Tp2pKF00+gvWDwX+S2bWev0aDcIISSgkpelbKSe3WtQAEaBdQEERmv7h902hXjhFVYR tdtKs6TO1n2oQtmcI9QX1X76VrT0HefMBSoPFub1M/7JTMuc6eFeWRkMtBBMGR2jWftp L2Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=NTOIKAt6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b26si23242873pgl.407.2019.06.04.07.28.16; Tue, 04 Jun 2019 07:28:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=NTOIKAt6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727491AbfFDOZo (ORCPT + 99 others); Tue, 4 Jun 2019 10:25:44 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:41006 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbfFDOZn (ORCPT ); Tue, 4 Jun 2019 10:25:43 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x54EI8YY009446; Tue, 4 Jun 2019 16:25:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=QC6tPV18awZTy2e+pl5FKPuFVr7Xair5W1PAMUFPHtQ=; b=NTOIKAt6i89Xl9ZTTfEj6gwbqC1ubI2+MOvH6jW2lNhJ0N2uIKhEB31PFESMpOffYijj 3ynxvCmToQzESLpH8GMt8NFIEKOW3n9xtry9k0Iw/4UNSVIzlh3WHyiAD1YxN0VhDEXq zjPdkR46BcrdEeZrafBXwRD9YxmUX1aqDIMypCJxzTmucYrdkAHt3251zzdUy/ivb9Y6 ChWwBtdMdfDOXEGZeO8MZR2HUwR5oPmhQIrdNmvBt81AGq7x/uqXMBBTyyvgYTe7m4t+ hsrHEo6TlE7eJVGWbB1PUprGvDvC1dfhv9RsO2uFa7r0JvuEQ+JOek4oMSVh8YDrLEoK 3Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2sund0s364-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Jun 2019 16:25:35 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 916193A; Tue, 4 Jun 2019 14:25:33 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 23C6D2C05; Tue, 4 Jun 2019 14:25:33 +0000 (GMT) Received: from [10.48.0.131] (10.75.127.45) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 4 Jun 2019 16:25:32 +0200 Subject: Re: [PATCH 3/3] rpmsg: virtio_rpmsg_bus: get buffer size from config space To: xiang xiao CC: Ohad Ben Cohen , Bjorn Andersson , , , , Xiang Xiao , Loic PALLARDY , Suman Anna References: <1548949280-31794-1-git-send-email-xiaoxiang@xiaomi.com> <1548949280-31794-4-git-send-email-xiaoxiang@xiaomi.com> From: Arnaud Pouliquen Openpgp: preference=signencrypt Autocrypt: addr=arnaud.pouliquen@st.com; prefer-encrypt=mutual; ke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R7oAvTexpO70f0Jns9GHzoy8sWbnp/LD BSH5iRCwq6Q0hJiEzrVTnO3bBp0WXfgowjXqR+YR86JPrzw2zjgr1e2zCZ1gHBTOyJZiDwAR AQABwsFlBBgBAgAPBQJWbvhyAhsMBQkJZgGAAAoJEP0ZQ+DAfqbfs5AQAJKIr2+j+U3JaMs3 px9bbxcuxRLtVP5gR3FiPR0onalO0QEOLKkXb1DeJaeHHxDdJnVV7rCJX/Fz5CzkymUJ7GIO gpUGstSpJETi2sxvYvxfmTvE78D76rM5duvnGy8lob6wR2W3IqIRwmd4X0Cy1Gtgo+i2plh2 ttVOM3OoigkCPY3AGD0ts+FbTn1LBVeivaOorezSGpKXy3cTKrEY9H5PC+DRJ1j3nbodC3o6 peWAlfCXVtErSQ17QzNydFDOysL1GIVn0+XY7X4Bq+KpVmhQOloEX5/At4FlhOpsv9AQ30rZ 3F5lo6FG1EqLIvg4FnMJldDmszZRv0bR0RM9Ag71J9bgwHEn8uS2vafuL1hOazZ0eAo7Oyup 2VNRC7Inbc+irY1qXSjmq3ZrD3SSZVa+LhYfijFYuEgKjs4s+Dvk/xVL0JYWbKkpGWRz5M82 Pj7co6u8pTEReGBYSVUBHx7GF1e3L/IMZZMquggEsixD8CYMOzahCEZ7UUwD5LKxRfmBWBgK 36tfTyducLyZtGB3mbJYfWeI7aiFgYsd5ehov6OIBlOz5iOshd97+wbbmziYEp6jWMIMX+Em zqSvS5ETZydayO5JBbw7fFBd1nGVYk1WL6Ll72g+iEnqgIckMtxey1TgfT7GhPkR7hl54ZAe 8mOik8I/F6EW8XyQAA2P Message-ID: Date: Tue, 4 Jun 2019 16:25:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-04_10:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Xiang, On 5/9/19 3:00 PM, xiang xiao wrote: > On Thu, May 9, 2019 at 8:36 PM Arnaud Pouliquen wrote: >> >> Hello Xiang, >> >> Similar mechanism has been proposed by Loic 2 years ago (link to the >> series here https://lkml.org/lkml/2017/3/28/349). >> >> Did you see them? Regarding history, patches seem just on hold... >> > > Just saw this patchset, so it's common problem hit by many vendor, > rpmsg framework need to address it.:) > >> Main differences (except interesting RX/TX size split) seems that you >> - don't use the virtio_config_ops->get > > virtio_cread call virtio_config_ops->get internally, the ideal is same > for both patch, just the implementation detail is different. > >> - define a new feature VIRTIO_RPMSG_F_NS. > > I add this flag to keep the compatibility with old remote peer, and > also follow the common virito driver practice. I discussed with Loic, he is ok to go further with your patch and abandon his one. Please find some remarks below in-line > >> >> Regards >> Arnaud >> >> >> On 1/31/19 4:41 PM, Xiang Xiao wrote: >>> 512 bytes isn't always suitable for all case, let firmware >>> maker decide the best value from resource table. >>> enable by VIRTIO_RPMSG_F_BUFSZ feature bit. >>> >>> Signed-off-by: Xiang Xiao >>> --- >>> drivers/rpmsg/virtio_rpmsg_bus.c | 50 +++++++++++++++++++++++++-------------- >>> include/uapi/linux/virtio_rpmsg.h | 24 +++++++++++++++++++ >>> 2 files changed, 56 insertions(+), 18 deletions(-) >>> create mode 100644 include/uapi/linux/virtio_rpmsg.h >>> >>> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c >>> index 59c4554..049dd97 100644 >>> --- a/drivers/rpmsg/virtio_rpmsg_bus.c >>> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c >>> @@ -16,6 +16,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -38,7 +39,8 @@ >>> * @sbufs: kernel address of tx buffers >>> * @num_rbufs: total number of buffers for rx >>> * @num_sbufs: total number of buffers for tx >>> - * @buf_size: size of one rx or tx buffer >>> + * @rbuf_size: size of one rx buffer >>> + * @sbuf_size: size of one tx buffer >>> * @last_sbuf: index of last tx buffer used >>> * @rbufs_dma: dma base addr of rx buffers >>> * @sbufs_dma: dma base addr of tx buffers >>> @@ -61,7 +63,8 @@ struct virtproc_info { >>> void *rbufs, *sbufs; >>> unsigned int num_rbufs; >>> unsigned int num_sbufs; >>> - unsigned int buf_size; >>> + unsigned int rbuf_size; >>> + unsigned int sbuf_size; >>> int last_sbuf; >>> dma_addr_t rbufs_dma; >>> dma_addr_t sbufs_dma; >>> @@ -73,9 +76,6 @@ struct virtproc_info { >>> struct rpmsg_endpoint *ns_ept; >>> }; >>> >>> -/* The feature bitmap for virtio rpmsg */ >>> -#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ >>> - >>> /** >>> * struct rpmsg_hdr - common header for all rpmsg messages >>> * @src: source address >>> @@ -452,7 +452,7 @@ static void *get_a_tx_buf(struct virtproc_info *vrp) >>> >>> /* either pick the next unused tx buffer */ >>> if (vrp->last_sbuf < vrp->num_sbufs) >>> - ret = vrp->sbufs + vrp->buf_size * vrp->last_sbuf++; >>> + ret = vrp->sbufs + vrp->sbuf_size * vrp->last_sbuf++; >>> /* or recycle a used one */ >>> else >>> ret = virtqueue_get_buf(vrp->svq, &len); >>> @@ -578,7 +578,7 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev, >>> * messaging), or to improve the buffer allocator, to support >>> * variable-length buffer sizes. >>> */ >>> - if (len > vrp->buf_size - sizeof(struct rpmsg_hdr)) { >>> + if (len > vrp->sbuf_size - sizeof(struct rpmsg_hdr)) { >>> dev_err(dev, "message is too big (%d)\n", len); >>> return -EMSGSIZE; >>> } >>> @@ -718,7 +718,7 @@ static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev, >>> * We currently use fixed-sized buffers, so trivially sanitize >>> * the reported payload length. >>> */ >>> - if (len > vrp->buf_size || >>> + if (len > vrp->rbuf_size || >>> msg->len > (len - sizeof(struct rpmsg_hdr))) { >>> dev_warn(dev, "inbound msg too big: (%d, %d)\n", len, msg->len); >>> return -EINVAL; >>> @@ -751,7 +751,7 @@ static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev, >>> dev_warn(dev, "msg received with no recipient\n"); >>> >>> /* publish the real size of the buffer */ >>> - rpmsg_sg_init(&sg, msg, vrp->buf_size); >>> + rpmsg_sg_init(&sg, msg, vrp->rbuf_size); >>> >>> /* add the buffer back to the remote processor's virtqueue */ >>> err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, msg, GFP_KERNEL); >>> @@ -907,11 +907,24 @@ static int rpmsg_probe(struct virtio_device *vdev) >>> else >>> vrp->num_sbufs = MAX_RPMSG_NUM_BUFS; >>> >>> - vrp->buf_size = MAX_RPMSG_BUF_SIZE; >>> + /* try to get buffer size from config space */ >>> + if (virtio_has_feature(vdev, VIRTIO_RPMSG_F_BUFSZ)) { >>> + /* note: virtio_rpmsg_config is defined from remote view */ >>> + virtio_cread(vdev, struct virtio_rpmsg_config, >>> + txbuf_size, &vrp->rbuf_size); >>> + virtio_cread(vdev, struct virtio_rpmsg_config, >>> + rxbuf_size, &vrp->sbuf_size); >>> + } >>> + >>> + /* use the default if resource table doesn't provide one */ >>> + if (!vrp->rbuf_size) >>> + vrp->rbuf_size = MAX_RPMSG_BUF_SIZE; In this case constant should be renamed DEFAULT_RPMSG_BUF_SIZE as it is no more a max value >>> + if (!vrp->sbuf_size) >>> + vrp->sbuf_size = MAX_RPMSG_BUF_SIZE; Here, if the config space exists you need to update it in consequence to ensure coherency with the remote processor config. >>> >>> /* allocate coherent memory for the buffers */ >>> vrp->rbufs = dma_alloc_coherent(vdev->dev.parent->parent, >>> - vrp->num_rbufs * vrp->buf_size, >>> + vrp->num_rbufs * vrp->rbuf_size, >>> &vrp->rbufs_dma, GFP_KERNEL); >>> if (!vrp->rbufs) { >>> err = -ENOMEM; >>> @@ -922,7 +935,7 @@ static int rpmsg_probe(struct virtio_device *vdev) >>> vrp->rbufs, &vrp->rbufs_dma); >>> >>> vrp->sbufs = dma_alloc_coherent(vdev->dev.parent->parent, >>> - vrp->num_sbufs * vrp->buf_size, >>> + vrp->num_sbufs * vrp->sbuf_size, >>> &vrp->sbufs_dma, GFP_KERNEL); >>> if (!vrp->sbufs) { >>> err = -ENOMEM; >>> @@ -935,9 +948,9 @@ static int rpmsg_probe(struct virtio_device *vdev) >>> /* set up the receive buffers */ >>> for (i = 0; i < vrp->num_rbufs; i++) { >>> struct scatterlist sg; >>> - void *cpu_addr = vrp->rbufs + i * vrp->buf_size; >>> + void *cpu_addr = vrp->rbufs + i * vrp->rbuf_size; >>> >>> - rpmsg_sg_init(&sg, cpu_addr, vrp->buf_size); >>> + rpmsg_sg_init(&sg, cpu_addr, vrp->rbuf_size); >>> >>> err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, cpu_addr, >>> GFP_KERNEL); >>> @@ -984,11 +997,11 @@ static int rpmsg_probe(struct virtio_device *vdev) >>> >>> free_sbufs: >>> dma_free_coherent(vdev->dev.parent->parent, >>> - vrp->num_sbufs * vrp->buf_size, >>> + vrp->num_sbufs * vrp->sbuf_size, >>> vrp->sbufs, vrp->sbufs_dma); >>> free_rbufs: >>> dma_free_coherent(vdev->dev.parent->parent, >>> - vrp->num_rbufs * vrp->buf_size, >>> + vrp->num_rbufs * vrp->rbuf_size, >>> vrp->rbufs, vrp->rbufs_dma); >>> vqs_del: >>> vdev->config->del_vqs(vrp->vdev); >>> @@ -1023,10 +1036,10 @@ static void rpmsg_remove(struct virtio_device *vdev) >>> vdev->config->del_vqs(vrp->vdev); >>> >>> dma_free_coherent(vdev->dev.parent->parent, >>> - vrp->num_sbufs * vrp->buf_size, >>> + vrp->num_sbufs * vrp->sbuf_size, >>> vrp->sbufs, vrp->sbufs_dma); >>> dma_free_coherent(vdev->dev.parent->parent, >>> - vrp->num_rbufs * vrp->buf_size, >>> + vrp->num_rbufs * vrp->rbuf_size, >>> vrp->rbufs, vrp->rbufs_dma); >>> >>> kfree(vrp); >>> @@ -1039,6 +1052,7 @@ static struct virtio_device_id id_table[] = { >>> >>> static unsigned int features[] = { >>> VIRTIO_RPMSG_F_NS, >>> + VIRTIO_RPMSG_F_BUFSZ, >>> }; >>> >>> static struct virtio_driver virtio_ipc_driver = { >>> diff --git a/include/uapi/linux/virtio_rpmsg.h b/include/uapi/linux/virtio_rpmsg.h >>> new file mode 100644 >>> index 0000000..24fa0dd >>> --- /dev/null >>> +++ b/include/uapi/linux/virtio_rpmsg.h Strange to define a user space API for kernel usage need. Could you elaborate? >>> @@ -0,0 +1,24 @@ >>> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >>> +/* >>> + * Copyright (C) Pinecone Inc. 2019 >>> + * Copyright (C) Xiang Xiao >>> + */ >>> + >>> +#ifndef _UAPI_LINUX_VIRTIO_RPMSG_H >>> +#define _UAPI_LINUX_VIRTIO_RPMSG_H >>> + >>> +#include >>> + >>> +/* The feature bitmap for virtio rpmsg */ >>> +#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ >>> +#define VIRTIO_RPMSG_F_BUFSZ 2 /* RP get buffer size from config space */ Would be useful to document it in rpmsg.txt >>> + >>> +struct virtio_rpmsg_config { >>> + /* The tx/rx individual buffer size(if VIRTIO_RPMSG_F_BUFSZ) */ >>> + __u32 txbuf_size; >>> + __u32 rxbuf_size; >>> + __u32 reserved[14]; /* Reserve for the future use */ >>> + /* Put the customize config here */ >>> +} __attribute__((packed)); >>> + Wouldn't it be better to add an identifier and a version fields at the beginning of the structure? Idea would be to simplify a future extension In this case is VIRTIO_RPMSG_F_BUFSZ still useful? >>> +#endif /* _UAPI_LINUX_VIRTIO_RPMSG_H */ >>> -- Thanks Arnaud