Skip to content

Commit 71290be

Browse files
kelleymhbp3tk0v
authored andcommitted
x86/hyperv: Reorder code to facilitate future work
Reorder some code to facilitate future work. No functional change. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tianyu Lan <Tianyu.Lan@microsoft.com> Link: https://lore.kernel.org/r/1679838727-87310-3-git-send-email-mikelley@microsoft.com
1 parent 88e378d commit 71290be

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

arch/x86/hyperv/ivm.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -235,40 +235,6 @@ void hv_ghcb_msr_read(u64 msr, u64 *value)
235235
EXPORT_SYMBOL_GPL(hv_ghcb_msr_read);
236236
#endif
237237

238-
enum hv_isolation_type hv_get_isolation_type(void)
239-
{
240-
if (!(ms_hyperv.priv_high & HV_ISOLATION))
241-
return HV_ISOLATION_TYPE_NONE;
242-
return FIELD_GET(HV_ISOLATION_TYPE, ms_hyperv.isolation_config_b);
243-
}
244-
EXPORT_SYMBOL_GPL(hv_get_isolation_type);
245-
246-
/*
247-
* hv_is_isolation_supported - Check system runs in the Hyper-V
248-
* isolation VM.
249-
*/
250-
bool hv_is_isolation_supported(void)
251-
{
252-
if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
253-
return false;
254-
255-
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
256-
return false;
257-
258-
return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE;
259-
}
260-
261-
DEFINE_STATIC_KEY_FALSE(isolation_type_snp);
262-
263-
/*
264-
* hv_isolation_type_snp - Check system runs in the AMD SEV-SNP based
265-
* isolation VM.
266-
*/
267-
bool hv_isolation_type_snp(void)
268-
{
269-
return static_branch_unlikely(&isolation_type_snp);
270-
}
271-
272238
/*
273239
* hv_mark_gpa_visibility - Set pages visible to host via hvcall.
274240
*
@@ -387,3 +353,37 @@ void hv_unmap_memory(void *addr)
387353
{
388354
vunmap(addr);
389355
}
356+
357+
enum hv_isolation_type hv_get_isolation_type(void)
358+
{
359+
if (!(ms_hyperv.priv_high & HV_ISOLATION))
360+
return HV_ISOLATION_TYPE_NONE;
361+
return FIELD_GET(HV_ISOLATION_TYPE, ms_hyperv.isolation_config_b);
362+
}
363+
EXPORT_SYMBOL_GPL(hv_get_isolation_type);
364+
365+
/*
366+
* hv_is_isolation_supported - Check system runs in the Hyper-V
367+
* isolation VM.
368+
*/
369+
bool hv_is_isolation_supported(void)
370+
{
371+
if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
372+
return false;
373+
374+
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
375+
return false;
376+
377+
return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE;
378+
}
379+
380+
DEFINE_STATIC_KEY_FALSE(isolation_type_snp);
381+
382+
/*
383+
* hv_isolation_type_snp - Check system runs in the AMD SEV-SNP based
384+
* isolation VM.
385+
*/
386+
bool hv_isolation_type_snp(void)
387+
{
388+
return static_branch_unlikely(&isolation_type_snp);
389+
}

0 commit comments

Comments
 (0)