@samitouri / QOSamiQemu / commits / 6c21a067a7

hw/i386/hyperv: add stubs for synic enablement

Add a new call hyperv_enable_synic() that can be called whether or not CONFIG_HYPERV is enabled. This way genetic code in i396/kvm.c can call this function to enable synic for hyperv. For non-hyperv cases, the stub will be a noop. Reported-by: Michale Tokarev <mjt@tls.msk.ru> Signed-off-by: Ani Sinha <anisinha@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Tested-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20260319122137.142178-3-anisinha@redhat.com> Tested-by: Xudong Hao <xudong.hao@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Ani Sinha committed Mar 19, 2026 at 17:51 UTC 6c21a067a7e446c6c6c89c895c8f2cb574b09235
4 files changed +20 -7
target/i386/kvm/hyperv-stub.c
+5
@@ -61,3 +61,8 @@ uint64_t hyperv_syndbg_query_options(void)
61 {
62 return 0;
63 }
64 +
65 +int hyperv_enable_synic(X86CPU *cpu)
66 +{
67 + return 0;
68 +}
target/i386/kvm/hyperv.c
+9
@@ -24,6 +24,15 @@ int hyperv_x86_synic_add(X86CPU *cpu)
24 return 0;
25 }
26
27 +int hyperv_enable_synic(X86CPU *cpu)
28 +{
29 + int ret = 0;
30 + if (!hyperv_is_synic_enabled()) {
31 + ret = hyperv_x86_synic_add(cpu);
32 + }
33 + return ret;
34 +}
35 +
36 /*
37 * All devices possibly using SynIC have to be reset before calling this to let
38 * them remove their SINT routes first.
target/i386/kvm/hyperv.h
+1
@@ -23,6 +23,7 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit);
23 #endif
24
25 int hyperv_x86_synic_add(X86CPU *cpu);
26 +int hyperv_enable_synic(X86CPU *cpu);
27 void hyperv_x86_synic_reset(X86CPU *cpu);
28 void hyperv_x86_synic_update(X86CPU *cpu);
29
target/i386/kvm/kvm.c
+5 -7
@@ -1754,13 +1754,11 @@ static int hyperv_init_vcpu(X86CPU *cpu)
1754 return ret;
1755 }
1756
1757 - if (!hyperv_is_synic_enabled()) {
1758 - ret = hyperv_x86_synic_add(cpu);
1759 - if (ret < 0) {
1760 - error_report("failed to create HyperV SynIC: %s",
1761 - strerror(-ret));
1762 - return ret;
1763 - }
1757 + ret = hyperv_enable_synic(cpu);
1758 + if (ret < 0) {
1759 + error_report("failed to create HyperV SynIC: %s",
1760 + strerror(-ret));
1761 + return ret;
1762 }
1763 }
1764