[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/24] target-i386: add a generic x86 nmi handler
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 22/24] target-i386: add a generic x86 nmi handler |
Date: |
Mon, 23 May 2016 17:09:57 +0200 |
From: Bandan Das <address@hidden>
Instead of having x86 ifdefs in core nmi code, this
change adds a arch specific handler that the nmi common
code can call.
Signed-off-by: Bandan Das <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/pc.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 99437e0..e29ccc8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -67,6 +67,7 @@
#include "qapi/visitor.h"
#include "qapi-visit.h"
#include "qom/cpu.h"
+#include "hw/nmi.h"
/* debug PC/ISA interrupts */
//#define DEBUG_IRQ
@@ -1963,11 +1964,28 @@ static CPUArchIdList
*pc_possible_cpu_arch_ids(MachineState *machine)
return list;
}
+static void x86_nmi(NMIState *n, int cpu_index, Error **errp)
+{
+ /* cpu index isn't used */
+ CPUState *cs;
+
+ 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);
+ }
+ }
+}
+
static void pc_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
+ NMIClass *nc = NMI_CLASS(oc);
pcmc->get_hotplug_handler = mc->get_hotplug_handler;
pcmc->pci_enabled = true;
@@ -1993,6 +2011,7 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
hc->plug = pc_machine_device_plug_cb;
hc->unplug_request = pc_machine_device_unplug_request_cb;
hc->unplug = pc_machine_device_unplug_cb;
+ nc->nmi_monitor_handler = x86_nmi;
}
static const TypeInfo pc_machine_info = {
@@ -2005,6 +2024,7 @@ static const TypeInfo pc_machine_info = {
.class_init = pc_machine_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_HOTPLUG_HANDLER },
+ { TYPE_NMI },
{ }
},
};
--
1.8.3.1
- [Qemu-devel] [PULL 15/24] Remove config-devices.mak on 'make clean', (continued)
- [Qemu-devel] [PULL 15/24] Remove config-devices.mak on 'make clean', Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 14/24] cpus.c: Use pthread_sigmask() rather than sigprocmask(), Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 23/24] nmi: remove x86 specific nmi handling, Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 19/24] esp: check dma length before reading scsi command(CVE-2016-4441), Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 12/24] memory: Drop FlatRange.romd_mode, Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 17/24] scripts/signrom.py: Check for magic in option ROMs., Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 11/24] memory: Remove code for mr->may_overlap, Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 16/24] scripts/signrom.py: Allow option ROM checksum script to write the size header., Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 24/24] cpus: call the core nmi injection function, Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 20/24] iscsi: pass SCSI status back for SG_IO, Paolo Bonzini, 2016/05/23
- [Qemu-devel] [PULL 22/24] target-i386: add a generic x86 nmi handler,
Paolo Bonzini <=
- [Qemu-devel] [PULL 21/24] coccinelle: add g_assert_cmp* to macro file, Paolo Bonzini, 2016/05/23
- Re: [Qemu-devel] [PULL 00/24] Misc patches for 2016-05-23, Peter Maydell, 2016/05/23