qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 5/5] cpus: Enable nmi() callback use


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v2 5/5] cpus: Enable nmi() callback use
Date: Mon, 31 Mar 2014 14:47:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130910 Thunderbird/17.0.9

On 03/28/2014 01:51 PM, Alexey Kardashevskiy wrote:
Signed-off-by: Alexey Kardashevskiy <address@hidden>

Missing patch description.

Also, this patch should be among the first in your patch set. It makes review a lot easier on code movements like this when you always remove and add back the same code inside the same patch. So you'd keep the #ifdef's here, then slowly move x86 and s390 over to QMP functions.

Apart from the missing QMP description patch I think this patch set makes sense. But please verify that x86 and s390x NMIs still work.


Alex

---
  cpus.c | 33 +++++++--------------------------
  1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/cpus.c b/cpus.c
index 1104d61..2c8d620 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1469,33 +1469,14 @@ exit:
void qmp_inject_nmi(Error **errp)
  {
-#if defined(TARGET_I386)
-    CPUState *cs;
+    CPUState *cs = qemu_get_cpu(monitor_get_cpu_index());
+    CPUClass *cc = CPU_GET_CLASS(cs);
+    int ret = -1;
- 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);
-        }
+    if (cs && cc->nmi) {
+        ret = cc->nmi(cs);
      }
-#elif defined(TARGET_S390X)
-    CPUState *cs;
-    S390CPU *cpu;
-
-    CPU_FOREACH(cs) {
-        cpu = S390_CPU(cs);
-        if (cpu->env.cpu_num == monitor_get_cpu_index()) {
-            if (s390_cpu_restart(S390_CPU(cs)) == -1) {
-                error_set(errp, QERR_UNSUPPORTED);
-                return;
-            }
-            break;
-        }
+    if (ret) {
+        error_set(errp, QERR_UNSUPPORTED);
      }
-#else
-    error_set(errp, QERR_UNSUPPORTED);
-#endif
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]