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

From: Sherry Sun
Date: Thu Oct 22 2020 - 01:07:59 EST


Changes in V3:
1. Change the device page allocation method of the Intel mic layer in Patch 1 to
align with the vring allocation.
2. Move the vring physical address changes in mmap callback from Prach 3 to 1.
3. Use must_be_zero instead of directly deleting used_address_updated in
Patch 2 to avoid the influence of ABI change.
(I tried to use dma_mmap_coherent api in Patch 4 as Christoph suggested, but
met some issues explained here https://lore.kernel.org/patchwork/patch/1313327/,
so there is no change to Patch 4, and still can't find a better way than
patch 3)

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 and device page
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/host/mic_main.c | 15 ++----
drivers/misc/mic/vop/vop_debugfs.c | 2 -
drivers/misc/mic/vop/vop_main.c | 48 +++--------------
drivers/misc/mic/vop/vop_vringh.c | 84 +++++++-----------------------
include/uapi/linux/mic_common.h | 5 +-
7 files changed, 42 insertions(+), 122 deletions(-)

--
2.17.1