From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: "Alex Bligh" <alex@alex.org.uk>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Markus Armbruster" <armbru@redhat.com>,
"Alexander Graf" <agraf@suse.de>,
"Luiz Capitulino" <lcapitulino@redhat.com>,
qemu-ppc@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Cornelia Huck" <cornelia.huck@de.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v3 2/4] target-s390x: Migrate to new nmi() CPU callback
Date: Wed, 4 Jun 2014 18:08:48 +1000 [thread overview]
Message-ID: <1401869330-32449-3-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1401869330-32449-1-git-send-email-aik@ozlabs.ru>
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 <aik@ozlabs.ru>
---
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
next prev parent reply other threads:[~2014-06-04 8:09 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 8:08 [Qemu-devel] [PATCH v3 0/4] cpus: Add generic NMI support Alexey Kardashevskiy
2014-06-04 8:08 ` [Qemu-devel] [PATCH v3 1/4] cpus: Define NMI callback Alexey Kardashevskiy
2014-06-10 13:39 ` Luiz Capitulino
2014-06-10 14:41 ` Cornelia Huck
2014-06-10 14:48 ` Luiz Capitulino
2014-06-10 16:29 ` Paolo Bonzini
2014-06-10 18:09 ` Alexander Graf
2014-06-11 0:12 ` Alexey Kardashevskiy
2014-06-11 0:21 ` Alexander Graf
2014-06-11 0:23 ` Peter Maydell
2014-06-11 0:28 ` Alexander Graf
2014-06-11 4:59 ` Paolo Bonzini
2014-06-11 8:01 ` Alexander Graf
2014-06-11 8:27 ` Paolo Bonzini
2014-06-11 8:29 ` Alexander Graf
2014-06-11 8:37 ` Paolo Bonzini
2014-06-11 8:42 ` Alexander Graf
2014-06-11 10:47 ` Paolo Bonzini
2014-06-11 10:59 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2014-06-11 12:04 ` [Qemu-devel] " Alexander Graf
2014-06-11 9:04 ` Alexey Kardashevskiy
2014-06-11 9:19 ` Alexander Graf
2014-06-11 13:10 ` Luiz Capitulino
2014-06-11 13:36 ` Cornelia Huck
2014-06-11 13:42 ` Luiz Capitulino
2014-06-11 6:50 ` Alexey Kardashevskiy
2014-06-11 7:57 ` Paolo Bonzini
2014-06-11 8:38 ` Cornelia Huck
2014-06-11 9:18 ` Cornelia Huck
2014-06-10 15:13 ` Eric Blake
2014-06-10 15:40 ` Alexey Kardashevskiy
2014-06-11 12:50 ` Luiz Capitulino
2014-06-04 8:08 ` Alexey Kardashevskiy [this message]
2014-06-04 8:08 ` [Qemu-devel] [PATCH v3 3/4] target-i386: Migrate to new nmi() CPU callback Alexey Kardashevskiy
2014-06-04 8:08 ` [Qemu-devel] [PATCH v3 4/4] target-ppc: Add support for " Alexey Kardashevskiy
2014-06-04 9:11 ` [Qemu-devel] [PATCH v3 0/4] cpus: Add generic NMI support Paolo Bonzini
2014-06-04 9:16 ` Peter Maydell
2014-06-04 9:30 ` Alexey Kardashevskiy
2014-06-04 9:33 ` Peter Maydell
2014-06-04 9:38 ` Alexander Graf
2014-06-04 9:39 ` Alexey Kardashevskiy
2014-06-04 9:39 ` Paolo Bonzini
2014-06-04 9:47 ` Peter Maydell
2014-06-04 9:50 ` Alexander Graf
2014-06-04 10:44 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-06-04 10:51 ` Cornelia Huck
2014-06-04 11:34 ` [Qemu-devel] " Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401869330-32449-3-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=alex@alex.org.uk \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).