From nobody Mon Jul 27 02:16:09 2026 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012052.outbound.protection.outlook.com [40.93.195.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFD8F380FCA; Fri, 10 Jul 2026 19:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.195.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711727; cv=fail; b=OdQhaHjqnJ4twm5+dAM2G4AtUCai+FCNM3Uw/qR89gupT6J9k7bm5/9stif9y7blUe83GXXdvWAOVQkZz0H5wuYfq3qE7kCOWVFQzWy923tS6SIGhxEvmNU4aoxeWrCInPp2DIjrRrMs4g/lEUKnIiDunPSLjGKUSLs+5dvZ6XM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711727; c=relaxed/simple; bh=CYQkMLkkrfsdNpg1ubpRobyp6s2z63w5pyvWeP28dR8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uEdLiKbA4ep5LNQBYvw12IZZcuGnmMrSsF9fTYxCLbHXYjNjk4oSqs97IpQTkmnec6RwacyQFECMvNXZqX2Ce0YthhBt5Trhla+ZjBXE8xlsygl25fapgtFhJokYoEMLOdB5vaPxPW8Qx9A6cvLG4ymnxjyF6/Y/5WCfMlC9NLQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=fvOmdokn; arc=fail smtp.client-ip=40.93.195.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="fvOmdokn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QnZILlSsG3def94avSI2mGnkoSuA7rbqSuyMQWnVEMFSAUrhP2ckNPdKbii1xY7AnD3si/UaWUiZv9rdsAdR4ugCH+mPvjjHPPcqrNQY0Qx9y4MWnShTHBg0L6pceuf7PhloMZXH4lWT3ShHEiOXHTKqlX6yisKEPT4DrzP2ViGTTkl4lLtgHFVTfmHny1XVj+TOTS2s2Uw3GJgxT1cOOH+rgKGq/whwAnqrovuNahmzr2HixP6ZGJTrOUMcPMjoB1aV3h8vbh34DoLSzbSbs84mDqM8HjEb0pGC0GOZO/Pa3CDoebOimnzWx/vYVozykZ1PFFDT/B6yDVs2fjPy+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/J1zx2hwne3/fExXhDmGfBDtcT23WUWHOUSAIx5Na1Y=; b=cLi7LfrozkTiRAyaKm4OKtBe4no4yA8HYwvlmDgA/zgfH2c5ZrxMXipiNe/j2jVycuoJoJDT726zrHqA1iq4otuSv1TSfG2q+FSZ3jbocOvroX+yFqzAi5SP8mn3cBJk0zkeKuIDeo5RDq5Iuc44TtzmG5S/qMUhZ9y/SvzsEtyHlGFxOMb8xGahVKoFE2zYtngnXZWkqY/6Vi/DawG5TE1rILt6mk7FamCaMAwEhjFgqgnz/1Y2XSETxZCv/gb3vTBpJbZWWUBkzdydehAnwI4QFDj0QWudJMx8oc7pwVFdO20PSD0ZfVjWSh+NEx71H91SrQALsa/yaC0NPGhn7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/J1zx2hwne3/fExXhDmGfBDtcT23WUWHOUSAIx5Na1Y=; b=fvOmdokni4ef5erD807Z9p6zum1OD+LEEJZPDo6CAwmiWoQKK7chLLBoVETmYV1EDyzXyeNLF5o2hrjs/qjOnr2B9WWZWW4hm/Y6rJk/mF7mREjNGwcWmzf1AwF/HiMCp0O0KrS6SFdtE5sJLnW1B/M+MyygzK7DFoI2AmXkQ0Y= Received: from DS7PR03CA0298.namprd03.prod.outlook.com (2603:10b6:5:3ad::33) by LV8PR12MB9644.namprd12.prod.outlook.com (2603:10b6:408:296::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.17; Fri, 10 Jul 2026 19:28:35 +0000 Received: from DS2PEPF000061C7.namprd02.prod.outlook.com (2603:10b6:5:3ad:cafe::7e) by DS7PR03CA0298.outlook.office365.com (2603:10b6:5:3ad::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.14 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS2PEPF000061C7.mail.protection.outlook.com (10.167.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.6 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:34 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:33 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Fri, 10 Jul 2026 14:28:33 -0500 From: Tanmay Shah To: , , , CC: , , , Tanmay Shah Subject: [PATCH v5 1/5] rpmsg: virtio_rpmsg_bus: rename rbufs and sbufs Date: Fri, 10 Jul 2026 12:28:27 -0700 Message-ID: <20260710192831.3440427-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260710192831.3440427-1-tanmay.shah@amd.com> References: <20260710192831.3440427-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF000061C7:EE_|LV8PR12MB9644:EE_ X-MS-Office365-Filtering-Correlation-Id: cc15da84-6ccc-4992-b380-08dedeb96f5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|23010399003|82310400026|36860700016|1800799024|18002099003|22082099003|11063799006|6133799003|56012099006; X-Microsoft-Antispam-Message-Info: 8vYDZKwFn5ApI909Z3fijG6jG95C3bYn5B6PITrG3QlQEBdYyLAbw0MC1mwhG5V4SaoUj8uAm64IrDvl8sSn0j71afCyC+M7jwTTrBvvhiitJkZhRBp7/dip1xKMPFj78CZLcfcrkhf+E7MbG6vGR3TvF5Rlj8LaYJx8Em/Ow9hg0jmrO6PrR6xLS+UixvuH4gma/7kVSjfM78LwzdUUw3oVrK2QXo5X12r9dKhgbD/N4iNOxGT4s4I1gsOlLtjLnhi+n1XhsoEwEds8KPM/nqows6egbxTUGAUlLvJbFY1PQZsJvRAgK3P70bVQYFMK9GHYx2RInoI8XGEVknhZysQ22GWB+Hc5L3XqcRZAtXDAJYYD9z3kJMUlAJ8mghIBB69U0WES4YLS1N0mru6sNRovApP84ZJQoq97CHLuBVJooNGVy17gLGcDsuaAKN8gGgv1vLY1qarhTPn9NAJd4X/jGrgntr2/ZKzJjSV4JxQD5nadXCWS6loQ3TVbfAu8h4cc6My0wp/Nppk+h+T11vKdR+GAKXWMAyilcpixfyoEgRCuPA2Lp9LulbsISe50ARdaYA6a03olGCr7WBx+QLBMgM27gW8ywXMDHpoBQb2pQiUSmFvdNN4Dphtmcdncu6jJpqh22FjO3YLmHM6tYXj2++XnqbQQ9s6X5IS+VliKEc+N6b6Fh8+qo2HYopntq+nInxUg2H8caAvrAL2ORA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(23010399003)(82310400026)(36860700016)(1800799024)(18002099003)(22082099003)(11063799006)(6133799003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z5cWXxMd6VfbwoeAAa03I8aGwkxDjU1rRe1QTXSqqcZsGIHJBUz5Z2fLrTSEEGsy5TcLbwyebUvP3pJvZwhZAkkOUzshP3JOie7xMZ0iVtn9vyiboMgFsOMhGG1xUCPZ816qGQBjOxvi/GO042+ChQZ14j0cPBAxqEioPpSdZcpT0pOM4t+04in7vYhLZVr6zF7WjshJO4lnghMOxb9vDFH7Khsk7m6G8UgSMn/iLo54FeGkVxCt3VqgXSaATuLWF3+Yi07c4b9zFZtRGc8wypuO+WVn2tzygmg3nouSKKNa+7ChalFBRTvKTUywrFzwrW8BZwUDpiUuWxkv88G2zZPpOWUg6FxLAyIaYuSXeolVvj0iPFANE9TgW4hG2L1CUlh3rxbGAPNEs7Kt9rnTmEtK7FxTt3MfVRvfMEHCq50OWrZCOhZu6otVMZ0wXw9r X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2026 19:28:35.1119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc15da84-6ccc-4992-b380-08dedeb96f5d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF000061C7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9644 Content-Type: text/plain; charset="utf-8" rename variables with clear names. %s/rbufs/rx_bufs/ %s/sbufs/tx_bufs/ %s/last_sbuf/last_tx_buf/ Signed-off-by: Tanmay Shah --- drivers/rpmsg/virtio_rpmsg_bus.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_= bus.c index 1b8bb05924af..55cd65b14f80 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -35,13 +35,13 @@ * @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 + * @rx_bufs: kernel address of rx buffers + * @tx_bufs: 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 + * @last_tx_buf: index of last tx buffer used * @bufs_dma: dma base addr of the buffers - * @tx_lock: protects svq and sbufs, to allow concurrent senders. + * @tx_lock: protects svq and tx_bufs, 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 @@ -55,10 +55,10 @@ struct virtproc_info { struct virtio_device *vdev; struct virtqueue *rvq, *svq; - void *rbufs, *sbufs; + void *rx_bufs, *tx_bufs; unsigned int num_bufs; unsigned int buf_size; - int last_sbuf; + int last_tx_buf; dma_addr_t bufs_dma; struct mutex tx_lock; struct idr endpoints; @@ -443,8 +443,8 @@ static void *get_a_tx_buf(struct virtproc_info *vrp) * either pick the next unused tx buffer * (half of our buffers are used for sending messages) */ - if (vrp->last_sbuf < vrp->num_bufs / 2) - ret =3D vrp->sbufs + vrp->buf_size * vrp->last_sbuf++; + if (vrp->last_tx_buf < vrp->num_bufs / 2) + ret =3D vrp->tx_bufs + vrp->buf_size * vrp->last_tx_buf++; /* or recycle a used one */ else ret =3D virtqueue_get_buf(vrp->svq, &len); @@ -634,7 +634,7 @@ static __poll_t virtio_rpmsg_poll(struct rpmsg_endpoint= *ept, struct file *filp, * allocated buffers are used for transmit, hence num_bufs / 2), or, * - we ask the virtqueue if there's a buffer available */ - if (vrp->last_sbuf < vrp->num_bufs / 2 || + if (vrp->last_tx_buf < vrp->num_bufs / 2 || !virtqueue_enable_cb(vrp->svq)) mask |=3D EPOLLOUT; =20 @@ -872,15 +872,15 @@ static int rpmsg_probe(struct virtio_device *vdev) bufs_va, &vrp->bufs_dma); =20 /* half of the buffers is dedicated for RX */ - vrp->rbufs =3D bufs_va; + vrp->rx_bufs =3D bufs_va; =20 /* and half is dedicated for TX */ - vrp->sbufs =3D bufs_va + total_buf_space / 2; + vrp->tx_bufs =3D bufs_va + total_buf_space / 2; =20 /* set up the receive buffers */ for (i =3D 0; i < vrp->num_bufs / 2; i++) { struct scatterlist sg; - void *cpu_addr =3D vrp->rbufs + i * vrp->buf_size; + void *cpu_addr =3D vrp->rx_bufs + i * vrp->buf_size; =20 rpmsg_sg_init(&sg, cpu_addr, vrp->buf_size); =20 @@ -979,7 +979,7 @@ static void rpmsg_remove(struct virtio_device *vdev) vdev->config->del_vqs(vrp->vdev); =20 dma_free_coherent(vdev->dev.parent, total_buf_space, - vrp->rbufs, vrp->bufs_dma); + vrp->rx_bufs, vrp->bufs_dma); =20 kfree(vrp); } --=20 2.34.1 From nobody Mon Jul 27 02:16:09 2026 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013036.outbound.protection.outlook.com [40.93.196.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C631D37FF63; Fri, 10 Jul 2026 19:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711725; cv=fail; b=CImlYPnKdM+xoQccpjhvjRKmxtbuppaNHiEI3I/F0cUXgg8UHQLvwj1txp1IU98xqhPELWeNPk7WDz9E5A7Cs0EOFyBSSJaASbTQZMty4BTv0eFC9k72mJhd3QqpryeYb97MuGDm8KZudMI/zOipLai6dLlEMI8uXDX/+kuQohQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711725; c=relaxed/simple; bh=MHMjzYGW2rxwqAKhBVTHYFzH8YKIdDbY7QgZWS+Fm70=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JZfRtaA7Rz+DhH9pwiR8txmUYAJ7KMuRfWphvZ2jglq0g7Vk1XwzCLlTWqNSqdSETlkBCWzQYCX4PsFfLciD/rhJ0AHsWTf83BUrVx6zddujQGXsEMEJjDCD0UfL90rIZHMfz93fXuV+8UvGRkjW1JtsZf2alGujdPrWwyDORA4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=jHKdittp; arc=fail smtp.client-ip=40.93.196.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jHKdittp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nlVQYS8HugwtxxfsVEbXCIhbtCYI0cHrr4jn8hGtD8L3oLO7iJWjUBXWLQRXh3PjZn3p1R7aL3wsBG5/cXqZvwYXW07OlzNxYAqX0Y+GU9NvsXEljNWvI7O2CkFRZprucl0SRkNKH2lGS6b5tZDsA6EAJlS1ehtyE59XA6jBsQUyCR7pixMjilb9Cy/I3yYvqxw/s66Hmf3InsEUXKl2BEMbfM76nMOmMbyYTyTI3xW86Q3ho+aS1pUxJkD5Z+JWqBXc25FrQorzZ+MrjY/nYNf3FbUmpnzZFNQNUDboILrlojYSpNL6rZPht4t3uC7NrrMdBrTdPDKrYnWoZfA9Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CvUvI+gkpSMQPhmUtjdO8lrUqEozs22M4RUCxezww54=; b=M+5jFGSPOevBsEbfMrkr3Wf2jU2ktJzMf5ONLRY/eE9bhLfh4kzsFKbglUBmlbh2n7EKdhTqc0dX/vbqgIs5Nwc8ylbWRTCxalAvlmk+MyCvXxo5bL/OgqHENRSu+ZBlYtHVI1UrZfFL5gI6y537fMFMhi/QwLXAAVtSEp5PNq86cc7/FupXu6RYaX1C8Y/VxOTXmHjDkEHemx3QtaTrT8q8IAs8dtk/YkeiqqUv2zuzkUNUjJU5HxIcrgLhgANQEpsGgFpBTQlfcVSYrrsaB+S0S0S28UYKj2DlywXyQ1Yz7E1F74yuG8Kf4VBFwx/NkM2qINwWls1WWv6v3oW+PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CvUvI+gkpSMQPhmUtjdO8lrUqEozs22M4RUCxezww54=; b=jHKdittpWENoA7EAIw1z5W/DvJvVYE2bJiQdHvfw7vpVI8vgUjRwUPQOnNBF4v1NFREBbakEzF8s9OVdXDw7H0Qc8ZIfObt2L3VIOIa+MylyNZjKiWvmdClUDlAhlE35usU0OmsvkHQKNpcEB0F5KGP8gTXsGroQM3m8DL6Jt60= Received: from DS7PR03CA0277.namprd03.prod.outlook.com (2603:10b6:5:3ad::12) by LV3PR12MB9168.namprd12.prod.outlook.com (2603:10b6:408:19a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.17; Fri, 10 Jul 2026 19:28:36 +0000 Received: from DS2PEPF000061C7.namprd02.prod.outlook.com (2603:10b6:5:3ad:cafe::1) by DS7PR03CA0277.outlook.office365.com (2603:10b6:5:3ad::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.14 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS2PEPF000061C7.mail.protection.outlook.com (10.167.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.6 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:34 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Fri, 10 Jul 2026 14:28:34 -0500 From: Tanmay Shah To: , , , CC: , , , Tanmay Shah Subject: [PATCH v5 2/5] rpmsg: virtio_rpmsg_bus: allow different size of tx and rx bufs Date: Fri, 10 Jul 2026 12:28:28 -0700 Message-ID: <20260710192831.3440427-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260710192831.3440427-1-tanmay.shah@amd.com> References: <20260710192831.3440427-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF000061C7:EE_|LV3PR12MB9168:EE_ X-MS-Office365-Filtering-Correlation-Id: cef9904c-dc15-475b-a7d3-08dedeb96fd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|23010399003|36860700016|1800799024|82310400026|11063799006|56012099006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: X1//n4QLHBrGLYwhRSyuyjYHHje5Cs7NNECv5VitCEsDDRnOoAZlh8hqqgF+AnGauXmlP4jW2VBmuLeLeVF/NeC3bgb1amkPyCT4TljZOchAErbleMiOBgkpZN1aXvanJ8YK0Qhub0P7Ls5aVNbNoYwBGDQo4jRY39d45cFJe847kO1rELHpUYKJucNCC1xpb6775J9+not2+6evpsRjiGCd7NmC/yaNmEIIlygPbBhyBXWOWzTjiLR+UAhV2M1uRUGwlWPOYt6ClyI5xX6E3bvs7ej4eV5grvc9/dP6IEkuPZMwSIP0dQHOOS3+8IMh2D9czcqyaelDn/h9aRtzS2+q7fTh4D4rcoXHt1hEP2bXSmWvJFQ6gRT2d9sbUmCY/1PcZ0fwlihHhMFdukKa994rdmMg1XZmh+Lip9z2s1rATGR7B43GvHnHREMehOAt12t0UN2h5k/4vesdCF9UuYJUnoV3S1URruUj0or70FWvSo1ja8efnyHr3zTkRwyqb3SdmTMXjkEvzSTRmf/BpP7moL71Yqc+gGTbfoEwoxeifnv68ZIfWDDE+t7qqjVkGmyLMeaHseP6FnjnzMvtgn+WBYPYbVwTMhO1yQSEiBUAJF5g4gtb2czprNbbHBrWRyqfd9UFNGojIRVCbIYhQ/6Vej+WmITRO1753Ff3aM5E9NdYrw02cbFFdwwHIgqS+DekrYkZIktnXNiYnrk9LA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(23010399003)(36860700016)(1800799024)(82310400026)(11063799006)(56012099006)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cI0zymP4Vrr4oaAW0fvs5FfehCevpdBXly1DkaCrejvLnE77iMTln1KH7j5vQeFuMSRFyF6RfmWKJ38Gj869biubilHvOl8aPq3adKAEcoMq5QnVfTsmisy6S+xgTvZbnq4WIkvKwh+sg/qq2ZVVNzaH92Dxr8h/c++Tj/vvYN2JVLdp+yzeTWvMZjW02p/nrR6CXyCn0ErgrWosN30UWCfmAKKucz8QTRSkJ39L+247Eb5ycYJZVBgwkbiCcSh9GjGVbXNJG4Y8Zo9uQvhxsvZDD4klpzedk0OSenygIlJ3vCVy8mKqO8vm1fXNjb4tz4z6OzPQUbGpBqTQa1qX9hBE7Q6DZUitIC7LjnVc8S1ysfREdgMUpg8UW85O4YbAqajZnifFOOQ6OklkfzkorNQTv++HwWxoGkKyz9e9PGJ/SBDzfvO6Iy1YE/bb7o1k X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2026 19:28:35.9409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cef9904c-dc15-475b-a7d3-08dedeb96fd6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF000061C7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9168 Content-Type: text/plain; charset="utf-8" Current design allocates memory for tx and rx buffers equally. The throughput can be increased if the user is allowed to configure number of tx and rx buffers as required. Hence, do not split number of tx & rx buffers into half, but decide based on respective vring size. Signed-off-by: Tanmay Shah --- drivers/rpmsg/virtio_rpmsg_bus.c | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_= bus.c index 55cd65b14f80..c84b6cec9caf 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -37,7 +37,8 @@ * @svq: tx virtqueue * @rx_bufs: kernel address of rx buffers * @tx_bufs: kernel address of tx buffers - * @num_bufs: total number of buffers for rx and tx + * @num_rx_buf: total number of rx buffers + * @num_tx_buf: total number of tx buffers * @buf_size: size of one rx or tx buffer * @last_tx_buf: index of last tx buffer used * @bufs_dma: dma base addr of the buffers @@ -56,7 +57,8 @@ struct virtproc_info { struct virtio_device *vdev; struct virtqueue *rvq, *svq; void *rx_bufs, *tx_bufs; - unsigned int num_bufs; + unsigned int num_rx_buf; + unsigned int num_tx_buf; unsigned int buf_size; int last_tx_buf; dma_addr_t bufs_dma; @@ -110,7 +112,7 @@ struct virtio_rpmsg_channel { /* * We're allocating buffers of 512 bytes each for communications. The * number of buffers will be computed from the number of buffers supported - * by the vring, upto a maximum of 512 buffers (256 in each direction). + * by the vring, up to a maximum of 256 in each direction. * * Each buffer will have 16 bytes for the msg header and 496 bytes for * the payload. @@ -125,7 +127,7 @@ struct virtio_rpmsg_channel { * can change this without changing anything in the firmware of the remote * processor. */ -#define MAX_RPMSG_NUM_BUFS (512) +#define MAX_RPMSG_NUM_BUFS (256) #define MAX_RPMSG_BUF_SIZE (512) =20 /* @@ -439,11 +441,8 @@ static void *get_a_tx_buf(struct virtproc_info *vrp) =20 mutex_lock(&vrp->tx_lock); =20 - /* - * either pick the next unused tx buffer - * (half of our buffers are used for sending messages) - */ - if (vrp->last_tx_buf < vrp->num_bufs / 2) + /* either pick the next unused tx buffer */ + if (vrp->last_tx_buf < vrp->num_tx_buf) ret =3D vrp->tx_bufs + vrp->buf_size * vrp->last_tx_buf++; /* or recycle a used one */ else @@ -630,11 +629,10 @@ static __poll_t virtio_rpmsg_poll(struct rpmsg_endpoi= nt *ept, struct file *filp, =20 /* * check for a free buffer, either: - * - we haven't used all of the available transmit buffers (half of the - * allocated buffers are used for transmit, hence num_bufs / 2), or, + * - we haven't used all of the available transmit buffers or, * - we ask the virtqueue if there's a buffer available */ - if (vrp->last_tx_buf < vrp->num_bufs / 2 || + if (vrp->last_tx_buf < vrp->num_tx_buf || !virtqueue_enable_cb(vrp->svq)) mask |=3D EPOLLOUT; =20 @@ -845,19 +843,20 @@ static int rpmsg_probe(struct virtio_device *vdev) vrp->rvq =3D vqs[0]; vrp->svq =3D vqs[1]; =20 - /* we expect symmetric tx/rx vrings */ - WARN_ON(virtqueue_get_vring_size(vrp->rvq) !=3D - virtqueue_get_vring_size(vrp->svq)); - /* we need less buffers if vrings are small */ - if (virtqueue_get_vring_size(vrp->rvq) < MAX_RPMSG_NUM_BUFS / 2) - vrp->num_bufs =3D virtqueue_get_vring_size(vrp->rvq) * 2; + if (virtqueue_get_vring_size(vrp->rvq) < MAX_RPMSG_NUM_BUFS) + vrp->num_rx_buf =3D virtqueue_get_vring_size(vrp->rvq); + else + vrp->num_rx_buf =3D MAX_RPMSG_NUM_BUFS; + + if (virtqueue_get_vring_size(vrp->svq) < MAX_RPMSG_NUM_BUFS) + vrp->num_tx_buf =3D virtqueue_get_vring_size(vrp->svq); else - vrp->num_bufs =3D MAX_RPMSG_NUM_BUFS; + vrp->num_tx_buf =3D MAX_RPMSG_NUM_BUFS; =20 vrp->buf_size =3D MAX_RPMSG_BUF_SIZE; =20 - total_buf_space =3D vrp->num_bufs * vrp->buf_size; + total_buf_space =3D (vrp->num_rx_buf + vrp->num_tx_buf) * vrp->buf_size; =20 /* allocate coherent memory for the buffers */ bufs_va =3D dma_alloc_coherent(vdev->dev.parent, @@ -871,14 +870,14 @@ static int rpmsg_probe(struct virtio_device *vdev) dev_dbg(&vdev->dev, "buffers: va %p, dma %pad\n", bufs_va, &vrp->bufs_dma); =20 - /* half of the buffers is dedicated for RX */ + /* first part of the buffers is dedicated for RX */ vrp->rx_bufs =3D bufs_va; =20 - /* and half is dedicated for TX */ - vrp->tx_bufs =3D bufs_va + total_buf_space / 2; + /* and second part is dedicated for TX */ + vrp->tx_bufs =3D bufs_va + vrp->num_rx_buf * vrp->buf_size; =20 /* set up the receive buffers */ - for (i =3D 0; i < vrp->num_bufs / 2; i++) { + for (i =3D 0; i < vrp->num_rx_buf; i++) { struct scatterlist sg; void *cpu_addr =3D vrp->rx_bufs + i * vrp->buf_size; =20 @@ -965,7 +964,8 @@ static int rpmsg_remove_device(struct device *dev, void= *data) static void rpmsg_remove(struct virtio_device *vdev) { struct virtproc_info *vrp =3D vdev->priv; - size_t total_buf_space =3D vrp->num_bufs * vrp->buf_size; + unsigned int num_bufs =3D vrp->num_rx_buf + vrp->num_tx_buf; + size_t total_buf_space =3D num_bufs * vrp->buf_size; int ret; =20 virtio_reset_device(vdev); --=20 2.34.1 From nobody Mon Jul 27 02:16:09 2026 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013000.outbound.protection.outlook.com [40.93.196.0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 986FC3859F7; Fri, 10 Jul 2026 19:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.0 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711732; cv=fail; b=gK5IAALTqo3CB0EzLUwe2Flst2PR7hr6MmmmVDT06isDanoxPrVOWuuPRHPSt9cN+lSSvvt5CRrFz5BZ1Q+P1PFOB9qbWyhIIfqZXBEkPpjxlehfXILey1LEb8NWPwLjG7aC1UcRJfMaoBV0xlPhIhB8rqndWtO/OXeGFxJrMFg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711732; c=relaxed/simple; bh=UVGbY9vWrMB66SAggNMtZrPJTStjF4f4mmfcNIYgBko=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nuk242ae1vP/BCYcdnbZOC5WFnsSjQOGVzNxcnTm9q7ia+6+o6VYT7lTxBp/P3UkBrGuPVzrIEy8al4igeL1uwjKnLI4ow7MmcJzN9hihcIM585D4hhsvJPrervxVIcgicZysu9s537VLM+OCEcZtcfM9onqA1sdh+50/gDgokc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=tvHK4Z1u; arc=fail smtp.client-ip=40.93.196.0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tvHK4Z1u" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HFCd8Etu4d4vqbzYHpt7KDFNlKwLrBu7x2XLSu8r5SFBRw6M/TQxmyvHvGbkOFHUxk+ddyBDReTFYLhFJZuF6zWdKut5IHrWFlL+bDs/1rlBKnVpX6ZUNdDZnj89O2HMXJGo6KyqfrVwfCr7MNpSFn9fl1FbGFyroV2nRmAlbooAxnRZ7cBANrhJ4mNMbge3zSjbGerzL0np2w3NjdI7LdtUvU41q0AAdz4LbP7mDxxyPxoDPh2a4tinoZBfzzTDX8cOirfM9kAQ+RkWwtAf8BDhfEXKmmXDfui4bPuaKxWsmCII0QcsBkWjB9hCXns/QnwRNbng/PjGmJNK6owRyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M45HqpEk7qmAWzaMTrzEezXJVyYHP8SjsrtFonZrqRg=; b=agPl65oJ59Z3h0zENmhb6lVBFHMqQxCfgM9QFY799SQhEU8ihqMQAxGRrCvOssUNVQAMTRMzMQCi6/iXmxtseztmyOxdJTdA9LlFiMHHaVD93s02HjrdSyZEMCPuqBT2sVB0LVvcXqnr0etCJwjyVQ4pKYh08Hgzr+MR5RImty9pophl0+yUJ73Pmz+L8upAY/dGZsitK5g1m+1mokFef+kG86l1DiY7yjzh3UGYgcbB2qM1pDIr2iTrf8vc3tWfp0ROsMNLK+ivTCJgbEdPU3O+0aK2YKJYJDFh7TrRFiU1/2ykiIwtwUot1ISYgl9rhKY3X3m0yEcvFKJRKaVAfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M45HqpEk7qmAWzaMTrzEezXJVyYHP8SjsrtFonZrqRg=; b=tvHK4Z1uY8+IlYqeDFelZH250M6peJP9eeAN7EVdEOjy9fDjpu5xmSWmuQqaZKra/3/bKTmvAjekad4UIImgqpIaYzlUQkMBQ2sAokzw9ALfIsWExD1RPAhGB2BnvY6x4afoIShYFy/tvwK+grBN0vP1RrkNL/ekd+iqC/qEqVg= Received: from MN2PR14CA0027.namprd14.prod.outlook.com (2603:10b6:208:23e::32) by SJ2PR12MB9005.namprd12.prod.outlook.com (2603:10b6:a03:53d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.16; Fri, 10 Jul 2026 19:28:36 +0000 Received: from BN3PEPF0000B075.namprd04.prod.outlook.com (2603:10b6:208:23e:cafe::28) by MN2PR14CA0027.outlook.office365.com (2603:10b6:208:23e::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.11 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN3PEPF0000B075.mail.protection.outlook.com (10.167.243.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.6 via Frontend Transport; Fri, 10 Jul 2026 19:28:35 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:35 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:35 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Fri, 10 Jul 2026 14:28:34 -0500 From: Tanmay Shah To: , , , CC: , , , Tanmay Shah Subject: [PATCH v5 3/5] rpmsg: virtio_rpmsg_bus: get buffer size from config space Date: Fri, 10 Jul 2026 12:28:29 -0700 Message-ID: <20260710192831.3440427-4-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260710192831.3440427-1-tanmay.shah@amd.com> References: <20260710192831.3440427-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B075:EE_|SJ2PR12MB9005:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ed37cc2-b38f-4cc6-84ec-08dedeb96fb6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|1800799024|376014|82310400026|36860700016|18002099003|22082099003|11063799006|56012099006|6133799003; X-Microsoft-Antispam-Message-Info: DOjN7YB8qTbAwcaps1WjSSXvA/g3ZwTM0kb/JQu5hClUSvHYtP+6FEu6p90vkTnQtIlaKzsQ7qHoI8XoAfUF05g9HLR0523nbJSggMJxSUoIfcs8wmZUitjQxyei7bszbnKzEx7B8bAe/Rxnk3beqJ84PYiDIAvaXP5VnhSGr1mGeJKWTaMYjLVqD00wZYuIc/Ovf7aHcF7L3/HtAS6SSBJOGBYYPwo8lUnjvDRBLNBb+BfVb0+Cb97pZP7ZR+U3vKwPq7as2syhCKljuslT+jRJCiHlvCodpvNh9rFkC4Cy2xnqoMN8tDKA8hMqJTkBEm2q84yznmWw5yCaq5GMo/y6pmb/5IX5EXFXN3BPCK7We+HvXRba4EM8XNemh7xBtENecxuM9qtcbSZw9D/6lUDwiXJbGCZQDtT4QjVaEt0piGTxBJKZsI6xgt0O0dC2DTGZ05RwK7siPzuKIhuDwDtLx9cY/fA4gSsicqeQL/gN2qzTLzB1R2N1oquGYYeW5ImrPNyEv8Jw33UBh/gmB6TO7TFFfT9Zqzko9ux/I3pS656XHNhCRSBPy8V0pxiH6+MNHOOsyd9DBpazAKzbBZ19IhFRYIx70t6jhL1X4qTqUSHtmm1sVQCFizxjvaMTR8G0hftQDwZpOeQKxXesfSiSz4gzfxKHz/TDnxERgI3ZA7m3Q4Qovn6gKA2THdg76svNI0qTut4Lif1O+qA80w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(23010399003)(1800799024)(376014)(82310400026)(36860700016)(18002099003)(22082099003)(11063799006)(56012099006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vkp7EjibdvzSKX1GoipMrxPQpv9KIy/KOnmstSiuSaP4lamBp8KnJv4aGiNcMe0rNMxsXXExsJfN7GzmMgmKieNYdX95AyVcVrU57VGwD1Gzedd4Agsnzz2DgK3vx1DJvUTZo3VI/NDvtA7TkDZ2m6TG3+8i6npmfh2pthLudWulVjdcaKTWdmKPN5fp4ndi0LZF9n1rrnTGk+8Hf4pjmtkcSn1cDbFBfebmjei6aBtfpqYp2jrzkMgBJ0f3N36QOtFGnrjAo3qRApNR2jYDj6Rg+XJSVFQ1VJVNcEd1L2ykOuh80vCLUkh3H85+G5x0aCmuuWqMjoXZhwPi3gp5pFipEeDzzwLtwV0BdW5C2eMZhCKnk7UWzbT74ziqDOvcOAO302CHbNMGhJ13x8krSS4wrafQJbozn5jTV0Q1pZPxa/9ABG+Nba/GqxIGxqlG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2026 19:28:35.7308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ed37cc2-b38f-4cc6-84ec-08dedeb96fb6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B075.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9005 Content-Type: text/plain; charset="utf-8" 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: Tanmay Shah --- Changes in v5: - fix documentation about alignment of the buffer size - change version field from u16 to u8 - remove buffer alignment check - Separate buffer alignment vs MTU of a single buffer - Use buffer alignment only to get next buffer address at alignment boundary Changes in v4: - Introduce new patch to modify rpmsg.rst documentation - check version is always 1. - check size field is same as size of struct virtio_rpmsg_config - introduce alignment field - check alignment field is power of 2 - check tx and rx buf size is aligned with alignment passed in the structure Changes in v3: - change version field from u16 to u8 - introduce size field in the rpmsg_virtio_config structure - check version field is set to any non-zero value. - check size field is not 0. - Remove field for private config, as not needed for now. - add documentation of rpmsg_virtio_config structure drivers/rpmsg/virtio_rpmsg_bus.c | 130 ++++++++++++++++++++++++----- include/linux/rpmsg/virtio_rpmsg.h | 48 +++++++++++ 2 files changed, 159 insertions(+), 19 deletions(-) create mode 100644 include/linux/rpmsg/virtio_rpmsg.h diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_= bus.c index c84b6cec9caf..5e5473f4adeb 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -15,11 +15,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -39,7 +41,10 @@ * @tx_bufs: kernel address of tx buffers * @num_rx_buf: total number of rx buffers * @num_tx_buf: total number of tx buffers - * @buf_size: size of one rx or tx buffer + * @rx_buf_size: size of one rx buffer + * @tx_buf_size: size of one tx buffer + * @rx_buf_size_aligned: aligned size of one rx buffer + * @tx_buf_size_aligned: aligned size of one tx buffer * @last_tx_buf: index of last tx buffer used * @bufs_dma: dma base addr of the buffers * @tx_lock: protects svq and tx_bufs, to allow concurrent senders. @@ -59,7 +64,10 @@ struct virtproc_info { void *rx_bufs, *tx_bufs; unsigned int num_rx_buf; unsigned int num_tx_buf; - unsigned int buf_size; + unsigned int rx_buf_size; + unsigned int tx_buf_size; + unsigned int rx_buf_size_aligned; + unsigned int tx_buf_size_aligned; int last_tx_buf; dma_addr_t bufs_dma; struct mutex tx_lock; @@ -68,9 +76,6 @@ struct virtproc_info { wait_queue_head_t sendq; }; =20 -/* 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 @@ -128,7 +133,7 @@ struct virtio_rpmsg_channel { * processor. */ #define MAX_RPMSG_NUM_BUFS (256) -#define MAX_RPMSG_BUF_SIZE (512) +#define DEFAULT_RPMSG_BUF_SIZE (512) =20 /* * Local addresses are dynamically allocated on-demand. @@ -443,7 +448,7 @@ static void *get_a_tx_buf(struct virtproc_info *vrp) =20 /* either pick the next unused tx buffer */ if (vrp->last_tx_buf < vrp->num_tx_buf) - ret =3D vrp->tx_bufs + vrp->buf_size * vrp->last_tx_buf++; + ret =3D vrp->tx_bufs + vrp->tx_buf_size_aligned * vrp->last_tx_buf++; /* or recycle a used one */ else ret =3D virtqueue_get_buf(vrp->svq, &len); @@ -513,7 +518,7 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_devic= e *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->tx_buf_size - sizeof(struct rpmsg_hdr)) { dev_err(dev, "message is too big (%d)\n", len); return -EMSGSIZE; } @@ -646,7 +651,7 @@ static ssize_t virtio_rpmsg_get_mtu(struct rpmsg_endpoi= nt *ept) struct rpmsg_device *rpdev =3D ept->rpdev; struct virtio_rpmsg_channel *vch =3D to_virtio_rpmsg_channel(rpdev); =20 - return vch->vrp->buf_size - sizeof(struct rpmsg_hdr); + return vch->vrp->tx_buf_size - sizeof(struct rpmsg_hdr); } =20 static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev, @@ -672,7 +677,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->rx_buf_size || msg_len > (len - sizeof(struct rpmsg_hdr))) { dev_warn(dev, "inbound msg too big: (%d, %d)\n", len, msg_len); return -EINVAL; @@ -705,7 +710,7 @@ static int rpmsg_recv_single(struct virtproc_info *vrp,= struct device *dev, dev_warn_ratelimited(dev, "msg received with no recipient\n"); =20 /* publish the real size of the buffer */ - rpmsg_sg_init(&sg, msg, vrp->buf_size); + rpmsg_sg_init(&sg, msg, vrp->rx_buf_size); =20 /* add the buffer back to the remote processor's virtqueue */ err =3D virtqueue_add_inbuf(vrp->rvq, &sg, 1, msg, GFP_KERNEL); @@ -819,10 +824,13 @@ static int rpmsg_probe(struct virtio_device *vdev) struct virtproc_info *vrp; struct virtio_rpmsg_channel *vch =3D NULL; struct rpmsg_device *rpdev_ns, *rpdev_ctrl; + u16 rpmsg_buf_align =3D 0; void *bufs_va; int err =3D 0, i; size_t total_buf_space; bool notify; + u8 version; + u16 size; =20 vrp =3D kzalloc_obj(*vrp); if (!vrp) @@ -854,9 +862,87 @@ static int rpmsg_probe(struct virtio_device *vdev) else vrp->num_tx_buf =3D MAX_RPMSG_NUM_BUFS; =20 - vrp->buf_size =3D MAX_RPMSG_BUF_SIZE; + /* + * If VIRTIO_RPMSG_F_BUFSZ feature is supported, then configure buf + * size from virtio device config space from the resource table. + * If the feature is not supported, then assign default buf size. + */ + if (virtio_has_feature(vdev, VIRTIO_RPMSG_F_BUFSZ)) { + virtio_cread(vdev, struct virtio_rpmsg_config, + version, &version); + + /* for now we support only v1 */ + if (version !=3D RPMSG_VDEV_CONFIG_V1) { + dev_err(&vdev->dev, + "unsupported vdev config version %u\n", version); + err =3D -EINVAL; + goto vqs_del; + } + + /* size of the config space must match */ + virtio_cread(vdev, struct virtio_rpmsg_config, + size, &size); + if (size !=3D sizeof(struct virtio_rpmsg_config)) { + dev_err(&vdev->dev, "invalid size of vdev config %u\n", + size); + err =3D -EINVAL; + goto vqs_del; + } =20 - total_buf_space =3D (vrp->num_rx_buf + vrp->num_tx_buf) * vrp->buf_size; + /* + * Optional alignment applied to each buffer size and to the TX + * buffer base address (e.g. to align buffers on a cache line). + * It must be a power of two; zero means no extra alignment. + */ + virtio_cread(vdev, struct virtio_rpmsg_config, + rpmsg_buf_align, &rpmsg_buf_align); + if (rpmsg_buf_align && !is_power_of_2(rpmsg_buf_align)) { + dev_err(&vdev->dev, + "bad vdev config: rpmsg_buf_align %u is not a power of 2\n", + rpmsg_buf_align); + err =3D -EINVAL; + goto vqs_del; + } + + /* note: tx and rx are defined from remote view */ + virtio_cread(vdev, struct virtio_rpmsg_config, + txbuf_size, &vrp->rx_buf_size); + virtio_cread(vdev, struct virtio_rpmsg_config, + rxbuf_size, &vrp->tx_buf_size); + + /* The buffers must hold at least the rpmsg header */ + if (vrp->rx_buf_size < sizeof(struct rpmsg_hdr) || + vrp->tx_buf_size < sizeof(struct rpmsg_hdr)) { + dev_err(&vdev->dev, + "bad vdev config: rx buf sz =3D %u, tx buf sz =3D %u\n", + vrp->rx_buf_size, vrp->tx_buf_size); + err =3D -EINVAL; + goto vqs_del; + } + + if (rpmsg_buf_align) { + vrp->rx_buf_size_aligned =3D ALIGN(vrp->rx_buf_size, + rpmsg_buf_align); + vrp->tx_buf_size_aligned =3D ALIGN(vrp->tx_buf_size, + rpmsg_buf_align); + } else { + vrp->rx_buf_size_aligned =3D vrp->rx_buf_size; + vrp->tx_buf_size_aligned =3D vrp->tx_buf_size; + } + + dev_dbg(&vdev->dev, + "vdev config: ver=3D%u, align=3D0x%x, rx sz =3D 0x%x, tx sz =3D 0x%x\n", + version, rpmsg_buf_align, vrp->rx_buf_size, + vrp->tx_buf_size); + } else { + vrp->rx_buf_size =3D DEFAULT_RPMSG_BUF_SIZE; + vrp->tx_buf_size =3D DEFAULT_RPMSG_BUF_SIZE; + vrp->rx_buf_size_aligned =3D vrp->rx_buf_size; + vrp->tx_buf_size_aligned =3D vrp->tx_buf_size; + } + + total_buf_space =3D (vrp->num_rx_buf * vrp->rx_buf_size_aligned) + + (vrp->num_tx_buf * vrp->tx_buf_size_aligned); =20 /* allocate coherent memory for the buffers */ bufs_va =3D dma_alloc_coherent(vdev->dev.parent, @@ -873,15 +959,20 @@ static int rpmsg_probe(struct virtio_device *vdev) /* first part of the buffers is dedicated for RX */ vrp->rx_bufs =3D bufs_va; =20 - /* and second part is dedicated for TX */ - vrp->tx_bufs =3D bufs_va + vrp->num_rx_buf * vrp->buf_size; + /* + * Here buf_va is aligned to a page. Also rx buf size is aligned with + * cache line alignment provided by the firmware, so tx buf's start + * address is guranteed to be aligned with the alignment provided by + * the firmware. + */ + vrp->tx_bufs =3D bufs_va + (vrp->num_rx_buf * vrp->rx_buf_size_aligned); =20 /* set up the receive buffers */ for (i =3D 0; i < vrp->num_rx_buf; i++) { struct scatterlist sg; - void *cpu_addr =3D vrp->rx_bufs + i * vrp->buf_size; + void *cpu_addr =3D vrp->rx_bufs + i * vrp->rx_buf_size_aligned; =20 - rpmsg_sg_init(&sg, cpu_addr, vrp->buf_size); + rpmsg_sg_init(&sg, cpu_addr, vrp->rx_buf_size); =20 err =3D virtqueue_add_inbuf(vrp->rvq, &sg, 1, cpu_addr, GFP_KERNEL); @@ -964,8 +1055,8 @@ static int rpmsg_remove_device(struct device *dev, voi= d *data) static void rpmsg_remove(struct virtio_device *vdev) { struct virtproc_info *vrp =3D vdev->priv; - unsigned int num_bufs =3D vrp->num_rx_buf + vrp->num_tx_buf; - size_t total_buf_space =3D num_bufs * vrp->buf_size; + size_t total_buf_space =3D (vrp->num_rx_buf * vrp->rx_buf_size_aligned) + + (vrp->num_tx_buf * vrp->tx_buf_size_aligned); int ret; =20 virtio_reset_device(vdev); @@ -991,6 +1082,7 @@ static struct virtio_device_id id_table[] =3D { =20 static unsigned int features[] =3D { VIRTIO_RPMSG_F_NS, + VIRTIO_RPMSG_F_BUFSZ, }; =20 static struct virtio_driver virtio_ipc_driver =3D { diff --git a/include/linux/rpmsg/virtio_rpmsg.h b/include/linux/rpmsg/virti= o_rpmsg.h new file mode 100644 index 000000000000..735a947d5582 --- /dev/null +++ b/include/linux/rpmsg/virtio_rpmsg.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) Pinecone Inc. 2019 + * Copyright (C) Xiang Xiao + * Copyright (C) Advanced Micro Devices, Inc. 2026 + */ + +#ifndef _LINUX_VIRTIO_RPMSG_H +#define _LINUX_VIRTIO_RPMSG_H + +#include +#include + +/* The feature bitmap for virtio rpmsg */ +#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ +#define VIRTIO_RPMSG_F_BUFSZ 1 /* RP get buffer size from config space */ + +/* Version of struct virtio_rpmsg_config understood by this driver */ +#define RPMSG_VDEV_CONFIG_V1 1 + +/** + * struct virtio_rpmsg_config - config space for rpmsg virtio device + * + * @version: version of this structure, currently %RPMSG_VDEV_CONFIG_V1. + * @size: size of this structure in bytes. + * @rpmsg_buf_align: alignment in bytes for each buffer. Must be a power of + * two. If 0 then no alignment will be done. This alignment + * will not decide actual size of the buffer but will be + * used to decided the start address of the buffer. The + * actual size of the buffer can be different than the + * aligned size of the buffer. + * @txbuf_size: Tx buf size from remote's view. For Linux this is rx buf s= ize. + * @rxbuf_size: Rx buf size from remote's view. For Linux this is tx buf s= ize. + * + * This is the configuration structure shared by the device and the driver, + * read when %VIRTIO_RPMSG_F_BUFSZ is negotiated. The fields are laid out = so + * the structure is naturally 32-bit aligned. + */ +struct virtio_rpmsg_config { + u8 version; + __virtio16 size; + __virtio16 rpmsg_buf_align; + /* The tx/rx individual buffer size (if VIRTIO_RPMSG_F_BUFSZ) */ + __virtio32 txbuf_size; + __virtio32 rxbuf_size; +} __packed; + +#endif /* _LINUX_VIRTIO_RPMSG_H */ --=20 2.34.1 From nobody Mon Jul 27 02:16:09 2026 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012016.outbound.protection.outlook.com [40.107.200.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A537037EFE6; Fri, 10 Jul 2026 19:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.16 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711723; cv=fail; b=DO4FDFKm4SVEYM27WU15UCKmVeongXF8jriE3coVRUzjbloHd8VlRUA2x1bUBOIkYfBIJTp+eMasWKSavuTpIkXAZfbZdxjH+gUJClQh13X30rTTMiAKLpNIn6T8RFKj6eSWixEDujFQn+gsryWN6BjSWKM0EScgAG/40JvHxXA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711723; c=relaxed/simple; bh=L/J2ItVW0lcI0mvOPVdcgSTovFHyGge4BakbRB/yWu4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=baflV8QOYC30f15fePhSgSrCBpk7hf4VbbDmSpn6LwGjsp3ok8aYTF4iW8W9Iz6bobEgFCxR+JgftBDp8hxUkSqI9G+xSflrvLJQzCriLz3GM5nOA1gs6vZxuitH9U/vv5KYia7bSjQdgz7rjAyMF8E1SRKN4tgGuHT4+0L9Jms= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Ar4TYdvJ; arc=fail smtp.client-ip=40.107.200.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Ar4TYdvJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aU4yABDLgr7ES3y86FBgxML4jkCzlx/WXoTPbAYXrG30KNse0LCp00dm36yta2ikXybfBaq+wn/DAz90bcKlGUxR1aUmJ2b1ZtZmYYcACBmXLek/25LB8Qyq4RqVjOxng1t8UfbvxK9s9LFJ2Sap9wFeibyRsoFgJfKntjZ2YOku1cHE2//o2uSotoSIoyJFMm5IJfZHB0w4Lm8c0H4wX4ADBK7w84cCEs51IB/xW8w0VXe9FGxPTLM5awA9NZMhFkEwQALaSeeq/z+bU+oogWkT+++oeJDBRj0OKr0MSzK3v4PfQTrGk44m+BjJ1tOUMe1V8FJNZP1Ye56RAK3e6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qRNptIgXeyRprJCu0906UDG6LykXlRRm7nmOTQD3/Zk=; b=vQBPxX0y0S53KG0Dbv+W+M6GtwxpL8YHAfXwOLAY/6Ug6GQ8xuPDIxl1rYEcAiSk52QeSDqBztEakNnDaEk4Ox/aPHVgTj+KkSli21NfVIUnJZ+ODKW4vICeUzyoG5TPfs6bzrQKoG2QCvhWJy3CGV1X5tACqyNb/Z1HmXyxePRC4MzHU+R4DHVkHKnsK6REqi4QV4ZqY/aJAnXqXAhz/1GdB3AeEm3skJa5pY68H1ppErpy2IZLi2cDdi1hbToOMFB+oDLfGIdenDt8V9dC5sgdnlc8Q5qmVaRuixnuNlgJgITxbJpAvvBvbqH/+4V3fkMx5rVNnJbvL96GJKSHgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qRNptIgXeyRprJCu0906UDG6LykXlRRm7nmOTQD3/Zk=; b=Ar4TYdvJtOffVsPYSexU7EXLxRbW/O36PheM3KuSNIC2ZAmej96XxcvLsvvj9+xuuVnsKrs/e0CvxRIjqnaN2hrXabAaFDd2yRA1MmP22NxEtI3FFuNyk723gZXhenvblPzeGIVQ/XiPdHhAU4gW7ojAi6pdUzHS+NCTut/19yY= Received: from DS7PR03CA0293.namprd03.prod.outlook.com (2603:10b6:5:3ad::28) by DS7PR12MB8084.namprd12.prod.outlook.com (2603:10b6:8:ef::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.17; Fri, 10 Jul 2026 19:28:36 +0000 Received: from DS2PEPF000061C7.namprd02.prod.outlook.com (2603:10b6:5:3ad:cafe::a2) by DS7PR03CA0293.outlook.office365.com (2603:10b6:5:3ad::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.13 via Frontend Transport; Fri, 10 Jul 2026 19:28:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS2PEPF000061C7.mail.protection.outlook.com (10.167.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.6 via Frontend Transport; Fri, 10 Jul 2026 19:28:36 +0000 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:35 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Fri, 10 Jul 2026 14:28:35 -0500 From: Tanmay Shah To: , , , CC: , , , Tanmay Shah Subject: [PATCH v5 4/5] docs: rpmsg: add virtio config space details Date: Fri, 10 Jul 2026 12:28:30 -0700 Message-ID: <20260710192831.3440427-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260710192831.3440427-1-tanmay.shah@amd.com> References: <20260710192831.3440427-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF000061C7:EE_|DS7PR12MB8084:EE_ X-MS-Office365-Filtering-Correlation-Id: 7deaa7db-f008-4b22-4526-08dedeb97056 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|23010399003|36860700016|22082099003|18002099003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: 7/MiEJM8kk74nH6Wu1Xn/vobEj/XrbPV6HvCDBFuiN1dPWOMFp/xz2zzYhv30qZ8qA+oI3jqeQ2Pfq84ooSLku6OJmiMGm0BkhhAhD0JG44ynvf63U2mQ/kiF9/YNj/cbvt+iSzVFzCIuDcBgfis/E9vUx2k6H4Ge3TaO/3I94fBXO8Bp49hhQRm4+OZ/UuwM3in029XsztN9TvpNDhMO17d/S45zlJU8p/DZI3suLCBbERr+eTHnfHCbU+n/J2W/NrEfm8OEhS3dZqF5ORs+Uy+t6TMNLniq0m2WUj+pXW/PkWLxGRJH/1iiHIsxmxlmqFrCFebTDp0TENcsow1wE9M+dzKOzs6ZREARECGsghQ4ou453nlagpdRjj07Dbu6O+X1w+vj2nNzKPYe0xsoz3PQLlMlmk/kXIWpzWHsJvTgLGQW3S8CEk5ejTu7Ue8t3xyR9R63BO9jUryhu88xYzbr6tUy6MErrtGDgdGe06UBqRaTPZ8hO7WT5kg1fCK+igb42yWslkBugTLVRjJzzVYl7Dxq+qpToqlWxuIe1USoA+sLK3yiexA53qLGFsRYeVdIIbrBaBYBcRD88Fl7t8XXkGMHk1Q/UlaXGSEVICGAGjrTZ1EdFVxxpxVGymxAGTwDTA5JCatOfzICJedVrX1dhOe/wz6BA5AEN2ShUusWMRmmkc+mCVx6tSWuUVFwvHznMeA9dBgh05PaiwgWA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(23010399003)(36860700016)(22082099003)(18002099003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ScLPNiaB96WhrADnDctZUJHUcNaufDETcWO/ALL1BAJmI46qhmBC9/Dy+VUX4Srx2ASvrCghF7PRwlKgUVzCQHvNde3O4l4d8sn2E+El3GFYkuE3GKKjqctakuNC2Tlqglq4x3agbFSRPHSkZzH88ZrCE072jkBQFc9Dx32WQcpcfu/YyJrx9MkBhbfklJ2C/plUM+M7i7PJV/R+y6oW6xhD3lkZSKTUwOmqJ4khTtKWJ97NMUH8S9SC+7v/7kCW/KrucZOQZIwrCX0ijHRtB9OVWnRiYPNZg+i9XWFFYOfHv9UiHQ6flLqaZLk1PQYQdIbqElvqBosIWdtOa4THSDmygzjCejRQrBhVM+8RriRib36OyCTLwNCAbpAvVd7JLETLMwRT4lZci63aiRMRvfKH/P1Bfv/gSs4F7UD3+s153MaGCcnl442HAg32ihF1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2026 19:28:36.7709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7deaa7db-f008-4b22-4526-08dedeb97056 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF000061C7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8084 Content-Type: text/plain; charset="utf-8" The virtio config space can provide single rpmsg buffer size in each direction. Document details of the configurable buffer size via virtio config space. Signed-off-by: Tanmay Shah --- Changes in v5: - fix documentation of buffer alignment Documentation/staging/rpmsg.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/staging/rpmsg.rst b/Documentation/staging/rpmsg.= rst index 42bac1149d9d..abf9d20fafcf 100644 --- a/Documentation/staging/rpmsg.rst +++ b/Documentation/staging/rpmsg.rst @@ -300,3 +300,23 @@ by the bus, and can then start sending messages to the= remote service. =20 The plan is also to add static creation of rpmsg channels via the virtio config space, but it's not implemented yet. + +Configurable buffer sizes +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +By default each rpmsg buffer is 512 bytes, and the same size is used for b= oth +the receive and transmit directions. Remote processors that need a differe= nt +size (for example a larger MTU, or different RX and TX sizes) can advertis= e it +through the virtio device config space by setting the VIRTIO_RPMSG_F_BUFSZ +feature bit. + +When this feature is negotiated, the driver reads struct virtio_rpmsg_conf= ig +from the config space. This structure provides the size of a single buffer= for +each direction (TX and RX). It also provides alignment field to align sing= le +buffer which will help decide start address of the next buffer. The total +buffer space will be divided between total aligned buffers of tx and rx. +However, the MTU size of a single buffer is not equal to the aligned buffer +size. The MTU size of a single buffer and aligned buffer size can be diffe= rent. + +If the feature is not negotiated, the default 512-byte buffers are used for +both directions. --=20 2.34.1 From nobody Mon Jul 27 02:16:09 2026 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013042.outbound.protection.outlook.com [40.93.196.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 011D4380FC0; Fri, 10 Jul 2026 19:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711724; cv=fail; b=IcxtBgLzSbn7hauf3O7m2t8lceiXFEABnwvArMMkQjzqSFZgRZEMvyxmNjCmEdZ5JhfH+JrOOB7/O4CjIsg8Y7eRIj6RQl7NkzMmiF6JYCKOsq4JmCfS3t5Pb6ahdUXqox1KZC0vTiw66lAy/h443mCBIAlYLmUMwxmS7WvxxVc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783711724; c=relaxed/simple; bh=uLnx/0j5TTq/y3THFD8oaPgZJHYqx8MSalhKjEkcG2w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GhAC4+btDLlNdK0z10KxyjiLkzZva4vl2BdPxw1sO+KIF/EkNbMJlXD/wHPr0gOsxt0QMPAQ2oC7j490lFBx4yHSvWELQn348Uu3C5NR/mpabZbCc1nx+zaV21OpdMrcO+MUg8IfxaMIzllttd+92jLsoOWipaPrGsel2t0XDOA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=yOD4aIXt; arc=fail smtp.client-ip=40.93.196.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="yOD4aIXt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bQ9ZWvcQou4RdHz79cXvUrSLn6OKRVASF7odo3wxu1grcwBupY5aKJUgOvr8puYsUL5P7JtdLRgISKGW374YintJa+gDgj0mJ0xwZZkhf1BXKZsNACZGBNtDHsVj4O48xYBrg4GLAB5L1oIFeqm1S805bfKfEZQgJJj5TEfgcqNIAu8/JNjdc3kO0C1YjkDxK1D/k6OYTGN2+rVUTtdwbtIgZX2HsXKoGPOrJ/BhUrH4pfcg97w265hx8Cd522CKaVF60Fg2wKAAR0dG3ejCOWAgNgR4zpE5HC46nRlHTw/ov4WFhNWRSOICtNigkQvRqrVilhvzEEVQzR6ribYnkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EI9wv2ahZNjFCjouiMPXlTZh+LLMPE+llezfllDpAMw=; b=AZt1978z21OtxGYwKpjdM6PZowfnWaGBQSTJrd5w5ebmlX5roJI5hRzryARn9aw7u/Usc/KwsydbcPDWOoAv9nj0YamIbPXDKgsb5JQAkwG1C79UB+pYaEuzw1Ao8koAe1ONvI5jB/NePzsgaJIrNo8yg3NMWmgeFI64Lzp4e0n9aEYZJdHjz4vDRWcmt6NLGuuqVkpENRUTqNki/fsNfKwiS+D+z+kHdt/IVt+dwUyPnUXYISL+Kax9D83ZabYykbEgHENEz7SozfenN+C0jMY0ambUMp/9xvjoF1gwIIayuFN2ew076wS58V8swWeFn2y5u0bR+hXvdCenQfEZGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EI9wv2ahZNjFCjouiMPXlTZh+LLMPE+llezfllDpAMw=; b=yOD4aIXtlUASvyz3C9j8Dp3cZlvXLEYut15VLfx8h4CNy9/LI3yi3M/3CHUmI0Sx1M07GNu/jBVgTRVIA7duWx240T2l5AvH84rZJsVwgiQR9Ovc/ekj4RvwmExINj63Nuu9e9LuIdzYEi9iObpTvh3GtmZbn5Ip6dxBGrqEMBk= Received: from DS7PR03CA0279.namprd03.prod.outlook.com (2603:10b6:5:3ad::14) by DM6PR12MB4267.namprd12.prod.outlook.com (2603:10b6:5:21e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.16; Fri, 10 Jul 2026 19:28:37 +0000 Received: from DS2PEPF000061C7.namprd02.prod.outlook.com (2603:10b6:5:3ad:cafe::5e) by DS7PR03CA0279.outlook.office365.com (2603:10b6:5:3ad::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.14 via Frontend Transport; Fri, 10 Jul 2026 19:28:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS2PEPF000061C7.mail.protection.outlook.com (10.167.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.6 via Frontend Transport; Fri, 10 Jul 2026 19:28:37 +0000 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 10 Jul 2026 14:28:36 -0500 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Fri, 10 Jul 2026 14:28:36 -0500 From: Tanmay Shah To: , , , CC: , , , Tanmay Shah Subject: [PATCH v5 5/5] samples: rpmsg: add MTU size info Date: Fri, 10 Jul 2026 12:28:31 -0700 Message-ID: <20260710192831.3440427-6-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260710192831.3440427-1-tanmay.shah@amd.com> References: <20260710192831.3440427-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF000061C7:EE_|DM6PR12MB4267:EE_ X-MS-Office365-Filtering-Correlation-Id: eba93c62-5d48-4ee0-66fd-08dedeb9708f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|36860700016|1800799024|82310400026|376014|11063799006|56012099006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: gcuzpEGY1UtHsUZ3THIO9jhCx8qZksPdQGxDauGt6M8Nv8NOiMn9Cm4RnWTNcL9YqNjjP7GGczXJIS9kF+dufo10q2CD0oZqZByjxsyJgk5A/SB3AaUXujHv1ZcUzkDpeE3OxG4TOFptblozkDjpKGZesUMrlpPQO5XrZM8V6yOfoZwwgIha4Pop1K35tUOIuPUaLbX3Ow75CwnCDNivEKe/8GXcgI0wLnhV3+VTgPduhXbYiv/PJEvHNkOhdv83XQwPoRTJdjDJHDtnnceiK80xHXuLfERPlaSSPNVQIhFrORMeJmUlL1GtjmNWbH54ICN5kgEBmxAxFbQmij9djVFAppkKkNvJbRDpG+1GfGXltpZOkxfOUUgpQSU1mzorkwgp8vpHURbl9/RKmzn8cARKQ/Mp2Xo7BPMMpO1XVQonHskWasJBc3HK9jLOTPHQNEiZs0paNXsFb8eZeCGxG3bb0PFnKXPCjw+zxhBVBYB+bdHghKieLS16Ix+Hni5ShFrVXtCETTYs0tBmsn4m+RFAkBf2GBwUhfdlpso1ymO7fzyfAuEuQ8SD33GKfRKp8g5CGy/yP3n+l+g33B3DhU2Py14ahCRxIEdwS/xGKQRS+FUouwqhmg7NSedLqVWsL71mL8qigzW9nN4cZCI6b5n+Hvp0LPqxWBAQIccbBjmpEvKkVaCAFY/SWRKH/K7l7uMJNpre6ZNl5HwRG8JkRA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(23010399003)(36860700016)(1800799024)(82310400026)(376014)(11063799006)(56012099006)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A0hfv2E9PnPncNEtb5U0AkFAHJfwCPwRgz86QfBF3IR12YvTpmB+NIQ2XhfFX5YqTycvgMLPaYYusIEKxqgvgnVoP5wBDjzc+LQZW6UlVr6ZpTANL2Z9jy5cF3t2KzwHxQ0uAxEipyIrki/yeJViYZcAGkkmaNA3a9R3pQSZqjXn+FI9dKM4DfcWtyLZzRw31O88KnleAuxQTA9MCBTiah5jNeP/URYVlTKtwaaW+NZiaOvnuOzIwfGsJC5Cb5ygxlN7OTMjFIrFkB/bkQZodeH+zs7R0OAS24SDDhAmdDMHLIwS5jXsnsEgFRViErcjdbyKbo0fDU4agq3FkO4ETwh7JOc73sxgucxfsMK40zKisOU2t0WjECuhl24qRylRXG7Q24xK/NrfdGeVdPixvGePKlDOS77TC2sxen6vckfvyMHEuUSjnP0HQW6qe4cM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2026 19:28:37.1140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eba93c62-5d48-4ee0-66fd-08dedeb9708f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF000061C7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4267 Content-Type: text/plain; charset="utf-8" RPMsg MTU size can be variable now and no longer hardcoded to 512 bytes. Add log to the sample driver that prints current MTU size of the rpmsg buffer. Signed-off-by: Tanmay Shah --- Changes in v4: - check msg size is < MTU size Changes in v3: - Check for error when retrieving MTU size - %s/mtu/MTU/ samples/rpmsg/rpmsg_client_sample.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/samples/rpmsg/rpmsg_client_sample.c b/samples/rpmsg/rpmsg_clie= nt_sample.c index ae5081662283..4c43436aadb6 100644 --- a/samples/rpmsg/rpmsg_client_sample.c +++ b/samples/rpmsg/rpmsg_client_sample.c @@ -52,6 +52,7 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev) { int ret; struct instance_data *idata; + ssize_t mtu, msg_len; =20 dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n", rpdev->src, rpdev->dst); @@ -62,8 +63,25 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev) =20 dev_set_drvdata(&rpdev->dev, idata); =20 + mtu =3D rpmsg_get_mtu(rpdev->ept); + if (mtu < 0) { + dev_warn(&rpdev->dev, "invalid rpmsg MTU size =3D %ld\n", mtu); + return mtu; + } + + dev_info(&rpdev->dev, "rpmsg MTU size =3D %ld\n", mtu); + + msg_len =3D strlen(MSG); + /* make sure our message fits in a single rpmsg buffer */ + if (msg_len > mtu) { + dev_err(&rpdev->dev, + "message size %zu exceeds rpmsg MTU size %ld\n", + strlen(MSG), mtu); + return -EMSGSIZE; + } + /* send a message to our remote processor */ - ret =3D rpmsg_send(rpdev->ept, MSG, strlen(MSG)); + ret =3D rpmsg_send(rpdev->ept, MSG, msg_len); if (ret) { dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); return ret; --=20 2.34.1