[PATCH V2 0/4] Change vring space from nomal memory to dma coherent memory

From: Sherry Sun
Date: Tue Sep 29 2020 - 04:45:37 EST


Changes in V2:
1. Remove dev_is_dma_coherent check as Christoph suggested in the patchset.
2. Remove used_address_updated flags in Patch2.
3. Remove WARN_ON in Patch3 and return error code instead directly return -1.
4. Remove Patch4 as it is a separate patch now.
5. Add more detailed explanations in the commit of patches.

The original vop driver only supports dma coherent device, as it allocates and
maps vring by _get_free_pages and dma_map_single, but not use
dma_sync_single_for_cpu/device to sync the updates of device_page/vring between
EP and RC, which will cause memory synchronization problem for device don't
support hardware dma coherent.

And allocate vrings use dma_alloc_coherent is a common way in kernel, as the
memory interacted between two systems should use consistent memory to avoid
caching effects. So here add noncoherent platform support for vop driver.
Also add some related dma changes to make sure noncoherent platform works
well.

Sherry Sun (4):
misc: vop: change the way of allocating vring
misc: vop: do not allocate and reassign the used ring
misc: vop: simply return the saved dma address instead of virt_to_phys
misc: vop: mapping kernel memory to user space as noncached

drivers/misc/mic/bus/vop_bus.h | 2 +
drivers/misc/mic/host/mic_boot.c | 8 +++
drivers/misc/mic/vop/vop_debugfs.c | 2 -
drivers/misc/mic/vop/vop_main.c | 48 +++--------------
drivers/misc/mic/vop/vop_vringh.c | 83 +++++++-----------------------
include/uapi/linux/mic_common.h | 3 --
6 files changed, 35 insertions(+), 111 deletions(-)

--
2.17.1