From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws6G6-0006ob-S2 for qemu-devel@nongnu.org; Wed, 04 Jun 2014 04:09:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ws6Ft-0005q0-AL for qemu-devel@nongnu.org; Wed, 04 Jun 2014 04:09:18 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:42338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws6Fs-0005nm-Iz for qemu-devel@nongnu.org; Wed, 04 Jun 2014 04:09:05 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jun 2014 18:08:59 +1000 From: Alexey Kardashevskiy Date: Wed, 4 Jun 2014 18:08:48 +1000 Message-Id: <1401869330-32449-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1401869330-32449-1-git-send-email-aik@ozlabs.ru> References: <1401869330-32449-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v3 2/4] target-s390x: Migrate to new nmi() CPU callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alex Bligh , Alexey Kardashevskiy , Markus Armbruster , Alexander Graf , Luiz Capitulino , qemu-ppc@nongnu.org, Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Richard Henderson This defines a nmi() callback for s390 CPU class. This removes #ifdef s390 branch in qmp_inject_nmi so new s390's nmi() callback is going to be used for NMI. Since nmi()-calling code is platform independent, CPUState::cpu_index is used instead of S390CPU::env.cpu_num. There should not be any change in behaviour as both @cpu_index and @cpu_num are global CPU numbers. Also, s390_cpu_restart() takes care of preforming operations in the specific CPU thread so no extra measure is required here either. Signed-off-by: Alexey Kardashevskiy --- Changes: v3: * now contains both old code removal and new code insertion, easier to track changes --- Is there any good reason to have @cpu_num in addition to @cpu_index? Just asking :) --- cpus.c | 14 -------------- target-s390x/cpu.c | 6 ++++++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/cpus.c b/cpus.c index a000bd8..83223d3 100644 --- a/cpus.c +++ b/cpus.c @@ -1480,20 +1480,6 @@ void qmp_inject_nmi(Error **errp) apic_deliver_nmi(cpu->apic_state); } } -#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; - } - } #else CPUState *cs = qemu_get_cpu(monitor_get_cpu_index()); CPUClass *cc = CPU_GET_CLASS(cs); diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index c3082b7..2d50f80 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -160,6 +160,11 @@ static void s390_cpu_full_reset(CPUState *s) tlb_flush(s, 1); } +static int s390_cpu_nmi(CPUState *cs) +{ + return s390_cpu_restart(S390_CPU(cs)); +} + #if !defined(CONFIG_USER_ONLY) static void s390_cpu_machine_reset_cb(void *opaque) { @@ -245,6 +250,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) scc->cpu_reset = s390_cpu_reset; scc->initial_cpu_reset = s390_cpu_initial_reset; cc->reset = s390_cpu_full_reset; + cc->nmi = s390_cpu_nmi; cc->has_work = s390_cpu_has_work; cc->do_interrupt = s390_cpu_do_interrupt; cc->dump_state = s390_cpu_dump_state; -- 2.0.0