summaryrefslogtreecommitdiff
path: root/target/i386/machine.c
diff options
context:
space:
mode:
authorRoman Kagan <rkagan@virtuozzo.com>2017-07-13 23:15:21 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-09-19 16:20:49 +0200
commit5e95381260e668a3a02aff5485401788b41b3050 (patch)
treed5c0aa8d42c9d6996a01b55db95352f6f1688c7e /target/i386/machine.c
parent6c69dfb67e84747cf071958594d939e845dfcc0c (diff)
downloadqemu-5e95381260e668a3a02aff5485401788b41b3050.tar.gz
hyperv: add header with protocol definitions
The definitions for Hyper-V emulation are currently taken from a header imported from the Linux kernel. However, as these describe a third-party protocol rather than a kernel API, it probably wasn't a good idea to publish it in the kernel uapi. This patch introduces a header that provides all the necessary definitions, superseding the one coming from the kernel. The new header supports (temporary) coexistence with the kernel one. The constants explicitly named in the Hyper-V specification (e.g. msr numbers) are defined in a non-conflicting way. Other constants and types have got new names. While at this, the protocol data structures are defined in a more conventional way, without bitfields, enums, and excessive unions. The code using this stuff is adjusted, too; it can now be built both with and without the kernel header in the tree. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Message-Id: <20170713201522.13765-2-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/machine.c')
-rw-r--r--target/i386/machine.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/target/i386/machine.c b/target/i386/machine.c
index eab33725a3..29cc58eda9 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -587,7 +587,7 @@ static bool hyperv_crash_enable_needed(void *opaque)
CPUX86State *env = &cpu->env;
int i;
- for (i = 0; i < HV_X64_MSR_CRASH_PARAMS; i++) {
+ for (i = 0; i < HV_CRASH_PARAMS; i++) {
if (env->msr_hv_crash_params[i]) {
return true;
}
@@ -601,8 +601,7 @@ static const VMStateDescription vmstate_msr_hyperv_crash = {
.minimum_version_id = 1,
.needed = hyperv_crash_enable_needed,
.fields = (VMStateField[]) {
- VMSTATE_UINT64_ARRAY(env.msr_hv_crash_params,
- X86CPU, HV_X64_MSR_CRASH_PARAMS),
+ VMSTATE_UINT64_ARRAY(env.msr_hv_crash_params, X86CPU, HV_CRASH_PARAMS),
VMSTATE_END_OF_LIST()
}
};
@@ -660,8 +659,7 @@ static const VMStateDescription vmstate_msr_hyperv_synic = {
VMSTATE_UINT64(env.msr_hv_synic_control, X86CPU),
VMSTATE_UINT64(env.msr_hv_synic_evt_page, X86CPU),
VMSTATE_UINT64(env.msr_hv_synic_msg_page, X86CPU),
- VMSTATE_UINT64_ARRAY(env.msr_hv_synic_sint, X86CPU,
- HV_SYNIC_SINT_COUNT),
+ VMSTATE_UINT64_ARRAY(env.msr_hv_synic_sint, X86CPU, HV_SINT_COUNT),
VMSTATE_END_OF_LIST()
}
};
@@ -686,10 +684,9 @@ static const VMStateDescription vmstate_msr_hyperv_stimer = {
.minimum_version_id = 1,
.needed = hyperv_stimer_enable_needed,
.fields = (VMStateField[]) {
- VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_config,
- X86CPU, HV_SYNIC_STIMER_COUNT),
- VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_count,
- X86CPU, HV_SYNIC_STIMER_COUNT),
+ VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_config, X86CPU,
+ HV_STIMER_COUNT),
+ VMSTATE_UINT64_ARRAY(env.msr_hv_stimer_count, X86CPU, HV_STIMER_COUNT),
VMSTATE_END_OF_LIST()
}
};