qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 04/13] ppc/spapr: Disable FWNMI capability if KVM does no


From: David Gibson
Subject: Re: [RFC PATCH 04/13] ppc/spapr: Disable FWNMI capability if KVM does not support it
Date: Wed, 4 Mar 2020 16:57:43 +1100

On Wed, Mar 04, 2020 at 03:28:41PM +1000, Nicholas Piggin wrote:
> This is a fatal error if KVM does not support this capability, so try to
> disable it if that's the case.

Nack.

Changing the guest visible environment based on host capabilities
totally breaks the migration model.  If the user has requested an
environment the host can't provide, we have to outright fail instead.

> 
> Signed-off-by: Nicholas Piggin <address@hidden>
> ---
>  hw/ppc/spapr_caps.c  | 7 ++++++-
>  target/ppc/kvm.c     | 7 +++++++
>  target/ppc/kvm_ppc.h | 6 ++++++
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index 10864c7eed..d3465871a4 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -522,7 +522,8 @@ static void cap_fwnmi_apply(SpaprMachineState *spapr, 
> uint8_t val,
>      } else if (kvm_enabled()) {
>          if (kvmppc_set_fwnmi() < 0) {
>              error_setg(errp, "Firmware Assisted Non-Maskable 
> Interrupts(FWNMI) "
> -                             "not supported by KVM.");
> +                             "not supported by KVM, "
> +                             "try appending -machine cap-fwnmi=off");
>          }
>      }
>  }
> @@ -647,6 +648,10 @@ static SpaprCapabilities 
> default_caps_with_cpu(SpaprMachineState *spapr,
>  
>      if (tcg_enabled()) {
>          caps.caps[SPAPR_CAP_FWNMI] = SPAPR_CAP_OFF;
> +    } else if (kvm_enabled()) {
> +        if (!kvmppc_get_fwnmi()) {
> +            caps.caps[SPAPR_CAP_FWNMI] = SPAPR_CAP_OFF;
> +        }
>      }
>  
>      if (!ppc_type_check_compat(cputype, CPU_POWERPC_LOGICAL_3_00,
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 7f44b1aa1a..718a5f6e1f 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -88,6 +88,7 @@ static int cap_ppc_safe_indirect_branch;
>  static int cap_ppc_count_cache_flush_assist;
>  static int cap_ppc_nested_kvm_hv;
>  static int cap_large_decr;
> +static int cap_fwnmi;
>  
>  static uint32_t debug_inst_opcode;
>  
> @@ -136,6 +137,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>      kvmppc_get_cpu_characteristics(s);
>      cap_ppc_nested_kvm_hv = kvm_vm_check_extension(s, KVM_CAP_PPC_NESTED_HV);
>      cap_large_decr = kvmppc_get_dec_bits();
> +    cap_fwnmi = kvm_vm_check_extension(s, KVM_CAP_PPC_FWNMI);
>      /*
>       * Note: setting it to false because there is not such capability
>       * in KVM at this moment.
> @@ -2064,6 +2066,11 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int 
> mpic_proxy)
>      }
>  }
>  
> +bool kvmppc_get_fwnmi(void)
> +{
> +    return cap_fwnmi;
> +}
> +
>  int kvmppc_set_fwnmi(void)
>  {
>      PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index 9e4f2357cc..faa72c236f 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -27,6 +27,7 @@ void kvmppc_enable_h_page_init(void);
>  void kvmppc_set_papr(PowerPCCPU *cpu);
>  int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
>  void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
> +bool kvmppc_get_fwnmi(void);
>  int kvmppc_set_fwnmi(void);
>  int kvmppc_smt_threads(void);
>  void kvmppc_error_append_smt_possible_hint(Error *const *errp);
> @@ -163,6 +164,11 @@ static inline void kvmppc_set_mpic_proxy(PowerPCCPU 
> *cpu, int mpic_proxy)
>  {
>  }
>  
> +static inline bool kvmppc_get_fwnmi(void)
> +{
> +    return false;
> +}
> +
>  static inline int kvmppc_set_fwnmi(void)
>  {
>      return -1;

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]