From nobody Tue Jun 16 19:34:15 2026 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazon11011008.outbound.protection.outlook.com [52.101.62.8]) (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 CA5EA3AD53F; Mon, 15 Jun 2026 20:20:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.62.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554825; cv=fail; b=aLJ7EM4L2TsMdwMRXUOn9sJTXb8f0lDlRjFBrM0MGaH44Y5lLUSgUyp8DNZ8oNJTna7wyTr0DV0dkhFManKrNqNTTTj1Edmr/nUs9gPoxAfOEhKco6riIzFmwdl5HXp1c/6ofpDTjT+Ei0iLTt7ZN7h5w+4iYEiiA7noO89n954= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554825; c=relaxed/simple; bh=VjDnRfiI2UYHvAXt8BWnFUE5/gkyINHqdGsxy+8aANw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HStldSC19hnQEc91hF56lyenTRXwEE5bNI9Q6HlIiiy18+tJPJeEPq5loZ1h15YSwyiIxvxm20JqxwkoFaY0+73Hw7QCmV+FXDsSMdy3tGKbyG/rU1cvDTw8a7syQHxWjTpAAiHfbshICVkozTXDleXhdxbkCrcP3mVJTPMt0lY= 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=XLf5jQiS; arc=fail smtp.client-ip=52.101.62.8 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="XLf5jQiS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ik4W+6Jb1I9OjAGcR5ilQwA3eM/tPAYWpq7t7IlnQZAi035fszEJyKV+MnWGpTtuDQ4LZl8X33BlHu/k8V3TIddSSwVQqZMqSFw4z8F/Ph3ao0oAANIjFxvms53VIJlExDj+5ksEPFOm17GsOF9/ZpONniI9dmxKLJxN3vBKsEetrja8BgJMvONlWXYNArvn1wW4W1yCvkjq2QesExlUf7ptk0jTGdx1LdyQV4Lbz+NbG+IAc4rAjhNFGDxYjpH1zc6kkcWUq1Hjfpt3QxiDwVWCsnMU87YRkqmVXO/2H5xJBwC4hPY25Yb5g7WSVCQ+V3MpaX9ssVPDMeAod41zyw== 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=/7qzu014ra39MD5fSByTQzBE9+aQ8RuCcIcrlABdHT4=; b=yIgg6FLvC/oDi2Zn+aAb130EwalDdtIdnU5VOs9o+GcCvHhGju3nc/k6DT6rEwgF0d1fVid/ta0UCT2dcNnDZMiZUDqZKSlb4xLJH9rW/67SwirzegLQ26i2dqAyK/90hB5mzPQZbwNPK8DvWvCsKMFavQ9sLikhmGZR+JVpoDwi/RENxqyWejxGcNI2PioiEMoWPvq8GmCbaEsquWHKwJ9nRoFmiEHMibZeWmePKBfzOERspAq/Hz8r/FOh97j5bcNnSwGE9HcjWbiT25TUHSntzZui8WpxcIrLENXMPLJKJSr0eES54d9OV7gzHTlLXfp/u/tbv6WQ2gwdlBoCDA== 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=/7qzu014ra39MD5fSByTQzBE9+aQ8RuCcIcrlABdHT4=; b=XLf5jQiSqpuoNmS4eoE++jk6+YHO9iS//RYyuuEzyy9+fU9d8xKyHnHjlOpo5ROlasZojZ5bnYp8EqkpoIxbkvzIsOohDdx1bJfx1Vnrmu66qaqoZHFmCFgyAOhNRypgg4ADDwMaGAKb1OMf1RuKg/dHe4elOArLQIJPAoMTUZA= Received: from DS1PR04CA0023.namprd04.prod.outlook.com (2603:10b6:8:243::17) by MN0PR12MB6125.namprd12.prod.outlook.com (2603:10b6:208:3c7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.18; Mon, 15 Jun 2026 20:20:19 +0000 Received: from DS2PEPF000061C6.namprd02.prod.outlook.com (2603:10b6:8:243:cafe::af) by DS1PR04CA0023.outlook.office365.com (2603:10b6:8:243::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.18 via Frontend Transport; Mon, 15 Jun 2026 20:20:18 +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 DS2PEPF000061C6.mail.protection.outlook.com (10.167.23.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.8 via Frontend Transport; Mon, 15 Jun 2026 20:20:18 +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; Mon, 15 Jun 2026 15:20:18 -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; Mon, 15 Jun 2026 15:20:18 -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; Mon, 15 Jun 2026 15:20:17 -0500 From: Tanmay Shah To: , , , , CC: , , , Tanmay Shah Subject: [PATCH v4 1/5] rpmsg: virtio_rpmsg_bus: rename rbufs and sbufs Date: Mon, 15 Jun 2026 13:20:03 -0700 Message-ID: <20260615202007.3484668-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260615202007.3484668-1-tanmay.shah@amd.com> References: <20260615202007.3484668-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: DS2PEPF000061C6:EE_|MN0PR12MB6125:EE_ X-MS-Office365-Filtering-Correlation-Id: 8643f35d-ace2-43a1-d719-08decb1b84e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|376014|82310400026|36860700016|1800799024|6133799003|56012099006|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: SgQcyehud/Tll/UkAZbyUVOVYRBk8evHb7gzRdocRQjNvrx9XOsnrf5IVPsF7iZdp57MNx5YcquNHLIleyVXGz5T1nWziIuZMpkmbtqLvNwFKr40sfZmM68x8b54rwLxfgIWxTiIbvkMyh5h0/38IlVtxueaDBzaIGTStSX7cHq6ma7ArUo+boAj4HXjak6RfPMuCOE0klECrM3/PLTxMjOjueVxC6+O/3mC6+y2UYD5cgV+bhemqihWdnRnVGw//vOlH2+oByC+7AAwhwu6OmyGlptthY3Rk0k6LVKN4SmLkg4kto6nzKLSb1Divae0Bn6onHmWmmiPukXK/GbSBJLIj0qEBz8K5QGEdTk1au872r2kwr3wt5x+c4aujAquWrlZ8DyJXWRZOGQ+8jUyFcts1muAQn7J5rtsaxjB9tlVwvXtpwXLQQFC+hmrusyk3tN3nXfHep7SXLF+ZOOaj+pDV6AU+nGuMabl7lnUyoPw/E/BPiLEgwIQlVgqHcpA8rHzqO/g2So0gEo+NlTFSc95L05YeJ74IFQaKmNW5IaWFMajVAkbAK4lcCWjJ/Zts6rYngHiDec5rQgXLbJitWzt7mZrTnZDIW+3JVXbh9R2+v4UEXzhZFhvQzxyt7XV+myYt87+BDjsVKR2u5TuIW7bCCDZVaKHIx23HpstdLJMw5oMJS6wjwhKrPEZpNzNSL3SlmDmpddjog5H4u5/cA8b7SjPSbQXxvxof8z2aCA= 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)(376014)(82310400026)(36860700016)(1800799024)(6133799003)(56012099006)(11063799006)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uplIBS4FMVYKL0R4rH8vixS/VxmIukhI8IQIuP5VVTUAtx3KfcRXe3+NEdVafNkuvJ+zImrfwnAycOgRS9CNJ2D39nSWlbBbQSisP5L4tjFG/crg6mP23fNEToBpTSOkCr+Ql+Oo4Wf0yY60BChYeHZyYXkMenECAWw/Xn0OOtLcb3GxNr1TRU38t0EHijFUrx/aJ39YHDq20oO/YBc6bXuPWEEVA1MfsF2mphYKGbZWq+14nkbxW2f1qQ4gAilkqODthb5zI6pjOuc14GVRq4XZ2TZBUlkJUOSPNe+JU7IhkmBVn2ZAo/diP41qlasiDT9b9pnsqhqgMtA07yHq1Z2IVtlHo29PJdA9c9FBmT1uekc4d/m/DKDjn95MkHcREwo1JkXZAp/alMwvvdQfmANv3wJ7+qG9Di1hTt03o1fi2Azr8BQG4MR9CR/AO1jQ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2026 20:20:18.6648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8643f35d-ace2-43a1-d719-08decb1b84e5 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: DS2PEPF000061C6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6125 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 5ae15111fb4f..773547479d15 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; @@ -444,8 +444,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); @@ -635,7 +635,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 @@ -873,15 +873,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 @@ -980,7 +980,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 Tue Jun 16 19:34:15 2026 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azon11012005.outbound.protection.outlook.com [40.107.209.5]) (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 19DE23B582F; Mon, 15 Jun 2026 20:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.209.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554827; cv=fail; b=Ljol+yBR5l/BSmFpSYlaNvwhCRJuxwGMo7F+OsFPzQznk375WWA5GyIH/cC7/fjwso5H2hSJqYH5h088Qb78mWPLTXwQ95LochQw4nS/jFA0tMcVY2oM6hcDQo9zLLonZbZs7w8MVpIYZO+HJq0Zz/tsUYyqYV5ne+Cdlhguzfw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554827; c=relaxed/simple; bh=AzuWtuFcKkeGk2SjUXJHCHngk9bXPItDsq0XJrdSmuw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rsLgVterOqQ5Q8C/q9/2Qf68T5FPtBKfdqC3H6Xgu398Q3DapVJwp7EeTTXMY9CAz7SQIDzQ4rJWYjlSaZNK9ms/lHLG9j/Az7ni/bxLrOhbQySQAOvV6BYV7OLRqyGePW0fn4w84UkYzY2Z9swZE7BHKtHj6G1wNlrCEhP2PTM= 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=naxF71yb; arc=fail smtp.client-ip=40.107.209.5 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="naxF71yb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hYgnqkyVFQtZW3yx0l6q4Yjpv/7ZRtCaxKjbr+FUUXg72uFcqwFzmHjAgoZof99+zf1I3mBqjVdtZZdHG/CyL7md1bn/REevfX8tMUSnZv2RIx0Th8UJDLE2bMvZBMPAf6gyM0OMpLyGDNDgXcUkhKYIu+4FkXg992iA1p4FHEyQ3D6LT7k+SRwjI4K3K20Mhac2QGqxy2PpmtB1ABrlUcpRiV5pOuTThUEUAm5R6vHH+sEJFkLrdxmZPHpnYDN3eIrSLJ4ty6Fs1AhApJGI7IsgX3CiW05LZXFZQq9Nn/jNeHv2vR64iP9UBGqQh07KVSgDuOlmaPwtjCk0j3yVpw== 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=TmGRg1LsyE7BCDRjrlDMRiXTh+DGlKxNSF30ZneF4FE=; b=brqCNmSpakZlSeqM7CO7viWYC61FnjuWqA8j6LBuyLJWq6k8+0Pwg5ue4gUKqol1guaNKCiEWBR9vt7pP9OfaDzozZdK6GsyotmHWqtb1lcV+Tcc0knMO1ODR/St9lJiVbThwekX8T/VRVup9wouyyzx3IHKBTle+8RrA9+aJWgQHWN9+/xUjs6pCKw5aQmdf2Z2T2DORT5RCi22/KNbat+6Px+jOhvnbHLnsIGGuHl9KdmPn7VSe+bY8WUmgmaJbIECVg9toZBvyX7RyQOSZxsalmjbulYN9v7EwkSI0wFDCdytIykpvI8S3zBjoFQKwHEaoG8TQmJzERVJSIDcHQ== 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=TmGRg1LsyE7BCDRjrlDMRiXTh+DGlKxNSF30ZneF4FE=; b=naxF71ybmZWGh1Px8vrNmAvS0Xciy25uoEvvU7CMW5JRZB+YyenGGMjfD20nn/Y1IsxDXFUUGQ5JQGQ/fXdA+LqKIneeqfxjY81Iq7J6+Ul5W27LjLroYxVx/R1J87jIwWwMB0O2wxt3QxaOL8aYM8ZaPU5fM8Q9NefDfYuw3KM= Received: from DS1PR04CA0017.namprd04.prod.outlook.com (2603:10b6:8:243::19) by BL4PR12MB9483.namprd12.prod.outlook.com (2603:10b6:208:590::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.18; Mon, 15 Jun 2026 20:20:19 +0000 Received: from DS2PEPF000061C6.namprd02.prod.outlook.com (2603:10b6:8:243:cafe::3) by DS1PR04CA0017.outlook.office365.com (2603:10b6:8:243::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.18 via Frontend Transport; Mon, 15 Jun 2026 20:20:19 +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 DS2PEPF000061C6.mail.protection.outlook.com (10.167.23.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.8 via Frontend Transport; Mon, 15 Jun 2026 20:20:19 +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; Mon, 15 Jun 2026 15:20:18 -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; Mon, 15 Jun 2026 15:20:18 -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; Mon, 15 Jun 2026 15:20:18 -0500 From: Tanmay Shah To: , , , , CC: , , , Tanmay Shah Subject: [PATCH v4 2/5] rpmsg: virtio_rpmsg_bus: allow different size of tx and rx bufs Date: Mon, 15 Jun 2026 13:20:04 -0700 Message-ID: <20260615202007.3484668-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260615202007.3484668-1-tanmay.shah@amd.com> References: <20260615202007.3484668-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: DS2PEPF000061C6:EE_|BL4PR12MB9483:EE_ X-MS-Office365-Filtering-Correlation-Id: 52f6dd8b-f410-4534-14bc-08decb1b8571 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|23010399003|1800799024|36860700016|376014|22082099003|18002099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: N551hTIu/HJQ3abrPuWqrY9ppRs9OgSBZxZow/I0MQdBpswSKAzRcfnmTYO5z5AdyhTh2ksHZUBsiVfywLupNrrPnFjbKJZkbkJQ8g1W5zmL9zyiIOt9pgxs8MXOKVjPpAl5DZ5PiHNO5IM2R00brZB8vkQqdBjA1y8bm2SGbZfmE08c4bOMAPwlFO5wzcrcGXW0iFWELjVqPQ0T7FCM1XFbxFSQAN09lwAwBQve69RqlpvYIuzhj0VfDGKq3ePXTZC7EuiYtQU2x4Dwv32LHdw3bXk9wSUvP8eQ+aDzstfbT7qDQ+ezFC7U6gaVb0ufWXVko4Ba+n+fXJA8tPFRRIasNNw+7AScSHJPoFcqZMaNGoTl31lPM0vcR5zAeWsAC9he6XEnaSp6HN1NqY+IMHjXoY8JehwuVFokC77f/oybBftygwJ/jYt+PMhVMV6Fd2OpJAXbyMG550us9ojfve1vDAAbxFJVzZvSB16gTZtSk14k7UuCpexrLcDAAkRLb98X0/PiO9QMGMQRJA5yS4Tejpa3ceVzr4/ZtM65aMtEoWKsVoF3MHgKVqpSuUBMFJG3r6byqVsnvSIpdYnq9DeRbQcKQjrktwuTaaMZ6cGcFQYUEJRmk8pgZgfomGykAZi3a1TZi649E25Kj4P12ImZLjoqzU8WJbCKFeowkUmO/4lD0e3H13A78eo8Z6txqCmayups3NHnfS9FSK3HDqffRETDvlq/Gj2XtjqnoQI= 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)(23010399003)(1800799024)(36860700016)(376014)(22082099003)(18002099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5tN6LJlyj8jDLaN4+z7NdjkxzL4OViPXV2uTHSfCnin9H6RSpPT98z1HyjADDSE8bxdDVpnD+pH+cnvLhQxWSbNWrBMjTMaGOaxt1hbxkm/koKEt+YYff1nR1UpQbGkIR2KYI1QxkaVC9NPz6hVREYLqYd+4fLr6bA8l/douxV5XBHmjkXzGVymnqrkeQRA/13oVINuGrK3fpFMn+wwSjBJk90Bxa4HZRKBik7a3cb0cUO2Gqak4yY+xVjzpdnEcDf0mzTkwnp3k0tJSuROpUjAc/be4of+xTuRMIQX+lOcF/K6ksdC0opiwaXE6udH6kEmhSB+tiO9gzhMzoRgOIAdtbhRhFaagujdBIFJeBxi3EXlemJ7YxdcaGWRFvj8BPqum4WHUrSyFEE6DKk8P3ZTzGNCAZ8KvbtzasFLkCIl9SvleY6xc3Sj+KHJElRz2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2026 20:20:19.6080 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52f6dd8b-f410-4534-14bc-08decb1b8571 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: DS2PEPF000061C6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL4PR12MB9483 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 773547479d15..99df1ae07055 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 /* @@ -440,11 +442,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 @@ -631,11 +630,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 @@ -846,19 +844,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, @@ -872,14 +871,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 @@ -966,7 +965,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 Tue Jun 16 19:34:15 2026 Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11010054.outbound.protection.outlook.com [52.101.85.54]) (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 1F48B3B71B7; Mon, 15 Jun 2026 20:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.85.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554833; cv=fail; b=ufbu3RkHq5YW/2pHWfvRxSZChnMAuTCEUOv1HmF9zoPSOzfexbVFdv51aBsH2HpTQENuYEC5/hEPwRFEODHOCFN914o+U2yl0VrJ9CG/WO+baaAbZKBgvcb/CUwuEDXZR0RAvZMQwsyxWDUNgujfymzRRMJ2EFd2/9NVpOdTXis= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554833; c=relaxed/simple; bh=oHolYnf5NDH98Rri15FYthQrI8BpqufkYq6EmioOIL8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dzWXgxi/cAByXrPdV7XEufcW3+/7GjALkw9sgiMmT+ul9bMdGRRG/HPSwPDqp/lxVgJToDa6APwkO8vAT6AVdE2issic4jx030QxzMFRMUHksFbWUYqqNTQYqa95IdM74n2YLvMVQCX5u0lv1dZ5dSgm/ct4tHQqXclGwZNnbwk= 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=ssxxGpqe; arc=fail smtp.client-ip=52.101.85.54 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="ssxxGpqe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oi/6C2g7huLO9NVwsDG3/dXC1Bgd6Oe7t+3tT6Ex04Q18jn98yNZZxj4gkfMCcXbtpqTU5ZZ5m9WXCL+W1aDm8UhwKdfE0Uyf7gnxwIpI+YPW1uGyuNLny4IJoPvJWR8VMU7YS8Zb4102dyZLjrsKNnwPhUk4gbRukWeB4OWyb54cVmNqNJxYM403hhBjd+dooZidCw8SB6x28MCYKXcug3Tef2fdrojlt+pAv7NdLHDLe9r37JtBMnLA2iFtHkRKV8I5PdWh9y4n3SkIGguE3IgDeekLAtP7aI1SzhmsJzVMwkK2anhCjB+Y+LdwBJyVb0lkPmdPmgDtKpBmqK4yA== 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=V2+4Z9YRy1ASF8bymvt9kd6ijQ3OZhUG8ANpVDbvw8g=; b=UMkR6+qtDU95f54ywzH4Z0H0zy8jnjX3Kneo0NKCNkDn3zG8C8xXv7nDQXZmhgs85wE6I2GYtCDwzWd1VyEYbRGtJrNw/6w2jTC8UuP6Evd+pO6ot3V4ac/56T8RZfWosW2Ii3Bvzr9kwNYPo39bzWXXhDbTh/hkAcGxDbeyUy1QsR72MtogRibSzVOlC44fLaKOQJIMDnT6gmTSg8C+4LAMA0mQmmTE3UpbZ5nPp7zDyh72Juh6sjGL1Hs3LbqNNFa7P2zm8nlazlZBvm50CslP6mnc34y+Havb5w3tY41yGSzwkpNqdoFbGJ0csDgg/bfpTRl3/gkEasHCgqvNOw== 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=V2+4Z9YRy1ASF8bymvt9kd6ijQ3OZhUG8ANpVDbvw8g=; b=ssxxGpqeAqOqGKliFDuG5fNHbj4jeS4aJDghJk51LXiJP1XLlGFhWjz8OZUIT/dUY2Ew8hKxUQG5rSi3PVID2uDyKr8UEsbWXKmL//Q9EQjPiCw5sKtzOLHjZgE7yR3da9IL2sk9h1JfqeBlIO8r94echWFLtoiZk/E+tN2UV3M= Received: from CH2PR02CA0020.namprd02.prod.outlook.com (2603:10b6:610:4e::30) by CH3PR12MB9313.namprd12.prod.outlook.com (2603:10b6:610:1ca::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.18; Mon, 15 Jun 2026 20:20:23 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::6a) by CH2PR02CA0020.outlook.office365.com (2603:10b6:610:4e::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.18 via Frontend Transport; Mon, 15 Jun 2026 20:20:23 +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 CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.8 via Frontend Transport; Mon, 15 Jun 2026 20:20:23 +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; Mon, 15 Jun 2026 15:20:19 -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; Mon, 15 Jun 2026 15:20:19 -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; Mon, 15 Jun 2026 15:20:18 -0500 From: Tanmay Shah To: , , , , CC: , , , Tanmay Shah Subject: [PATCH v4 3/5] rpmsg: virtio_rpmsg_bus: get buffer size from config space Date: Mon, 15 Jun 2026 13:20:05 -0700 Message-ID: <20260615202007.3484668-4-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260615202007.3484668-1-tanmay.shah@amd.com> References: <20260615202007.3484668-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: CH2PEPF000000A0:EE_|CH3PR12MB9313:EE_ X-MS-Office365-Filtering-Correlation-Id: 125acbba-401e-420f-4832-08decb1b8786 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|23010399003|376014|36860700016|18002099003|22082099003|6133799003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: yVgRDWSdn1zh+SW3hfU0/M09woopyd+UGTONp2lGChjzPSHg1dUrNS5fjJmEZUjXm9DqO11K72he1rGMcQLMG+0fu4Jx7jVQrk7QzW1ClhTsJTKKWf5yH+LGQn9ykAkE7JiqkGBvxxSR/geeZoGznWQ+su+DcD15ZBeEMA/jOQZ9xo4aVcqj6JqCpBRidtIMbigzJz9GoNmPlMpufDJFiq2NjJznpGKZzJpp6BdZS0xZ/dRLazCqPsZMUFSVkvnuItpf0ah6RR98ov/K8arvOnSirXoFZTQTolSQ9h3AXGt2wnrX863heMlTVQrgSCMAddZzsgMLdgXFqpG/ag7ot0s0zAmIfRiZgqvaig303ctak8Z7wHV3ugYaR6O3rMmg0kUT67QTK8LyUBLtyA+9PGbLx+qz1H93dySFYQyJvuuk8YfHLRslw+6zG9qVO8EIA4HFOPMoZYz27vGAmDghji3iD0UxE18STSrnj+jmZfY4VLgfcpZRU1Ww7a+tYS/4YwwZtG3W2dlwS4F/dzGPRlzEvYBCgB4ijtXeW1+3LUtP8zJKLSl7i6uqeTMyXUCOIoAv3CdWW5xc68pPafmKDsZmDpU3eZQPAGlSjcQ6C57fAAG/Y7vluyvra/LzGEwyDFz9ztKq44bSXvQtYPoGKSknU15p6M0gDBp4ofvVeiHmCjf7Eu8NB8ftSfXJPPA87T9J+/2Bi9WbA/PSYK5G2znLbU7FV7/ahRiVF+9UYDw= 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)(82310400026)(1800799024)(23010399003)(376014)(36860700016)(18002099003)(22082099003)(6133799003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kLNjV+fZHuAI5REqcGAfjahy24i1gbCZvJapOJTBk46viSi8nf8GgvIedGNY4su3K4vO8d/qAB44nQKeFbgXcc4+S0iJKFxB53/RJOBsH5TVcwSiHaHwZGN2Z/tru24U58xNLBhprjz38t5GdPu6j04UXrI4YRNLQOh/JWVDFmwyrg2uTu12+zdEdit+ux63Eg/+WsoQI1CSA3u0C9NEyZTfQ/rLI90DzcOCSYop0AT4Fn/o9dMRyKIRN4lCwueVH2uZyQF34zmOPOx88BVPKluakKQfMJd1QktDixUnSskP0szlfKgeW60ScA24q8WDv7l3Mo2AcCY3N658kfl/M44Zw9EXuoggWCb16fLHUt3wdUJKZHpjseU3F2Ha6q2W7C+hYppTRKdEziZw/jSl4wuRArITOwr1qh5KTeGvkn1lXeK6IUbBuNNxAXRhEyK2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2026 20:20:23.1193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 125acbba-401e-420f-4832-08decb1b8786 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9313 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 v4: squash to virtio rpmsg config patch - 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 | 129 ++++++++++++++++++++++++----- include/linux/rpmsg/virtio_rpmsg.h | 50 +++++++++++ 2 files changed, 160 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 99df1ae07055..a59925f870a4 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,8 @@ * @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 * @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 +62,8 @@ 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; int last_tx_buf; dma_addr_t bufs_dma; struct mutex tx_lock; @@ -68,9 +72,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 +129,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. @@ -444,7 +445,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 * vrp->last_tx_buf++; /* or recycle a used one */ else ret =3D virtqueue_get_buf(vrp->svq, &len); @@ -514,7 +515,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; } @@ -647,7 +648,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, @@ -673,7 +674,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; @@ -706,7 +707,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); @@ -820,10 +821,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) @@ -855,9 +859,90 @@ 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 two\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; + } + + /* + * The buffer size must be aligned to the provided alignment for + * so that the start address of tx bufs can be aligned. + */ + if (rpmsg_buf_align && + (!IS_ALIGNED(vrp->rx_buf_size, rpmsg_buf_align) || + !IS_ALIGNED(vrp->tx_buf_size, rpmsg_buf_align))) { + dev_err(&vdev->dev, + "bad vdev config: buf sizes (rx %u, tx %u) not aligned to %u\n", + vrp->rx_buf_size, vrp->tx_buf_size, + rpmsg_buf_align); + err =3D -EINVAL; + goto vqs_del; + } + + 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; + } + + total_buf_space =3D (vrp->num_rx_buf * vrp->rx_buf_size) + + (vrp->num_tx_buf * vrp->tx_buf_size); =20 /* allocate coherent memory for the buffers */ bufs_va =3D dma_alloc_coherent(vdev->dev.parent, @@ -874,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); =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; =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); @@ -965,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) + + (vrp->num_tx_buf * vrp->tx_buf_size); int ret; =20 virtio_reset_device(vdev); @@ -992,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..7e14da68fd17 --- /dev/null +++ b/include/linux/rpmsg/virtio_rpmsg.h @@ -0,0 +1,50 @@ +/* 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. + * @reserved: reserved for padding, must be zero. + * @size: size of this structure in bytes. + * @rpmsg_buf_align: required alignment in bytes for each buffer. Must be a + * power of two so that both the buffer sizes and the TX buffer + * base address can be aligned (e.g. to a cache line). + * @reserved1: reserved for padding, must be zero. Keeps the following 32-= bit + * fields naturally aligned. + * @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; + u8 reserved; + __virtio16 size; + __virtio16 rpmsg_buf_align; + __virtio16 reserved1; + /* 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 Tue Jun 16 19:34:15 2026 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012062.outbound.protection.outlook.com [52.101.48.62]) (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 816AE3B42C3; Mon, 15 Jun 2026 20:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.48.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554826; cv=fail; b=HmplbAljQpkGANt8zEd09btvzjC2F7+r8aFq2MfsPjrVDd81rWWF6J22LgVmBJxx/DxVZbIehYyQTpv2MNNhwWotWvinOXjSUH04t1cY4PU3PUKtY8Gg9NKqaG8Kls2tjHaaFJ/65FymfM3myEf/5mDWvZdVWfIF+k9rdA8RbSI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554826; c=relaxed/simple; bh=WT3DTRekDxPhSzKAd8ci86oXAJqQ/Y7JYOsf4GQNvnQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OUaRHGEX7TvUpJitcSW/j25pmK9J+wXf746BAwAk1x4AKo0pOrQmR76bVqEiK4WGbJL20X2u36tYgulk03a2lP+xeJ9MtZbL7RSZ5VITSRckouDn6hxeuL1hOdUk3z3oj9Ot6OqcL5Kq5zqM0OT1m8kO/zbIBiCxsuW2jPNdo3o= 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=q846wZxm; arc=fail smtp.client-ip=52.101.48.62 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="q846wZxm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bICHnRIUI0M9JB0D1+CxzA3OfmdcsbIy8SE9riOl+IU9xZP/aeoZzTQrhnW/TrI5RTY1sQY4YLyXKu/o0j/5Csx3DUhjwBnh2nOibDbczCvTmIU+v906IRmnwDBPuy5UIi+xCe0FWoIgfm4/EDJ89IhCDyHBF10fW85r7K+7NgzRvvNpNQVJpFp5nTNLaXasAqjSQQNFbTfyLgru9IsSaptempzXsPXSDZ0J84UhHuYUPZEWpITdAG/WVS95yM9NOxJaJQMpV2LywAUCn56JKhnOoJeQBrQ77h4CSjf1M7AwtA4P49Bf5atnTTDgK3XheM0RJ7nwk8SJA1WsWq/IGg== 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=iSLlhg1KRwpz44YtErOtiTxEsSnF0MNnDZkjQ+YM9dM=; b=kcv5meb/Kxvt9H1h3TXRxRr/CWALqbvuU45ScLLlqqBP1/ERZf2CowRl+BW0USl2b2I+BhEo9R4iZtB+HrbdM+hyQtmCL+5HTC+E6R0g+527nbPUZCaOISTnZ0+oBOq0S7+1jwic1KW9773cw749r9fq1uA63zLmRekJkLa+fasgBGy8c8Q5K4Bcechmv8/22cZJ/D0MtngTLOEwW/n08UwUqzVnZNZHACMGpBD0ddzx2onVxv85EEGRIEMz5uwZd50rFhSSjvR4Cd9QbGSfa8GHh1knh5NFZ95k0A+AA0wlBC3jVpSewW7DzygeTRofqPqnZ+nOOA6sQ+1ZHVGDrw== 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=iSLlhg1KRwpz44YtErOtiTxEsSnF0MNnDZkjQ+YM9dM=; b=q846wZxm2i0A3yXCafXiBjjrn4GIJwuhgwP1n4bgrlZIvadbf6Af9Plg85/G2wkvB7ulBkoVnqnH65WiEUPvobl1PEr8/dpK63AQncq8egn5DGgOokBfOiNNb8+PKuCaUyyos/UqkSGAtvzUseyffL/wmt/P3aWtIF+IHroVwzQ= Received: from CH2PR02CA0001.namprd02.prod.outlook.com (2603:10b6:610:4e::11) by LV9PR12MB9757.namprd12.prod.outlook.com (2603:10b6:408:2ed::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.18; Mon, 15 Jun 2026 20:20:22 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::74) by CH2PR02CA0001.outlook.office365.com (2603:10b6:610:4e::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.18 via Frontend Transport; Mon, 15 Jun 2026 20:20:22 +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 CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.8 via Frontend Transport; Mon, 15 Jun 2026 20:20:21 +0000 Received: from satlexmb08.amd.com (10.181.42.217) 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; Mon, 15 Jun 2026 15:20:20 -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; Mon, 15 Jun 2026 15:20:19 -0500 From: Tanmay Shah To: , , , , CC: , , , Tanmay Shah Subject: [PATCH v4 4/5] docs: rpmsg: add virtio config space details Date: Mon, 15 Jun 2026 13:20:06 -0700 Message-ID: <20260615202007.3484668-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260615202007.3484668-1-tanmay.shah@amd.com> References: <20260615202007.3484668-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: CH2PEPF000000A0:EE_|LV9PR12MB9757:EE_ X-MS-Office365-Filtering-Correlation-Id: 3635c426-4974-4393-972d-08decb1b869d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|376014|23010399003|82310400026|18002099003|22082099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: 1x1jD0L2bNnp92tpKS4fMZE2AC25J7IrM3ZqK+jwYv4ziZc6nhRJoaGDORW5I6Ewu28nk20slUcwqwF9oqtmXYuzLRtgad5o8RsiSwe6fSlhBWXWTchSbRpv0VeSPbmOdeGTrLE08JE50l7qVV4ITmGUky+tlzkxv8XPzUVZSvtLfwpiYO69mKBOBxQroN1UH9wnihbiQ5ophXEfQNBF6KWqxediUL/E9exCodWbcrJCCdxjk0VZeY3EGEgeXlWXPattZ+2JKLB46Y95TjVnZrnTsyS7P1jLdg7ZxT8aVEe/fFcB5f7tmNM0xicRC+bDSssJ8ZnSC60+CcDxDB4mIimIc983hpm48cyS+Z4c9eSsLp0d4RUPFSIFzFsqQ7dY3PLI6OPAxosGdwj9Sv6ay5AZDmbuE7YHQ0QJL9MSKVQ9eYCVa2dYNOAQ8EAnSw6K0K+EwYZ12mJ5KOPlO52rrAgJVUAZXhiNaf1RwtUtPURAsZ0C8wxEUT+R9vbdPZSWyeTlsBXEDjKQYI+GrMduuBnAxJBzVHgkyAoIAP9Rk7Ytz76Sol+ct4YaDrzOjEKFk+Km/ufoxiIv2GpaHZBqx15LJnPnlP4en72jiQdaw2OPXblVd2UjOp/afTSycLyE9djGBlL8Ys/I6+2Kal77Uk7tcbXURvNdGSC3fJF0/HeUCUMN+2U63QFfReIHG0022OpuC7TbJ3YADG0IwjtV/yU7e7VhCZsOo21EO2bdan8= 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)(36860700016)(1800799024)(376014)(23010399003)(82310400026)(18002099003)(22082099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XR5aqhmjgeZoGfGtkqiExIoKgreuCGWdNMEPZDWPcDyDI3Vd+Q23zaowB8cx/FZ6hud/0SpvaDB/fbF/qd6prxRDoElVcCl8e2rIIVkEFXprS5WcnADjTg8QkKMWVVWVS2TpJp85mfjqIfYboyA0Ybn+OvtG3sKkqWNaRhC5to812mhwmr09DUYZUUiOf99ei3Dr2f0CeUaJfq/tzp8EqehXaEa00q1rUGLmSzYTIXCdxhdcklO0BxT2j86PJs7BZQZQGlkf3AkpkZ3zu2PTnZQai4SbmxS8qe0P58WbkSfePQ3DWdIJ+qORxzY/k+CUT0lOkww+zz3HENHLUCRkMeoTAB/mGpCN0YiL2H3weX94QBuzhfRBtgCjvsHVfDZIcyKAX4RhsXJMprXcEpBC//fc1MBJJ942SpszY/oSfBxFodxGqdexEP4kXFy53SXa X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2026 20:20:21.5952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3635c426-4974-4393-972d-08decb1b869d 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV9PR12MB9757 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 --- Documentation/staging/rpmsg.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/staging/rpmsg.rst b/Documentation/staging/rpmsg.= rst index 42bac1149d9d..c06602e169a9 100644 --- a/Documentation/staging/rpmsg.rst +++ b/Documentation/staging/rpmsg.rst @@ -300,3 +300,22 @@ 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), and the driver splits the total buffer space i= nto +TX and RX buffers accordingly. Both buffer sizes must be aligned to the +rpmsg_buf_align field provided in the config space; a value of 0 means the +sizes are assumed to be already aligned. + +If the feature is not negotiated, the default 512-byte buffers are used for +both directions. --=20 2.34.1 From nobody Tue Jun 16 19:34:15 2026 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012022.outbound.protection.outlook.com [52.101.48.22]) (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 76E063B637A; Mon, 15 Jun 2026 20:20:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.48.22 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554827; cv=fail; b=EUtcgIjBWzQtL6vABk4itBpLutSBHc11+6g86yI57ns+NRDRWBT5O2b6vZtC3cRRJdj1SU5QrC8ze0WpUynDLFzf033l4mM5lEiwjL/sqW7IMmwDaZsJ9JwtIUqdImeuHDXziV9hrUYqBRsJz89Dw22LB7NNeb3/bkG6r10V9SY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781554827; c=relaxed/simple; bh=GEeDQ2D9UsljkK0nfBg45gSecv9BKVjEY5KPkAlr3ok=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RnERbhZAFbCy23P23hn0QW0CBJ87yLHhX20TDFrcoyeOZFKHDcofEbRpQP128ENKMG8cmT+FkdFwE51CpBQ7spg/oiqTr1GdzRbvfCsTM1YXQTGABHR/SKAYC6fpph98aVAkJjuBUcMg/K2aGPlgyi0xOjf+UPvzvLMC3v3MQKQ= 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=u6rlRnWD; arc=fail smtp.client-ip=52.101.48.22 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="u6rlRnWD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=opCcTAtO+BUYcdrtyTWmvBt2bwJhnN8JrCjkyu8/HV5oQsi7kAUnH+0Vb1d2BKzJeQM79F52FAgkdauJdpNO2H4Sz/dMpHPXZWypyT7i+fqaVKJINx2BbsowW8ZLKa9kpbRPN6ErhIF7hA+y09bTREvAYRVhWvF2KLt47fY1+l9iweEMJ9gZSnetDeOq8vZwKHdyQddvs/BqKdQksKdaF5wJ9I5PHsPOSVK2xcyD4dmKKjd2o3hW/qylDtxPV/ucg3VbpWqVc8gM2pB3DfGMjGNkNKx+V7YVqX1iFri19qoQ2t3NFIxaev3NJuCvXhL9frjT4mefEYZyOOhkFGT+Ag== 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=0exUdRUIlW+7uMJydsGY4OeGD1+Qxf3hwaFoc5ngitA=; b=cTkrjXhQb2/HF1wlSuCe0CGEoJY9hQmJzn4K6uNqx4BnVu6Jt8YyTAiM+j7IeIheYrtuI7yocdbsuPWq9KVGNNAcnOYlNOEkYPy3VEuq9szCw3xA2L7g9ROjwLqgL6Yaa9tiH39ceylODlk1gtphxKymUIqbmOoltwi6FwgzOR6aL9Hf67iYsVr4fa6pH5vXq9dyaIIJijnN8/Z6x8FBhviibLkE7T7h7Hby3ECAifNghui+hYrwu/Dce3HChGokTufLcBi6/btgXC0vC1uSrVbkRsAlYllUyj1rAK4283vWDoO7kpw7Cx+lC8Qgafd3X6HeJCiR+3Ah75WIlFybzg== 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=0exUdRUIlW+7uMJydsGY4OeGD1+Qxf3hwaFoc5ngitA=; b=u6rlRnWDO0Wj49myeLem65LYZmzDJmR1BUZsQjmXHDkkjUjZrDDTWHhcTikFoz8d/afwScTLzJ9nqGuwWnjO2srWNriThpNXs0hLEdWv4HRJqmN2GZs1sAN9jquibqsSICqNwh4BcpgI4ddDVPQBn+Ehz/RhxRhwIfmwj78+C6M= Received: from CH2PR18CA0044.namprd18.prod.outlook.com (2603:10b6:610:55::24) by SJ2PR12MB8036.namprd12.prod.outlook.com (2603:10b6:a03:4c1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.16; Mon, 15 Jun 2026 20:20:22 +0000 Received: from DS2PEPF000061C2.namprd02.prod.outlook.com (2603:10b6:610:55:cafe::5c) by CH2PR18CA0044.outlook.office365.com (2603:10b6:610:55::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.18 via Frontend Transport; Mon, 15 Jun 2026 20:20:21 +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 DS2PEPF000061C2.mail.protection.outlook.com (10.167.23.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.8 via Frontend Transport; Mon, 15 Jun 2026 20:20:21 +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; Mon, 15 Jun 2026 15:20:21 -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; Mon, 15 Jun 2026 15:20:20 -0500 From: Tanmay Shah To: , , , , CC: , , , Tanmay Shah Subject: [PATCH v4 5/5] samples: rpmsg: add MTU size info Date: Mon, 15 Jun 2026 13:20:07 -0700 Message-ID: <20260615202007.3484668-6-tanmay.shah@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260615202007.3484668-1-tanmay.shah@amd.com> References: <20260615202007.3484668-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: DS2PEPF000061C2:EE_|SJ2PR12MB8036:EE_ X-MS-Office365-Filtering-Correlation-Id: a5d220ee-230c-44a4-95e9-08decb1b867e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|23010399003|376014|22082099003|18002099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: GQHQ95Qh/Nsg3tZV9zOrdWQFHFUnXkHSQYJYS2Fveq8dR0XJSU4wmh77eNxrMEPmempWxHcQUDSPLKZy1R6GCmvhaelNpLYKir55uveYvLgM2kNEs/YICQhX77SMf3kDbyPYEpL552rBLiJtAcI/dfhuySN9ezAsW/mq3vAk9l+vwkBt4lu5lIjnn26FSjxBVpk+yjS7Qn6+nDjaExMPT7K+LeaI0LiBbZCCCLaYqXjRNKXwBCdExwGZ7NSOR69bnJdzRWeANHX/K7P6Oi8Isds7tZHol5sxJb8a25aYiiCqJFkuCJ44rMi20AO5GiWKRp4l5mf2ibdHwJmLOU/U3Af0igZfc2PKddve5S2EOB9miAvrQDXc7DSOaWpv6Lki0K/3lNniJX+2EmysKiPBobTbhQCQfwPPDHak7szDDFkBE2Bo5o5kAoyVD0qWpgwBA7Q8mJfJC4r/MJVjdLlnG8/12sRpEh+tvZr7sPfZJfuItALeD5XkJWMLNBAapjY0m9jwB8vsszgdkEFgMhNZ3YMYUHcTkot9Jy7Dwu4WcIskl8suAm0qGquhgWbfDPCn603Z9eCQupUMVnlL1MDXTz3kcjycMYQPEvPnm+OgnWwW9CTvEdrJa3SSvc2pMxuoepoi8c3nwk4Tm/OwOe7FtJ+vSjlIKeR9HLMjjdjv/QmW4CyVv5z6J6hx/yTFeYJMbQ003M+2tmeCTjFjrYjbhcTK4zplqirhxts3i7qWNrY= 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)(36860700016)(1800799024)(82310400026)(23010399003)(376014)(22082099003)(18002099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9Gfve4+sWieEW3BlbAEX6AP4wU67ZnhD2Gz0W38p8eiSpt16q2UL7Ypc7ppob54PNXMCIpTnHD8zQkQMWSzFJG5EFLJeTQOrPVBtuQPZCcU/MunwMw8ZiRSfZl2K04Y8JScW04Xr0RmH5JpGJgxggdJDZdiFcv0da2klEI+iyZ12jVBHPmKu+ULSNgd5ou+BipmIiZ8J8O/uzq2DxzSj6q49orRlx719JYXRPw5MkS6u8+us/oHFeGV2ObVDwufcsSOh/r30X14Pvi8+b3BT1DSUyBuWuq7IyLLDlhekyQsBLiNU9v0Zy2Kyb0H+OVInM11XL8sPuilPxF1Lsc2l2kV287yFAhjWKOwGKKAlCfeSPQbjckc6inpz9DDLxNdxJjLr4leKu7Y4t6tKE6CXqk7v3ZaJ1pGxE2aRaaAEsl76dKbMrej+E3faHVgYEHdz X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2026 20:20:21.3808 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5d220ee-230c-44a4-95e9-08decb1b867e 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: DS2PEPF000061C2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8036 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