mirror of https://github.com/xemu-project/xemu.git
i386: make hyperv_expand_features() return bool
Return 'false' when hyperv_expand_features() sets an error. No functional change intended. Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Message-Id: <20210608120817.1325125-5-vkuznets@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
07454e2ea8
commit
d7652b772f
|
@ -1220,12 +1220,12 @@ static uint32_t hv_build_cpuid_leaf(CPUState *cs, uint32_t func, int reg)
|
||||||
* of 'hv_passthrough' mode and fills the environment with all supported
|
* of 'hv_passthrough' mode and fills the environment with all supported
|
||||||
* Hyper-V features.
|
* Hyper-V features.
|
||||||
*/
|
*/
|
||||||
static void hyperv_expand_features(CPUState *cs, Error **errp)
|
static bool hyperv_expand_features(CPUState *cs, Error **errp)
|
||||||
{
|
{
|
||||||
X86CPU *cpu = X86_CPU(cs);
|
X86CPU *cpu = X86_CPU(cs);
|
||||||
|
|
||||||
if (!hyperv_enabled(cpu))
|
if (!hyperv_enabled(cpu))
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
if (cpu->hyperv_passthrough) {
|
if (cpu->hyperv_passthrough) {
|
||||||
cpu->hyperv_vendor_id[0] =
|
cpu->hyperv_vendor_id[0] =
|
||||||
|
@ -1273,49 +1273,49 @@ static void hyperv_expand_features(CPUState *cs, Error **errp)
|
||||||
|
|
||||||
/* Features */
|
/* Features */
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RELAXED, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RELAXED, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_VAPIC, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_VAPIC, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_TIME, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_TIME, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_CRASH, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_CRASH, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RESET, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RESET, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_VPINDEX, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_VPINDEX, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RUNTIME, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_RUNTIME, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_SYNIC, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_SYNIC, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_STIMER, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_STIMER, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_FREQUENCIES, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_FREQUENCIES, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_REENLIGHTENMENT, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_REENLIGHTENMENT, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_TLBFLUSH, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_TLBFLUSH, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_EVMCS, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_EVMCS, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_IPI, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_IPI, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_STIMER_DIRECT, errp)) {
|
if (hv_cpuid_check_and_set(cs, HYPERV_FEAT_STIMER_DIRECT, errp)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Additional dependencies not covered by kvm_hyperv_properties[] */
|
/* Additional dependencies not covered by kvm_hyperv_properties[] */
|
||||||
|
@ -1325,7 +1325,10 @@ static void hyperv_expand_features(CPUState *cs, Error **errp)
|
||||||
error_setg(errp, "Hyper-V %s requires Hyper-V %s",
|
error_setg(errp, "Hyper-V %s requires Hyper-V %s",
|
||||||
kvm_hyperv_properties[HYPERV_FEAT_SYNIC].desc,
|
kvm_hyperv_properties[HYPERV_FEAT_SYNIC].desc,
|
||||||
kvm_hyperv_properties[HYPERV_FEAT_VPINDEX].desc);
|
kvm_hyperv_properties[HYPERV_FEAT_VPINDEX].desc);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1591,8 +1594,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
||||||
env->apic_bus_freq = KVM_APIC_BUS_FREQUENCY;
|
env->apic_bus_freq = KVM_APIC_BUS_FREQUENCY;
|
||||||
|
|
||||||
/* Paravirtualization CPUIDs */
|
/* Paravirtualization CPUIDs */
|
||||||
hyperv_expand_features(cs, &local_err);
|
if (!hyperv_expand_features(cs, &local_err)) {
|
||||||
if (local_err) {
|
|
||||||
error_report_err(local_err);
|
error_report_err(local_err);
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue