MLK-20780 virtio_ring: check dma_mem for xen_domain
authorPeng Fan <peng.fan@nxp.com>
Mon, 21 Jan 2019 02:44:49 +0000 (10:44 +0800)
committerPeng Fan <peng.fan@nxp.com>
Wed, 10 Jul 2019 09:54:31 +0000 (17:54 +0800)
commit8fa2abe18d8f76e9e52ccb25cd4ca9f2201e7f82
tree87b1a420c5c8e820911d1a261e436e816b2a9a75
parentd0f78378816bcb3bdbd5c8fafebeb5d608e85b49
MLK-20780 virtio_ring: check dma_mem for xen_domain

on i.MX8QM, M4_1 is communicating with DomU using rpmsg with a fixed
address as the dma mem buffer which is predefined.

Without this patch, the flow is:
vring_map_one_sg -> vring_use_dma_api
                 -> dma_map_page
       -> __swiotlb_map_page
                ->swiotlb_map_page
->__dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
However we are using per device dma area for rpmsg, phys_to_virt
could not return a correct virtual address for virtual address in
vmalloc area. Then kernel panic.

With this patch, vring_use_dma_api will return false, and
vring_map_one_sg will return sg_phys(sg) which is the correct phys
address in the predefined memory region.
vring_map_one_sg -> vring_use_dma_api
                 -> sg_phys(sg)

Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 484db6e6eb6b8d0ba2cfa946caa53616e23c0364)
drivers/virtio/virtio_ring.c