Re: [Resend RFC PATCH V2 08/12] UIO/Hyper-V: Not load UIO HV driver in the isolation VM.

2021-04-15 Thread Tianyu Lan
On 4/14/2021 11:45 PM, Greg KH wrote: On Wed, Apr 14, 2021 at 10:49:41AM -0400, Tianyu Lan wrote: From: Tianyu Lan UIO HV driver should not load in the isolation VM for security reason. Return ENOTSUPP in the hv_uio_probe() in the isolation VM. Signed-off-by: Tianyu Lan --- drivers/uio

Re: [Resend RFC PATCH V2 08/12] UIO/Hyper-V: Not load UIO HV driver in the isolation VM.

2021-04-15 Thread Tianyu Lan
Hi Stephen: Thanks for your review. On 4/15/2021 12:17 AM, Stephen Hemminger wrote: On Wed, 14 Apr 2021 17:45:51 +0200 Greg KH wrote: On Wed, Apr 14, 2021 at 10:49:41AM -0400, Tianyu Lan wrote: From: Tianyu Lan UIO HV driver should not load in the isolation VM for security reason

Re: [Resend RFC PATCH V2 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver

2021-04-15 Thread Tianyu Lan
On 4/14/2021 11:50 PM, Christoph Hellwig wrote: +struct dma_range { + dma_addr_t dma; + u32 mapping_size; +}; That's a rather generic name that is bound to create a conflict sooner or later. Good point. Will update. #include "hyperv_net.h" #include "netvsc_trace.h" +#in

Re: [Resend RFC PATCH V2 04/12] HV: Add Write/Read MSR registers via ghcb

2021-04-15 Thread Tianyu Lan
On 4/14/2021 11:41 PM, Christoph Hellwig wrote: +EXPORT_SYMBOL_GPL(hv_ghcb_msr_write); Just curious, who is going to use all these exports? These seems like extremely low-level functionality. Isn't there a way to build a more useful higher level API? Yes, will remove it.

Re: [Resend RFC PATCH V2 03/12] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-04-15 Thread Tianyu Lan
Hi Christoph: Thanks for your review. On 4/14/2021 11:40 PM, Christoph Hellwig wrote: +/* + * hv_set_mem_host_visibility - Set host visibility for specified memory. + */ I don't think this comment really clarifies anything over the function name. What is 'host visibility' OK. Will u

[Resend RFC PATCH V2 12/12] HV/Storvsc: Add Isolation VM support for storvsc driver

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan 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_ mpb_desc() still need to handle. Use DMA API to map/umap these memory during

[Resend RFC PATCH V2 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan 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() still need to handle. Use DMA API to map/umap these memory

[Resend RFC PATCH V2 10/12] HV/IOMMU: Add Hyper-V dma ops support

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Hyper-V Isolation VM requires bounce buffer support. To use swiotlb bounce buffer, add Hyper-V dma ops and use swiotlb functions in the map and unmap callback. Allocate bounce buffer in the Hyper-V code because bounce buffer needs to be accessed via extra address space(e.g

[Resend RFC PATCH V2 08/12] UIO/Hyper-V: Not load UIO HV driver in the isolation VM.

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan UIO HV driver should not load in the isolation VM for security reason. Return ENOTSUPP in the hv_uio_probe() in the isolation VM. Signed-off-by: Tianyu Lan --- drivers/uio/uio_hv_generic.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/uio/uio_hv_generic.c b

[Resend RFC PATCH V2 09/12] swiotlb: Add bounce buffer remap address setting function

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan For Hyper-V isolation VM with AMD SEV SNP, the bounce buffer(shared memory) needs to be accessed via extra address space(e.g address above bit39). Hyper-V code may remap extra address space outside of swiotlb. swiotlb_bounce() needs to use remap virtual address to copy data from

[Resend RFC PATCH V2 06/12] HV/Vmbus: Add SNP support for VMbus channel initiate message

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan The physical address of monitor pages in the CHANNELMSG_INITIATE_CONTACT msg should be in the extra address space for SNP support and these pages also should be accessed via the extra address space inside Linux guest and remap the extra address by ioremap function. Signed-off

[Resend RFC PATCH V2 05/12] HV: Add ghcb hvcall support for SNP VM

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Hyper-V provides ghcb hvcall to handle VMBus HVCALL_SIGNAL_EVENT and HVCALL_POST_MESSAGE msg in SNP Isolation VM. Add such support. Signed-off-by: Tianyu Lan --- arch/x86/hyperv/ivm.c | 69 + arch/x86/include/asm/mshyperv.h | 1

[Resend RFC PATCH V2 07/12] HV/Vmbus: Initialize VMbus ring buffer for Isolation VM

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan VMbus ring buffer are shared with host and it's need to be accessed via extra address space of Isolation VM with SNP support. This patch is to map the ring buffer address in extra address space via ioremap(). HV host visibility hvcall smears data in the ring buffer and so

[Resend RFC PATCH V2 04/12] HV: Add Write/Read MSR registers via ghcb

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Hyper-V provides GHCB protocol to write Synthetic Interrupt Controller MSR registers and these registers are emulated by Hypervisor rather than paravisor. Hyper-V requests to write SINTx MSR registers twice(once via GHCB and once via wrmsr instruction including the proxy bit 21

[Resend RFC PATCH V2 03/12] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Add new hvcall guest address host visibility support. Mark vmbus ring buffer visible to host when create gpadl buffer and mark back to not visible when tear down gpadl buffer. Co-Developed-by: Sunil Muthuswamy Signed-off-by: Tianyu Lan --- arch/x86/hyperv/Makefile

[Resend RFC PATCH V2 02/12] x86/HV: Initialize shared memory boundary in Isolation VM

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Hyper-V exposes shared memory boundary via cpuid HYPERV_ CPUID_ISOLATION_CONFIG and store it in the shared_gpa_ boundary of ms_hyperv struct. This prepares to share memory with host for AMD SEV SNP guest. Signed-off-by: Tianyu Lan --- arch/x86/kernel/cpu/mshyperv.c | 2

[Resend RFC PATCH V2 01/12] x86/HV: Initialize GHCB page in Isolation VM

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan Hyper-V exposes GHCB page via SEV ES GHCB MSR for SNP guest to communicate with hypervisor. Map GHCB page for all cpus to read/write MSR register and submit hvcall request via GHCB. Signed-off-by: Tianyu Lan --- arch/x86/hyperv/hv_init.c | 52

[Resend RFC PATCH V2 00/12] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-04-14 Thread Tianyu Lan
From: Tianyu Lan "Resend all patches because someone in CC list didn't receive all patchset. Sorry for nosy." 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 the

[RFC V2 PATCH 00/12] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-04-13 Thread Tianyu Lan
From: Tianyu Lan 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 m

[RFC V2 PATCH 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver

2021-04-13 Thread Tianyu Lan
From: Tianyu Lan 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() still need to handle. Use DMA API to map/umap these memory

Re: [RFC PATCH 2/12] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-03-04 Thread Tianyu Lan
On 3/4/2021 12:58 AM, Vitaly Kuznetsov wrote: Tianyu Lan writes: From: Tianyu Lan Add new hvcall guest address host visibility support. Mark vmbus ring buffer visible to host when create gpadl buffer and mark back to not visible when tear down gpadl buffer. Signed-off-by: Sunil

Re: [RFC PATCH 1/12] x86/Hyper-V: Add visibility parameter for vmbus_establish_gpadl()

2021-03-04 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 3/4/2021 12:27 AM, Vitaly Kuznetsov wrote: Tianyu Lan writes: From: Tianyu Lan Add visibility parameter for vmbus_establish_gpadl() and prepare to change host visibility when create gpadl for buffer. "No functional change" as you don&

[RFC PATCH 9/12] x86/Hyper-V: Add new parameter for vmbus_sendpacket_pagebuffer()/mpb_desc()

2021-02-28 Thread Tianyu Lan
From: Tianyu Lan Add new parameter io_type and struct bounce_pkt for vmbus_sendpacket_pagebuffer() and vmbus_sendpacket_mpb_desc() in order to add bounce buffer support later. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Tianyu Lan --- drivers/hv

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

2021-02-28 Thread Tianyu Lan
From: Tianyu Lan Add Isolation VM support for netvsc driver. Map send/receive ring buffer in extra address space in SNP isolation VM, reserve bounce buffer for packets sent via vmbus_sendpacket_pagebuffer() and release bounce buffer via hv_pkt_bounce() when get send complete response from host

[RFC PATCH 2/12] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-02-28 Thread Tianyu Lan
From: Tianyu Lan Add new hvcall guest address host visibility support. Mark vmbus ring buffer visible to host when create gpadl buffer and mark back to not visible when tear down gpadl buffer. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Tianyu Lan

[RFC PATCH 00/12] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-02-28 Thread Tianyu Lan
From: Tianyu Lan 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 m

[RFC PATCH 1/12] x86/Hyper-V: Add visibility parameter for vmbus_establish_gpadl()

2021-02-28 Thread Tianyu Lan
From: Tianyu Lan Add visibility parameter for vmbus_establish_gpadl() and prepare to change host visibility when create gpadl for buffer. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Tianyu Lan --- arch/x86/include/asm/hyperv-tlfs.h | 9