Message ID | 159180946200.29090.1530776456251159527.stgit@bahia.lan (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | spapr: Improve error reporting in spapr_caps.c | expand |
10.06.2020 20:17, Greg Kurz wrote: > Nested KVM-HV only works on POWER9. Worth mention that existing usage of error_append_hint in the function is fixed too by this patch? > > Signed-off-by: Greg Kurz <groug@kaod.org> > --- > hw/ppc/spapr_caps.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c > index 0c3d3b64a508..05c8f70506ad 100644 > --- a/hw/ppc/spapr_caps.c > +++ b/hw/ppc/spapr_caps.c > @@ -408,6 +408,9 @@ static void cap_hpt_maxpagesize_cpu_apply(SpaprMachineState *spapr, > static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr, > uint8_t val, Error **errp) > { > + ERRP_AUTO_PROPAGATE(); > + PowerPCCPU *cpu = POWERPC_CPU(first_cpu); > + > if (!val) { > /* capability disabled by default */ > return; > @@ -417,6 +420,14 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr, > error_setg(errp, "No Nested KVM-HV support in TCG"); > error_append_hint(errp, "Try appending -machine cap-nested-hv=off"); > } else if (kvm_enabled()) { > + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, > + spapr->max_compat_pvr)) { > + error_setg(errp, "Nested KVM-HV only supported on POWER9"); > + error_append_hint(errp, > + "Try appending -machine max-cpu-compat=power9\n"); I think you should either add \n to all other hint in this function or drop this \n. > + return; > + } > + > if (!kvmppc_has_cap_nested_kvm_hv()) { > error_setg(errp, > "KVM implementation does not support Nested KVM-HV"); > >
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 0c3d3b64a508..05c8f70506ad 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -408,6 +408,9 @@ static void cap_hpt_maxpagesize_cpu_apply(SpaprMachineState *spapr, static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { + ERRP_AUTO_PROPAGATE(); + PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + if (!val) { /* capability disabled by default */ return; @@ -417,6 +420,14 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr, error_setg(errp, "No Nested KVM-HV support in TCG"); error_append_hint(errp, "Try appending -machine cap-nested-hv=off"); } else if (kvm_enabled()) { + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, + spapr->max_compat_pvr)) { + error_setg(errp, "Nested KVM-HV only supported on POWER9"); + error_append_hint(errp, + "Try appending -machine max-cpu-compat=power9\n"); + return; + } + if (!kvmppc_has_cap_nested_kvm_hv()) { error_setg(errp, "KVM implementation does not support Nested KVM-HV");
Nested KVM-HV only works on POWER9. Signed-off-by: Greg Kurz <groug@kaod.org> --- hw/ppc/spapr_caps.c | 11 +++++++++++ 1 file changed, 11 insertions(+)