From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87ECDC433EF for ; Fri, 7 Jan 2022 06:33:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 174206FC7E; Fri, 7 Jan 2022 06:33:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GRCzDMnsNORZ; Fri, 7 Jan 2022 06:33:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id AEAA76FC77; Fri, 7 Jan 2022 06:33:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E0668C006F; Fri, 7 Jan 2022 06:33:14 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D892C001E for ; Fri, 7 Jan 2022 06:33:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5D5454014E for ; Fri, 7 Jan 2022 06:33:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mKbMYV6txROs for ; Fri, 7 Jan 2022 06:33:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by smtp2.osuosl.org (Postfix) with ESMTPS id AF2CD40283 for ; Fri, 7 Jan 2022 06:33:11 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R391e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04407; MF=xuanzhuo@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0; TI=SMTPD_---0V19LP-J_1641537186; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0V19LP-J_1641537186) by smtp.aliyun-inc.com(127.0.0.1); Fri, 07 Jan 2022 14:33:06 +0800 From: Xuan Zhuo To: virtualization@lists.linux-foundation.org Subject: [PATCH 0/6] virtio: support advance DMA Date: Fri, 7 Jan 2022 14:33:00 +0800 Message-Id: <20220107063306.23240-1-xuanzhuo@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Cc: "Michael S. Tsirkin" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" virtqueue_add() only supports virtual addresses, dma is completed in virtqueue_add(). In some scenarios (such as the AF_XDP scenario), DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtqueue_add(). This patch set stipulates that if sg->dma_address is not NULL, use this address as the DMA address. And record this information in extra->flags, which can be skipped when executing dma unmap. extra->flags |= VRING_DESC_F_PREDMA; But the indirect desc does not have a corresponding extra, so the second and third patches of this patch set are to allocate the corresponding extra while allocating the indirect desc. Each desc must have a corresponding extra because it is possible in an sgs some are advance DMA, while others are virtual addresses. So we must allocate an extra for each indirect desc. Xuan Zhuo (6): virtio: rename vring_unmap_state_packed() to vring_unmap_extra_packed() virtio: split: alloc indirect desc with extra virtio: packed: alloc indirect desc with extra virtio: split: virtqueue_add_split() support dma address virtio: packed: virtqueue_add_packed() support dma address virtio: add api virtio_dma_map() for advance dma drivers/virtio/virtio_ring.c | 387 ++++++++++++++++++++--------------- include/linux/virtio.h | 9 + 2 files changed, 232 insertions(+), 164 deletions(-) -- 2.31.0 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization