Skip to content

Commit af788f3

Browse files
Tianyu Lanliuw
authored andcommitted
x86/hyperv: Initialize shared memory boundary in the Isolation VM.
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 SNP guest. Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Tianyu Lan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 0cc4f6d commit af788f3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ static void __init ms_hyperv_init_platform(void)
313313
if (ms_hyperv.priv_high & HV_ISOLATION) {
314314
ms_hyperv.isolation_config_a = cpuid_eax(HYPERV_CPUID_ISOLATION_CONFIG);
315315
ms_hyperv.isolation_config_b = cpuid_ebx(HYPERV_CPUID_ISOLATION_CONFIG);
316+
ms_hyperv.shared_gpa_boundary =
317+
BIT_ULL(ms_hyperv.shared_gpa_boundary_bits);
316318

317319
pr_info("Hyper-V: Isolation Config: Group A 0x%x, Group B 0x%x\n",
318320
ms_hyperv.isolation_config_a, ms_hyperv.isolation_config_b);

include/asm-generic/mshyperv.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ struct ms_hyperv_info {
3535
u32 max_vp_index;
3636
u32 max_lp_index;
3737
u32 isolation_config_a;
38-
u32 isolation_config_b;
38+
union {
39+
u32 isolation_config_b;
40+
struct {
41+
u32 cvm_type : 4;
42+
u32 reserved1 : 1;
43+
u32 shared_gpa_boundary_active : 1;
44+
u32 shared_gpa_boundary_bits : 6;
45+
u32 reserved2 : 20;
46+
};
47+
};
48+
u64 shared_gpa_boundary;
3949
};
4050
extern struct ms_hyperv_info ms_hyperv;
4151

0 commit comments

Comments
 (0)