RE: [PATCH V7 5/5] net: netvsc: Add Isolation VM support for netvsc driver

From: Haiyang Zhang
Date: Mon Dec 13 2021 - 11:57:05 EST




> -----Original Message-----
> From: Tianyu Lan <ltykernel@xxxxxxxxx>
> Sent: Monday, December 13, 2021 2:14 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; dave.hansen@xxxxxxxxxxxxxxx;
> x86@xxxxxxxxxx; hpa@xxxxxxxxx; davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; jejb@xxxxxxxxxxxxx;
> martin.petersen@xxxxxxxxxx; arnd@xxxxxxxx; hch@xxxxxxxxxxxxx; m.szyprowski@xxxxxxxxxxx;
> robin.murphy@xxxxxxx; thomas.lendacky@xxxxxxx; Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>;
> Michael Kelley (LINUX) <mikelley@xxxxxxxxxxxxx>
> Cc: iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-arch@xxxxxxxxxxxxxxx; linux-
> hyperv@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; vkuznets <vkuznets@xxxxxxxxxx>; brijesh.singh@xxxxxxx;
> konrad.wilk@xxxxxxxxxx; hch@xxxxxx; joro@xxxxxxxxxx; parri.andrea@xxxxxxxxx;
> dave.hansen@xxxxxxxxx
> Subject: [PATCH V7 5/5] 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.
>
> rx/tx ring buffer is allocated via vzalloc() and they need to be
> mapped into unencrypted address space(above vTOM) before sharing
> with host and accessing. Add hv_map/unmap_memory() to map/umap rx
> /tx ring buffer.
>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
> Change since v3:
> * Replace HV_HYP_PAGE_SIZE with PAGE_SIZE and virt_to_hvpfn()
> with vmalloc_to_pfn() in the hv_map_memory()
>
> Change since v2:
> * Add hv_map/unmap_memory() to map/umap rx/tx ring buffer.
> ---
> arch/x86/hyperv/ivm.c | 28 ++++++
> drivers/hv/hv_common.c | 11 +++
> drivers/net/hyperv/hyperv_net.h | 5 ++
> drivers/net/hyperv/netvsc.c | 136 +++++++++++++++++++++++++++++-
> drivers/net/hyperv/netvsc_drv.c | 1 +
> drivers/net/hyperv/rndis_filter.c | 2 +
> include/asm-generic/mshyperv.h | 2 +
> include/linux/hyperv.h | 5 ++
> 8 files changed, 187 insertions(+), 3 deletions(-)
>

Reviewed-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>