File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -224,10 +224,14 @@ extern bool hv_isolation_type_snp(void);
224
224
225
225
static inline bool hv_is_synic_reg (unsigned int reg )
226
226
{
227
- if ((reg >= HV_REGISTER_SCONTROL ) &&
228
- (reg <= HV_REGISTER_SINT15 ))
229
- return true;
230
- return false;
227
+ return (reg >= HV_REGISTER_SCONTROL ) &&
228
+ (reg <= HV_REGISTER_SINT15 );
229
+ }
230
+
231
+ static inline bool hv_is_sint_reg (unsigned int reg )
232
+ {
233
+ return (reg >= HV_REGISTER_SINT0 ) &&
234
+ (reg <= HV_REGISTER_SINT15 );
231
235
}
232
236
233
237
u64 hv_get_register (unsigned int reg );
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ struct ms_hyperv_info ms_hyperv;
44
44
#if IS_ENABLED (CONFIG_HYPERV )
45
45
static inline unsigned int hv_get_nested_reg (unsigned int reg )
46
46
{
47
+ if (hv_is_sint_reg (reg ))
48
+ return reg - HV_REGISTER_SINT0 + HV_REGISTER_NESTED_SINT0 ;
49
+
47
50
switch (reg ) {
48
51
case HV_REGISTER_SIMP :
49
52
return HV_REGISTER_NESTED_SIMP ;
@@ -53,8 +56,6 @@ static inline unsigned int hv_get_nested_reg(unsigned int reg)
53
56
return HV_REGISTER_NESTED_SVERSION ;
54
57
case HV_REGISTER_SCONTROL :
55
58
return HV_REGISTER_NESTED_SCONTROL ;
56
- case HV_REGISTER_SINT0 :
57
- return HV_REGISTER_NESTED_SINT0 ;
58
59
case HV_REGISTER_EOM :
59
60
return HV_REGISTER_NESTED_EOM ;
60
61
default :
@@ -80,8 +81,7 @@ void hv_set_non_nested_register(unsigned int reg, u64 value)
80
81
hv_ghcb_msr_write (reg , value );
81
82
82
83
/* Write proxy bit via wrmsl instruction */
83
- if (reg >= HV_REGISTER_SINT0 &&
84
- reg <= HV_REGISTER_SINT15 )
84
+ if (hv_is_sint_reg (reg ))
85
85
wrmsrl (reg , value | 1 << 20 );
86
86
} else {
87
87
wrmsrl (reg , value );
You can’t perform that action at this time.
0 commit comments