From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WT8xh-000148-NA for qemu-devel@nongnu.org; Thu, 27 Mar 2014 07:59:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WT8xc-0001J3-Hw for qemu-devel@nongnu.org; Thu, 27 Mar 2014 07:59:09 -0400 Message-ID: <53341281.8090907@redhat.com> Date: Thu, 27 Mar 2014 12:58:57 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1395886880-11021-1-git-send-email-aik@ozlabs.ru> <1395886880-11021-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1395886880-11021-3-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] spapr: Define NMI interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, =?ISO-8859-15?Q?Andreas_F=E4rber?= Il 27/03/2014 03:21, Alexey Kardashevskiy ha scritto: > This defines and makes use of an NMI interface in order to support > the "nmi" command. > > Signed-off-by: Alexey Kardashevskiy > --- > hw/ppc/spapr.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 62ddb4d..495fa88 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -48,6 +48,7 @@ > #include "hw/pci/pci.h" > #include "hw/scsi/scsi.h" > #include "hw/virtio/virtio-scsi.h" > +#include "hw/nmi.h" > > #include "exec/address-spaces.h" > #include "hw/usb.h" > @@ -1539,13 +1540,36 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, > return NULL; > } > > +static void spapr_do_nmi(void *arg) > +{ > + CPUState *cs = arg; > + PowerPCCPU *cpu = POWERPC_CPU(cs); > + CPUPPCState *env = &cpu->env; > + > + cpu_synchronize_state(cs); > + env->spr[SPR_SRR0] = env->nip; > + env->spr[SPR_SRR1] = env->msr; > + env->nip = 0x100; > + env->msr = (1ULL << MSR_SF) | (1 << MSR_ME); > + if (env->spr[SPR_LPCR] & LPCR_ILE) { > + env->msr |= 1 << MSR_LE; > + } > +} I think an interface isn't the right tool here. You want a method in CPUClass, and you also should move the existing code for x86 and s390 to target-i386 and target-s390. Paolo