From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6h6B-0007FW-AY for qemu-devel@nongnu.org; Thu, 22 Sep 2011 07:05:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6h6A-0002tu-1j for qemu-devel@nongnu.org; Thu, 22 Sep 2011 07:05:47 -0400 Received: from [222.73.24.84] (port=51551 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6h5s-0002qO-Cu for qemu-devel@nongnu.org; Thu, 22 Sep 2011 07:05:46 -0400 Message-ID: <4E7B04DC.1030407@cn.fujitsu.com> Date: Thu, 22 Sep 2011 17:50:20 +0800 From: Lai Jiangshan MIME-Version: 1.0 References: <20110913093835.GB4265@localhost.localdomain> <20110914093441.e2bb305c.kamezawa.hiroyu@jp.fujitsu.com> <4E705BC3.5000508@cn.fujitsu.com> <20110915164704.9cacd407.kamezawa.hiroyu@jp.fujitsu.com> <4E71B28F.7030201@cn.fujitsu.com> <4E72F3BA.2000603@jp.fujitsu.com> <4E73200A.7040908@jp.fujitsu.com> <4E76C6AA.9080403@cn.fujitsu.com> In-Reply-To: <4E76C6AA.9080403@cn.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH] qemu: Fix inject-nmi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity , Anthony Liguori , "qemu-devel@nongnu.org" Cc: "kvm@vger.kernel.org" , KAMEZAWA Hiroyuki , Kenji Kaneshige From: KAMEZAWA Hiroyuki 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