[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] qemu: Fix inject-nmi
From: |
Lai Jiangshan |
Subject: |
[Qemu-devel] [PATCH] qemu: Fix inject-nmi |
Date: |
Thu, 22 Sep 2011 17:50:20 +0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4 |
From: KAMEZAWA Hiroyuki <address@hidden>
Subject: [PATCH] Fix inject-nmi
Now, inject-nmi sends NMI to all cpus...but this doesn't emulate
pc hardware 'NMI button', which triggers LINT1.
So, now, LINT1 mask is ignored by inject-nmi and NMIs are sent to
all cpus without checking LINT1 mask.
Because Linux masks LINT1 of cpus other than 0, this makes trouble.
For example, kdump cannot run sometimes.
---
hw/apic.c | 7 +++++++
hw/apic.h | 1 +
monitor.c | 4 ++--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/apic.c b/hw/apic.c
index 69d6ac5..020305b 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -205,6 +205,13 @@ void apic_deliver_pic_intr(DeviceState *d, int level)
}
}
+void apic_deliver_lint1_intr(DeviceState *d)
+{
+ APICState *s = DO_UPCAST(APICState, busdev.qdev, d);
+
+ apic_local_deliver(s, APIC_LVT_LINT1);
+}
+
#define foreach_apic(apic, deliver_bitmask, code) \
{\
int __i, __j, __mask;\
diff --git a/hw/apic.h b/hw/apic.h
index c857d52..7ccf214 100644
--- a/hw/apic.h
+++ b/hw/apic.h
@@ -10,6 +10,7 @@ void apic_deliver_irq(uint8_t dest, uint8_t dest_mode,
uint8_t trigger_mode);
int apic_accept_pic_intr(DeviceState *s);
void apic_deliver_pic_intr(DeviceState *s, int level);
+void apic_deliver_lint1_intr(DeviceState *s);
int apic_get_interrupt(DeviceState *s);
void apic_reset_irq_delivered(void);
int apic_get_irq_delivered(void);
diff --git a/monitor.c b/monitor.c
index cb485bf..d740478 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2614,9 +2614,9 @@ static void do_wav_capture(Monitor *mon, const QDict
*qdict)
static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
CPUState *env;
-
+ /* This emulates hardware NMI button. So, trigger LINT1 */
for (env = first_cpu; env != NULL; env = env->next_cpu) {
- cpu_interrupt(env, CPU_INTERRUPT_NMI);
+ apic_deliver_lint1_intr(env->apic_state);
}
return 0;
-- 1.7.4.1
- [Qemu-devel] [PATCH] qemu: Fix inject-nmi,
Lai Jiangshan <=