Re: [RFC PATCH V3 10/11] HV/Netvsc: Add Isolation VM support for netvsc driver

From: Tianyu Lan
Date: Mon Jun 14 2021 - 10:05:32 EST



On 6/14/2021 3:09 PM, Christoph Hellwig wrote:
On Mon, Jun 07, 2021 at 11:21:20PM +0800, Tianyu Lan wrote:
dma_map_single can only be used on page baked memory, and if this is
using page backed memory you wouldn't need to do thee phys_to_virt
tricks. Can someone explain the mess here in more detail?

Sorry. Could you elaborate the issue? These pages in the pb array are not
allocated by DMA API and using dma_map_single() here is to map these pages'
address to bounce buffer physical address.

dma_map_single just calls dma_map_page using virt_to_page. So this
can't work on addresses not in the kernel linear mapping.


The pages in the hv_page_buffer array here are in the kernel linear mapping. The packet sent to host will contain an array which contains transaction data. In the isolation VM, data in the these pages needs to be copied to bounce buffer and so call dma_map_single() here to map these data pages with bounce buffer. The vmbus has ring buffer where the send/receive packets are copied to/from. The ring buffer has been remapped to the extra space above shared gpa boundary/vTom during probing Netvsc driver and so not call dma map function for vmbus ring
buffer.