On Mon, Mar 25, 2019 at 02:27:45PM +0530, Aravinda Prasad wrote:
> 
> 
> On Monday 25 March 2019 12:02 PM, David Gibson wrote:
> > On Fri, Mar 22, 2019 at 12:04:16PM +0530, Aravinda Prasad wrote:
> >> Enable the KVM capability KVM_CAP_PPC_FWNMI so that
> >> the KVM causes guest exit with NMI as exit reason
> >> when it encounters a machine check exception on the
> >> address belonging to a guest. Without this capability
> >> enabled, KVM redirects machine check exceptions to
> >> guest's 0x200 vector.
> >>
> >> Signed-off-by: Aravinda Prasad <aravi...@linux.vnet.ibm.com>
> >> ---
> >>  hw/ppc/spapr_rtas.c  |   15 +++++++++++++++
> >>  target/ppc/kvm.c     |   14 ++++++++++++++
> >>  target/ppc/kvm_ppc.h |    6 ++++++
> >>  3 files changed, 35 insertions(+)
> >>
> >> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> >> index fb594a4..939f428 100644
> >> --- a/hw/ppc/spapr_rtas.c
> >> +++ b/hw/ppc/spapr_rtas.c
> >> @@ -49,6 +49,7 @@
> >>  #include "hw/ppc/fdt.h"
> >>  #include "target/ppc/mmu-hash64.h"
> >>  #include "target/ppc/mmu-book3s-v3.h"
> >> +#include "kvm_ppc.h"
> >>  
> >>  static void rtas_display_character(PowerPCCPU *cpu, SpaprMachineState 
> >> *spapr,
> >>                                     uint32_t token, uint32_t nargs,
> >> @@ -354,6 +355,20 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu,
> >>                                    target_ulong args,
> >>                                    uint32_t nret, target_ulong rets)
> >>  {
> >> +    int ret;
> >> +
> >> +    ret = kvmppc_fwnmi_enable(cpu);
> >> +
> >> +    if (ret == 1) {
> >> +        rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
> > 
> > Urgh, we're here making a guest visible different to the environment
> > depending on a host (KVM) capability.  What happens if you start a
> > guest and it registers fwnmi support, then migrate it to a host that
> > lacks the necessary KVM support?
> 
> I just checked how such scenarios are handled for other KVM
> capabilities. Should I need to add an Spapr cap for this?

Yes, I think that's what we'll need to do.

-- 
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