RE: [PATCH V7 5/5] net: netvsc: Add Isolation VM support for netvsc driver
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2021-12-13 16:57:06
Also in:
linux-arch, linux-hyperv, linux-iommu, linux-scsi, lkml
-----Original Message-----
From: Tianyu Lan <redacted>
Sent: Monday, December 13, 2021 2:14 AM
To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>; Stephen
Hemminger [off-list ref]; wei.liu@kernel.org; Dexuan Cui [off-list ref];
tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; dave.hansen@linux.intel.com;
x86@kernel.org; hpa@zytor.com; davem@davemloft.net; kuba@kernel.org; jejb@linux.ibm.com;
martin.petersen@oracle.com; arnd@arndb.de; hch@infradead.org; m.szyprowski@samsung.com;
robin.murphy@arm.com; thomas.lendacky@amd.com; Tianyu Lan [off-list ref];
Michael Kelley (LINUX) [off-list ref]
Cc: iommu@lists.linux-foundation.org; linux-arch@vger.kernel.org; linux-
hyperv@vger.kernel.org; linux-kernel@vger.kernel.org; linux-scsi@vger.kernel.org;
netdev@vger.kernel.org; vkuznets [off-list ref]; brijesh.singh@amd.com;
konrad.wilk@oracle.com; hch@lst.de; joro@8bytes.org; parri.andrea@gmail.com;
dave.hansen@intel.com
Subject: [PATCH V7 5/5] net: netvsc: Add Isolation VM support for netvsc driver
From: Tianyu Lan <redacted>
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 <redacted>
---
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@microsoft.com>