On Wed, Sep 30, 2020 at 07:30:21AM +0000, Sherry Sun wrote: > There may be some misunderstandings here. > For ->get_dp_dma callback, it is used to get the device page dma address, > which is allocated by MIC layer instead of vop layer. > For Intel mic, it still use kzalloc and dma_map_single apis, although we > recommended and we did use dma_alloc_coherent to get consistent device > page memory on our i.MX platform, but we didn't change the original implementation > method of Intel mic till now, as our main goal is to change the vop code to make it > more generic. Given how the memory is used everyone should use dma_alloc_coherent. Note that for x86 the ony difference is that dma_alloc_coherent also dips into the CMA pools where available, which eases allocator pressure, and that it properly deals with the AMD SEV memory encryption, which does't matter for Intel platforms. > Which is means that the device page may use different allocate methods for > different platform, and now it is transparent to the vop layer. > So I think here use ->get_dp_dma callback to get device page dma address > is the most simple and convenient way. > > We change to use dma_alloc_coherent in patch 1 to allocate vrings memory, as it is > the main job that the vop layer is responsible for. > So I still suggest to use ->get_dp or ->get_dp_dma callback for device page here, what do you think? As mentioned you need to move the code to mmap the buffers to the same layer as the one doing the allocation. If that is taken care of we're fine, and I think a ->mmap callback might be the best way to archive that, but this is not code I know intimately.