Commit 13d7a146 authored by Edgar E. Iglesias's avatar Edgar E. Iglesias Committed by Suman Anna
Browse files

virtio_ring: revise descriptor addition logic for virtio_rpmsg

The virtio core expects the vring buffers to be allocated from
linear address space in general, but this may not be true always
with virtio_rpmsg. The virtio_rpmsg bus allocates the vring buffers
using the dma_alloc_coherent() API, and this API can return virtual
addresses from the vmalloc range if the underlying memory is allocated
from a carveout (physical contiguous memory not mapped into kernel) or
a CMA pool in highmem. For more details, please see the discussion
thread, http://marc.info/?l=linux-arm-kernel&m=142738673019657&w=2

.

This patch adds a 'rpmsg' flag to the internal virtqueue_add function
and leverages this flag to revise the descriptor preparation when
adding the buffers. The revised logic uses the sg_dma_address() and
sg_dma_len() helpers instead of relying on sg_phys() and sg->length
fields, so that the remote side sees the physical addresses of the
vring buffers properly. The virtio rpmsg core is expected to prepare
the scatterlist structures with the dma fields filled in properly, and
use a new API (will be added in following patch) to add the virtqueue
buffers.

Signed-off-by: default avatarEdgar E. Iglesias <edgar.iglesias@xilinx.com>
[s-anna@ti.com: rename dma variable to use rpmsg, add commit description]
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
parent 2b07f54a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment