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

From: Tianyu Lan
Date: Tue Aug 10 2021 - 09:09:35 EST


On 8/10/2021 6:12 AM, Dave Hansen wrote:
On 8/9/21 10:56 AM, Tianyu Lan wrote:
From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>

Add new hvcall guest address host visibility support to mark
memory visible to host. Call it inside set_memory_decrypted
/encrypted(). Add HYPERVISOR feature check in the
hv_is_isolation_supported() to optimize in non-virtualization
environment.

From an x86/mm perspective:

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxx>


Thanks for your ACK.


A tiny nit:

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 0bb4d9ca7a55..b3683083208a 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -607,6 +607,12 @@ EXPORT_SYMBOL_GPL(hv_get_isolation_type);
bool hv_is_isolation_supported(void)
{
+ if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
+ return 0;
+
+ if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
+ return 0;
+
return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE;
}
This might be worthwhile to move to a header. That ensures that
hv_is_isolation_supported() use can avoid even a function call. But, I
see this is used in modules and its use here is also in a slow path, so
it's not a big deal


I will move it to header in the following version.


Thanks.