Skip to contentSkip to conversation

hyperv: Enable SCONTROL if SYNIC is enabled

PATCH In review Jon Doron 2 participants 4 messages Jul 17, 2020 – Aug 10, 2020

lore
Share & tools
lore

Jon Doron

author
#0 lore raw

cover hyperv: Enable SCONTROL if SYNIC is enabled

Based on an analysis of the HyperV firmwares (Gen1 and Gen2) it seems like the SCONTROL is not being set to the ENABLED state as like we have thought.

Also from a test done by Vitaly Kuznetsov, running a nested HyperV it was concluded that the first access to the SCONTROL MSR with a read resulted with the value of 0x1, aka HV_SYNIC_CONTROL_ENABLE.

It's important to note that this diverges from the value states in the HyperV TLFS of 0.

Jon Doron (1):
hyperv: Enable SCONTROL if SYNIC is enabled

 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
Signature · 1 line
2.24.1
author
#1 lore raw

PATCH 1/1 hyperv: Enable SCONTROL if SYNIC is enabled

Based on an analysis of the HyperV firmwares (Gen1 and Gen2) it seems like the SCONTROL is not being set to the ENABLED state as like we have thought.

Also from a test done by Vitaly Kuznetsov, running a nested HyperV it was concluded that the first access to the SCONTROL MSR with a read resulted with the value of 0x1, aka HV_SYNIC_CONTROL_ENABLE.

It's important to note that this diverges from the value states in the HyperV TLFS of 0.

---
 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
target/i386/kvm.c +2 -0
index b8455c89ed..6a62e8ae94 100644
@@ -1904,6 +1904,8 @@ void kvm_arch_reset_vcpu(X86CPU *cpu)
 
     if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC)) {
         int i;
+
+        env->msr_hv_synic_control = HV_SYNIC_ENABLE;
         for (i = 0; i < ARRAY_SIZE(env->msr_hv_synic_sint); i++) {
             env->msr_hv_synic_sint[i] = HV_SINT_MASKED;
         }
Signature · 1 line
2.24.1
#2 lore raw
Quoted 22 lines · Jon Doron

Based on an analysis of the HyperV firmwares (Gen1 and Gen2) it seems like the SCONTROL is not being set to the ENABLED state as like we have thought.

Also from a test done by Vitaly Kuznetsov, running a nested HyperV it was concluded that the first access to the SCONTROL MSR with a read resulted with the value of 0x1, aka HV_SYNIC_CONTROL_ENABLE.

It's important to note that this diverges from the value states in the HyperV TLFS of 0.

---
 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
target/i386/kvm.c +0 -0
index b8455c89ed..6a62e8ae94 100644

target/i386/kvm.c void kvm_arch_reset_vcpu(X86CPU *cpu) · line 1911

Quoted 8 lines
target/i386/kvm.c +2 -0
@@ -1904,6 +1904,8 @@ void kvm_arch_reset_vcpu(X86CPU *cpu)
 
     if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC)) {
         int i;
+
+        env->msr_hv_synic_control = HV_SYNIC_ENABLE;
         for (i = 0; i < ARRAY_SIZE(env->msr_hv_synic_sint); i++) {
             env->msr_hv_synic_sint[i] = HV_SINT_MASKED;
         }

Are both patches needed or only the Hyper-V one?

Paolo

author
#3 lore raw

I think both patches are

Quoted 37 lines · On Mon, Aug 10, 2020, 20:27 Paolo Bonzini <[email protected]> wrote:
Quoted 22 lines · Jon Doron

Based on an analysis of the HyperV firmwares (Gen1 and Gen2) it seems like the SCONTROL is not being set to the ENABLED state as like we have thought.

Also from a test done by Vitaly Kuznetsov, running a nested HyperV it was concluded that the first access to the SCONTROL MSR with a read resulted with the value of 0x1, aka HV_SYNIC_CONTROL_ENABLE.

It's important to note that this diverges from the value states in the HyperV TLFS of 0.

---
 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
target/i386/kvm.c +0 -0
index b8455c89ed..6a62e8ae94 100644

target/i386/kvm.c void kvm_arch_reset_vcpu(X86CPU *cpu) · line 1911

Quoted 8 lines
target/i386/kvm.c +2 -0
@@ -1904,6 +1904,8 @@ void kvm_arch_reset_vcpu(X86CPU *cpu)
 
     if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC)) {
         int i;
+
+        env->msr_hv_synic_control = HV_SYNIC_ENABLE;
         for (i = 0; i < ARRAY_SIZE(env->msr_hv_synic_sint); i++) {
             env->msr_hv_synic_sint[i] = HV_SINT_MASKED;
         }

Are both patches needed or only the Hyper-V one?

Paolo