From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v4 4/4] target-ppc: Add support for new nmi_monitor_handler() CPU callback
Date: Thu, 5 Jun 2014 00:26:01 +1000 [thread overview]
Message-ID: <1401891961-17292-5-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1401891961-17292-1-git-send-email-aik@ozlabs.ru>
This defines a nmi_monitor_handler() callback for POWERPC CPU class so
the "nmi" HMP/QMP command gets supported for POWERPC machines.
This calls POWERPC_EXCP_RESET (vector 0x100) in the guest to deliver NMI.
The expected result is XMON (in-kernel debugger) invocation.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v4:
* s/\<nmi\>/nmi_monitor_handler/
* added note about XMON into commit log
v3:
* ppc_cpu_do_nmi() is exported from excp_helper.c instead of powerpc_excp()
---
target-ppc/cpu-qom.h | 1 +
target-ppc/excp_helper.c | 8 ++++++++
target-ppc/translate_init.c | 17 +++++++++++++++++
3 files changed, 26 insertions(+)
diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index 47dc8e6..fe7d602 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -119,6 +119,7 @@ int ppc64_cpu_write_elf64_qemunote(WriteCoreDumpFunction f,
int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
int cpuid, void *opaque);
#ifndef CONFIG_USER_ONLY
+void ppc_cpu_do_nmi(CPUState *cs);
extern const struct VMStateDescription vmstate_ppc_cpu;
#endif
diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index a0c9fdc..11c23e7 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -801,6 +801,14 @@ void ppc_hw_interrupt(CPUPPCState *env)
}
}
}
+
+void ppc_cpu_do_nmi(CPUState *cs)
+{
+ PowerPCCPU *cpu = POWERPC_CPU(cs);
+ CPUPPCState *env = &cpu->env;
+
+ powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_RESET);
+}
#endif /* !CONFIG_USER_ONLY */
#if defined(DEBUG_OP)
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 4d94015..72bdce3 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8510,6 +8510,22 @@ static void ppc_cpu_initfn(Object *obj)
}
}
+#ifndef CONFIG_USER_ONLY
+static void ppc_cpu_do_nmi_on_cpu(void *arg)
+{
+ CPUState *cs = arg;
+
+ cpu_synchronize_state(cs);
+ ppc_cpu_do_nmi(cs);
+}
+
+static int ppc_cpu_nmi_monitor_handler(CPUState *cs)
+{
+ async_run_on_cpu(cs, ppc_cpu_do_nmi_on_cpu, cs);
+ return 0;
+}
+#endif
+
static void ppc_cpu_class_init(ObjectClass *oc, void *data)
{
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
@@ -8536,6 +8552,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
#ifdef CONFIG_USER_ONLY
cc->handle_mmu_fault = ppc_cpu_handle_mmu_fault;
#else
+ cc->nmi_monitor_handler = ppc_cpu_nmi_monitor_handler;
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
cc->vmsd = &vmstate_ppc_cpu;
#if defined(TARGET_PPC64)
--
2.0.0
prev parent reply other threads:[~2014-06-04 14:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 14:25 [Qemu-devel] [PATCH v4 0/4] cpus: Add generic "nmi" monitor command support Alexey Kardashevskiy
2014-06-04 14:25 ` [Qemu-devel] [PATCH v4 1/4] cpus: Define callback for QEMU "nmi" command Alexey Kardashevskiy
2014-06-04 18:10 ` Eric Blake
2014-06-04 23:36 ` Alexey Kardashevskiy
2014-06-05 9:54 ` Peter Maydell
2014-06-04 14:25 ` [Qemu-devel] [PATCH v4 2/4] target-s390x: Migrate to new nmi_monitor_handler() CPU callback Alexey Kardashevskiy
2014-06-04 14:37 ` Cornelia Huck
2014-06-04 14:26 ` [Qemu-devel] [PATCH v4 3/4] target-i386: " Alexey Kardashevskiy
2014-06-04 14:26 ` Alexey Kardashevskiy [this message]
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=1401891961-17292-5-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).