From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUbcO-0006Zz-SF for qemu-devel@nongnu.org; Mon, 31 Mar 2014 08:47:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUbcI-0005N9-KL for qemu-devel@nongnu.org; Mon, 31 Mar 2014 08:47:12 -0400 Message-ID: <533963C9.1080409@suse.de> Date: Mon, 31 Mar 2014 14:47:05 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1396011112-23559-1-git-send-email-aik@ozlabs.ru> <1396011112-23559-6-git-send-email-aik@ozlabs.ru> In-Reply-To: <1396011112-23559-6-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 5/5] cpus: Enable nmi() callback use List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Paolo Bonzini , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Thomas Huth On 03/28/2014 01:51 PM, Alexey Kardashevskiy wrote: > Signed-off-by: Alexey Kardashevskiy Missing patch description. Also, this patch should be among the first in your patch set. It makes review a lot easier on code movements like this when you always remove and add back the same code inside the same patch. So you'd keep the #ifdef's here, then slowly move x86 and s390 over to QMP functions. Apart from the missing QMP description patch I think this patch set makes sense. But please verify that x86 and s390x NMIs still work. Alex > --- > cpus.c | 33 +++++++-------------------------- > 1 file changed, 7 insertions(+), 26 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 1104d61..2c8d620 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -1469,33 +1469,14 @@ exit: > > void qmp_inject_nmi(Error **errp) > { > -#if defined(TARGET_I386) > - CPUState *cs; > + CPUState *cs = qemu_get_cpu(monitor_get_cpu_index()); > + CPUClass *cc = CPU_GET_CLASS(cs); > + int ret = -1; > > - CPU_FOREACH(cs) { > - X86CPU *cpu = X86_CPU(cs); > - > - if (!cpu->apic_state) { > - cpu_interrupt(cs, CPU_INTERRUPT_NMI); > - } else { > - apic_deliver_nmi(cpu->apic_state); > - } > + if (cs && cc->nmi) { > + ret = cc->nmi(cs); > } > -#elif defined(TARGET_S390X) > - CPUState *cs; > - S390CPU *cpu; > - > - CPU_FOREACH(cs) { > - cpu = S390_CPU(cs); > - if (cpu->env.cpu_num == monitor_get_cpu_index()) { > - if (s390_cpu_restart(S390_CPU(cs)) == -1) { > - error_set(errp, QERR_UNSUPPORTED); > - return; > - } > - break; > - } > + if (ret) { > + error_set(errp, QERR_UNSUPPORTED); > } > -#else > - error_set(errp, QERR_UNSUPPORTED); > -#endif > }