Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-02 Thread Joerg Roedel
On Mon, Aug 02, 2021 at 03:11:40PM +0200, Juergen Gross wrote: > As those cases are all mutually exclusive, wouldn't a static_call() be > the appropriate solution? Right, static_call() is even better, thanks. ___ iommu mailing list iommu@lists.linux-foun

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-02 Thread Juergen Gross via iommu
On 02.08.21 14:01, Joerg Roedel wrote: On Wed, Jul 28, 2021 at 08:29:41AM -0700, Dave Hansen wrote: __set_memory_enc_dec() is turning into a real mess. SEV, TDX and now Hyper-V are messing around in here. I was going to suggest a PV_OPS call where the fitting implementation for the guest envi

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-02 Thread Tianyu Lan
On 8/2/2021 8:01 PM, Joerg Roedel wrote: On Wed, Jul 28, 2021 at 08:29:41AM -0700, Dave Hansen wrote: __set_memory_enc_dec() is turning into a real mess. SEV, TDX and now Hyper-V are messing around in here. I was going to suggest a PV_OPS call where the fitting implementation for the guest

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-02 Thread Joerg Roedel
On Wed, Jul 28, 2021 at 08:29:41AM -0700, Dave Hansen wrote: > __set_memory_enc_dec() is turning into a real mess. SEV, TDX and now > Hyper-V are messing around in here. I was going to suggest a PV_OPS call where the fitting implementation for the guest environment can be plugged in at boot. Ther

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Tianyu Lan
On 7/30/2021 12:05 AM, Dave Hansen wrote: On 7/29/21 8:02 AM, Tianyu Lan wrote: There is x86_hyper_type to identify hypervisor type and we may check this variable after checking X86_FEATURE_HYPERVISOR. static inline bool hv_is_isolation_supported(void) { if (!cpu_feature_enabled(X86_FEA

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Dave Hansen
On 7/29/21 8:02 AM, Tianyu Lan wrote: >> > > There is x86_hyper_type to identify hypervisor type and we may check > this variable after checking X86_FEATURE_HYPERVISOR. > > static inline bool hv_is_isolation_supported(void) > { > if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) >     ret

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Tianyu Lan
On 7/29/2021 10:09 PM, Dave Hansen wrote: On 7/29/21 6:01 AM, Tianyu Lan wrote: On 7/29/2021 1:06 AM, Dave Hansen wrote: On 7/28/21 7:52 AM, Tianyu Lan wrote: @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)   int ret;     /* Nothing t

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Dave Hansen
On 7/29/21 6:01 AM, Tianyu Lan wrote: > On 7/29/2021 1:06 AM, Dave Hansen wrote: >> On 7/28/21 7:52 AM, Tianyu Lan wrote: >>> @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long >>> addr, int numpages, bool enc) >>>   int ret; >>>     /* Nothing to do if memory encryption is

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Tianyu Lan
On 7/29/2021 1:06 AM, Dave Hansen wrote: On 7/28/21 7:52 AM, Tianyu Lan wrote: @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc) int ret; /* Nothing to do if memory encryption is not active */ - if (!mem_encrypt_active()) +

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-29 Thread Tianyu Lan
Hi Dave: Thanks for your review. On 7/28/2021 11:29 PM, Dave Hansen wrote: On 7/28/21 7:52 AM, Tianyu Lan wrote: @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc) int ret; /* Nothing to do if memory encryption is not active */

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-28 Thread Dave Hansen
On 7/28/21 7:52 AM, Tianyu Lan wrote: > @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long addr, int > numpages, bool enc) > int ret; > > /* Nothing to do if memory encryption is not active */ > - if (!mem_encrypt_active()) > + if (hv_is_isolation_supported()

Re: [PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-28 Thread Dave Hansen
On 7/28/21 7:52 AM, Tianyu Lan wrote: > @@ -1986,7 +1988,9 @@ static int __set_memory_enc_dec(unsigned long addr, int > numpages, bool enc) > int ret; > > /* Nothing to do if memory encryption is not active */ > - if (!mem_encrypt_active()) > + if (hv_is_isolation_supported()

[PATCH 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-07-28 Thread Tianyu Lan
From: Tianyu Lan Add new hvcall guest address host visibility support to mark memory visible to host. Call it inside set_memory_decrypted /encrypted(). Signed-off-by: Tianyu Lan --- arch/x86/hyperv/Makefile | 2 +- arch/x86/hyperv/ivm.c | 112 ++