RE: [PATCH V5 12/12] net: netvsc: Add Isolation VM support for netvsc driver

From: Haiyang Zhang
Date: Tue Sep 14 2021 - 11:49:54 EST




> -----Original Message-----
> From: Tianyu Lan <ltykernel@xxxxxxxxx>
> Sent: Tuesday, September 14, 2021 9:39 AM
> To: KY Srinivasan <kys@xxxxxxxxxxxxx>; Haiyang Zhang
> <haiyangz@xxxxxxxxxxxxx>; Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>;
> wei.liu@xxxxxxxxxx; Dexuan Cui <decui@xxxxxxxxxxxxx>; tglx@xxxxxxxxxxxxx;
> mingo@xxxxxxxxxx; bp@xxxxxxxxx; x86@xxxxxxxxxx; hpa@xxxxxxxxx;
> dave.hansen@xxxxxxxxxxxxxxx; luto@xxxxxxxxxx; peterz@xxxxxxxxxxxxx;
> konrad.wilk@xxxxxxxxxx; boris.ostrovsky@xxxxxxxxxx; jgross@xxxxxxxx;
> sstabellini@xxxxxxxxxx; joro@xxxxxxxxxx; will@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; jejb@xxxxxxxxxxxxx;
> martin.petersen@xxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; arnd@xxxxxxxx;
> hch@xxxxxx; m.szyprowski@xxxxxxxxxxx; robin.murphy@xxxxxxx;
> brijesh.singh@xxxxxxx; Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>;
> thomas.lendacky@xxxxxxx; pgonda@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx;
> kirill.shutemov@xxxxxxxxxxxxxxx; rppt@xxxxxxxxxx; sfr@xxxxxxxxxxxxxxxx;
> aneesh.kumar@xxxxxxxxxxxxx; saravanand@xxxxxx;
> krish.sadhukhan@xxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxxx;
> tj@xxxxxxxxxx; rientjes@xxxxxxxxxx; Michael Kelley
> <mikelley@xxxxxxxxxxxxx>
> Cc: iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-arch@xxxxxxxxxxxxxxx; linux-
> hyperv@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> scsi@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; vkuznets
> <vkuznets@xxxxxxxxxx>; parri.andrea@xxxxxxxxx; dave.hansen@xxxxxxxxx
> Subject: [PATCH V5 12/12] net: netvsc: Add Isolation VM support for
> netvsc driver
>
> From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
>
> In Isolation VM, all shared memory with host needs to mark visible
> to host via hvcall. vmbus_establish_gpadl() has already done it for
> netvsc rx/tx ring buffer. The page buffer used by vmbus_sendpacket_
> pagebuffer() stills need to be handled. Use DMA API to map/umap
> these memory during sending/receiving packet and Hyper-V swiotlb
> bounce buffer dma address will be returned. The swiotlb bounce buffer
> has been masked to be visible to host during boot up.
>
> Allocate rx/tx ring buffer via alloc_pages() in Isolation VM and map
> these pages via vmap(). After calling vmbus_establish_gpadl() which
> marks these pages visible to host, unmap these pages to release the
> virtual address mapped with physical address below shared_gpa_boundary
> and map them in the extra address space via vmap_pfn().
>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
> Change since v4:
> * Allocate rx/tx ring buffer via alloc_pages() in Isolation VM
> * Map pages after calling vmbus_establish_gpadl().
> * set dma_set_min_align_mask for netvsc driver.
>
> Change since v3:
> * Add comment to explain why not to use dma_map_sg()
> * Fix some error handle.
> ---

Reviewed-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>

Thank you!