[PATCH V2 0/6] x86/Hyper-V: Add Hyper-V Isolation VM support(Second part)

Tianyu Lan
2021-11-23T14:30:45Z

Hyper-V provides two kinds of Isolation VMs. VBS(Virtualization-based
security) and AMD SEV-SNP unenlightened Isolation VMs. This patchset
is to add support for these Isolation VM support in Linux.

The memory of these vms are encrypted and host can't access guest
memory directly. Hyper-V provides new host visibility hvcall and
the guest needs to call new hvcall to mark memory visible to host
before sharing memory with host. For security, all network/storage
stack memory should not be shared with host and so there is bounce
buffer requests.

Vmbus channel ring buffer already plays bounce buffer role because
all data from/to host needs to copy from/to between the ring buffer
and IO stack memory. So mark vmbus channel ring buffer visible.

For SNP isolation VM, guest needs to access the shared memory via
extra address space which is specified by Hyper-V CPUID HYPERV_CPUID_
ISOLATION_CONFIG. The access physical address of the shared memory
should be bounce buffer memory GPA plus with shared_gpa_boundary
reported by CPUID.

This patchset is to enable swiotlb bounce buffer for netvsc/storvsc
in Isolation VM. Add Hyper-V dma ops and provide dma_alloc/free_
noncontiguous and vmap/vunmap_noncontiguous callback. Allocate
rx/tx ring via dma_alloc_noncontiguous() and map them into extra
address space via dma_vmap_noncontiguous().

Change since v1:
* Add Hyper-V Isolation support check in the cc_platform_has()
and return true for guest memory encrypt attr.
* Remove hv isolation check in the sev_setup_arch()

Tianyu Lan (6):
Swiotlb: Add Swiotlb bounce buffer remap function for HV IVM
dma-mapping: Add vmap/vunmap_noncontiguous() callback in dma ops
x86/hyper-v: Add hyperv Isolation VM check in the cc_platform_has()
hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
net: netvsc: Add Isolation VM support for netvsc driver
scsi: storvsc: Add Isolation VM support for storvsc driver

arch/x86/kernel/cc_platform.c | 15 +++
arch/x86/mm/mem_encrypt.c | 1 +
arch/x86/xen/pci-swiotlb-xen.c | 3 +-
drivers/hv/Kconfig | 1 +
drivers/hv/vmbus_drv.c | 6 +
drivers/iommu/hyperv-iommu.c | 164 +++++++++++++++++++++++++
drivers/net/hyperv/hyperv_net.h | 5 +
drivers/net/hyperv/netvsc.c | 192 +++++++++++++++++++++++++++---
drivers/net/hyperv/rndis_filter.c | 2 +
drivers/scsi/storvsc_drv.c | 37 +++---
include/linux/dma-map-ops.h | 3 +
include/linux/hyperv.h | 17 +++
include/linux/swiotlb.h | 6 +
kernel/dma/mapping.c | 18 ++-
kernel/dma/swiotlb.c | 53 ++++++++-
15 files changed, 482 insertions(+), 41 deletions(-)

--
2.25.1