From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: "Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 2/2] spapr: Define NMI interface
Date: Thu, 27 Mar 2014 13:21:20 +1100 [thread overview]
Message-ID: <1395886880-11021-3-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1395886880-11021-1-git-send-email-aik@ozlabs.ru>
This defines and makes use of an NMI interface in order to support
the "nmi" command.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
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;
+ }
+}
+
+void spapr_deliver_nmi(NMIObj *p, CPUState *cs)
+{
+ async_run_on_cpu(cs, spapr_do_nmi, cs);
+}
+
static void spapr_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
+ NMIClass *nmic = NMI_CLASS(oc);
mc->qemu_machine = data;
fwc->get_dev_path = spapr_get_fw_dev_path;
+ nmic->deliver_nmi = spapr_deliver_nmi;
}
static const TypeInfo spapr_machine_info = {
@@ -1555,10 +1579,12 @@ static const TypeInfo spapr_machine_info = {
.class_data = &spapr_machine,
.interfaces = (InterfaceInfo[]) {
{ TYPE_FW_PATH_PROVIDER },
+ { TYPE_NMI },
{ }
},
};
+
static void spapr_machine_register_types(void)
{
type_register_static(&spapr_machine_info);
--
1.8.4.rc4
next prev parent reply other threads:[~2014-03-27 2:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 2:21 [Qemu-devel] [PATCH 0/2] nmi: add interface Alexey Kardashevskiy
2014-03-27 2:21 ` [Qemu-devel] [PATCH 1/2] spapr: Add NMI interface Alexey Kardashevskiy
2014-03-27 2:21 ` Alexey Kardashevskiy [this message]
2014-03-27 11:58 ` [Qemu-devel] [PATCH 2/2] spapr: Define " Paolo Bonzini
2014-03-27 13:14 ` Alexey Kardashevskiy
2014-03-27 14:06 ` Paolo Bonzini
2014-03-27 13:54 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
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=1395886880-11021-3-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=afaerber@suse.de \
--cc=pbonzini@redhat.com \
--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).