Skip to contentSkip to conversation

Virtio ring works with DMA coherent memory

RFC PATCH In review Wendy Liang 2 participants 3 messages Dec 6, 2016 – Dec 8, 2016 virtio core

lore
Share & tools
lore
#0 lore raw

cover Virtio ring works with DMA coherent memory

RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped.

When virtio vring sees the sg_dma_addr is ready set, do not call dma_map_page().

The issue was once discussed here:
http://virtualization.linux-foundation.narkive.com/CfVP32Vy/rfc-0-4-rpmsg-fix-init-of-dma-able-virtqueues

Edgar E. Iglesias (1):
rpmsg: DMA map sgs passed to virtio

Wendy Liang (1):
virtio_ring: Do not call dma_map_page if sg is already mapped.

 drivers/rpmsg/virtio_rpmsg_bus.c | 22 +++++++++++++++++++---
 drivers/virtio/virtio_ring.c     |  6 ++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 14 lines · Wendy Liang

RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped.

When virtio vring sees the sg_dma_addr is ready set, do not call dma_map_page().

The issue was once discussed here:
http://virtualization.linux-foundation.narkive.com/CfVP32Vy/rfc-0-4-rpmsg-fix-init-of-dma-able-virtqueues

Edgar E. Iglesias (1):
rpmsg: DMA map sgs passed to virtio

Quoted 7 lines

Wendy Liang (1):
virtio_ring: Do not call dma_map_page if sg is already mapped.

  drivers/rpmsg/virtio_rpmsg_bus.c | 22 +++++++++++++++++++---
  drivers/virtio/virtio_ring.c     |  6 ++++++
  2 files changed, 25 insertions(+), 3 deletions(-)

Looks good to me.

I think you can send a formal patch (without RFC prefix).

Thanks

#2 lore raw

Thanks Jason, I will resend it as a formal patch.

Wendy

Quoted 38 lines

-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Wednesday, December 07, 2016 7:18 PM
To: Jiaying Liang; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected] foundation.org
Cc: Jiaying Liang
Subject: Re: [RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory

Quoted 1 line · Wendy Liang

RPMsg uses dma_alloc_coherent() to allocate memory to shared with the

remote.

Quoted 6 lines

In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped.

When virtio vring sees the sg_dma_addr is ready set, do not call

dma_map_page().

Quoted 8 lines

The issue was once discussed here:
http://virtualization.linux-foundation.narkive.com/CfVP32Vy/rfc-0-4-rp
msg-fix-init-of-dma-able-virtqueues

Edgar E. Iglesias (1):
rpmsg: DMA map sgs passed to virtio

Quoted 7 lines

Wendy Liang (1):
virtio_ring: Do not call dma_map_page if sg is already mapped.

  drivers/rpmsg/virtio_rpmsg_bus.c | 22 +++++++++++++++++++---
  drivers/virtio/virtio_ring.c     |  6 ++++++
  2 files changed, 25 insertions(+), 3 deletions(-)
Quoted 5 lines

Looks good to me.

I think you can send a formal patch (without RFC prefix).

Thanks

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.