Skip to content

Commit b711538

Browse files
committed
Merge tag 'hyperv-fixes-signed-20231009' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv fixes from Wei Liu: - fixes for Hyper-V VTL code (Saurabh Sengar and Olaf Hering) - fix hv_kvp_daemon to support keyfile based connection profile (Shradha Gupta) * tag 'hyperv-fixes-signed-20231009' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: hv/hv_kvp_daemon:Support for keyfile based connection profile hyperv: reduce size of ms_hyperv_info x86/hyperv: Add common print prefix "Hyper-V" in hv_init x86/hyperv: Remove hv_vtl_early_init initcall x86/hyperv: Restrict get_vtl to only VTL platforms
2 parents 832b5d0 + 42999c9 commit b711538

File tree

6 files changed

+253
-46
lines changed

6 files changed

+253
-46
lines changed

arch/x86/hyperv/hv_init.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* Author : K. Y. Srinivasan <[email protected]>
88
*/
99

10+
#define pr_fmt(fmt) "Hyper-V: " fmt
11+
1012
#include <linux/efi.h>
1113
#include <linux/types.h>
1214
#include <linux/bitfield.h>
@@ -191,7 +193,7 @@ void set_hv_tscchange_cb(void (*cb)(void))
191193
struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
192194

193195
if (!hv_reenlightenment_available()) {
194-
pr_warn("Hyper-V: reenlightenment support is unavailable\n");
196+
pr_warn("reenlightenment support is unavailable\n");
195197
return;
196198
}
197199

@@ -394,6 +396,7 @@ static void __init hv_get_partition_id(void)
394396
local_irq_restore(flags);
395397
}
396398

399+
#if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
397400
static u8 __init get_vtl(void)
398401
{
399402
u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
@@ -416,13 +419,16 @@ static u8 __init get_vtl(void)
416419
if (hv_result_success(ret)) {
417420
ret = output->as64.low & HV_X64_VTL_MASK;
418421
} else {
419-
pr_err("Failed to get VTL(%lld) and set VTL to zero by default.\n", ret);
420-
ret = 0;
422+
pr_err("Failed to get VTL(error: %lld) exiting...\n", ret);
423+
BUG();
421424
}
422425

423426
local_irq_restore(flags);
424427
return ret;
425428
}
429+
#else
430+
static inline u8 get_vtl(void) { return 0; }
431+
#endif
426432

427433
/*
428434
* This function is to be invoked early in the boot sequence after the
@@ -564,7 +570,7 @@ void __init hyperv_init(void)
564570
if (cpu_feature_enabled(X86_FEATURE_IBT) &&
565571
*(u32 *)hv_hypercall_pg != gen_endbr()) {
566572
setup_clear_cpu_cap(X86_FEATURE_IBT);
567-
pr_warn("Hyper-V: Disabling IBT because of Hyper-V bug\n");
573+
pr_warn("Disabling IBT because of Hyper-V bug\n");
568574
}
569575
#endif
570576

@@ -604,8 +610,10 @@ void __init hyperv_init(void)
604610
hv_query_ext_cap(0);
605611

606612
/* Find the VTL */
607-
if (!ms_hyperv.paravisor_present && hv_isolation_type_snp())
608-
ms_hyperv.vtl = get_vtl();
613+
ms_hyperv.vtl = get_vtl();
614+
615+
if (ms_hyperv.vtl > 0) /* non default VTL */
616+
hv_vtl_early_init();
609617

610618
return;
611619

arch/x86/hyperv/hv_vtl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static int hv_vtl_wakeup_secondary_cpu(int apicid, unsigned long start_eip)
215215
return hv_vtl_bringup_vcpu(vp_id, start_eip);
216216
}
217217

218-
static int __init hv_vtl_early_init(void)
218+
int __init hv_vtl_early_init(void)
219219
{
220220
/*
221221
* `boot_cpu_has` returns the runtime feature support,
@@ -230,4 +230,3 @@ static int __init hv_vtl_early_init(void)
230230

231231
return 0;
232232
}
233-
early_initcall(hv_vtl_early_init);

arch/x86/include/asm/mshyperv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,10 @@ static inline u64 hv_get_non_nested_register(unsigned int reg) { return 0; }
340340

341341
#ifdef CONFIG_HYPERV_VTL_MODE
342342
void __init hv_vtl_init_platform(void);
343+
int __init hv_vtl_early_init(void);
343344
#else
344345
static inline void __init hv_vtl_init_platform(void) {}
346+
static inline int __init hv_vtl_early_init(void) { return 0; }
345347
#endif
346348

347349
#include <asm-generic/mshyperv.h>

include/asm-generic/mshyperv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct ms_hyperv_info {
3636
u32 nested_features;
3737
u32 max_vp_index;
3838
u32 max_lp_index;
39+
u8 vtl;
3940
union {
4041
u32 isolation_config_a;
4142
struct {
@@ -54,7 +55,6 @@ struct ms_hyperv_info {
5455
};
5556
};
5657
u64 shared_gpa_boundary;
57-
u8 vtl;
5858
};
5959
extern struct ms_hyperv_info ms_hyperv;
6060
extern bool hv_nested;

0 commit comments

Comments
 (0)