Browse Source

ipmi: Fix watchdog NMI handling

The wrong logic was used for detection (so it wouldn't work at all)
and the wrong interface was used to inject the NMI if the detection
logic was correct.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Corey Minyard 6 năm trước cách đây
mục cha
commit
6af94767da
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 3 3
      hw/ipmi/ipmi.c
  2. 1 1
      hw/ipmi/ipmi_bmc_sim.c

+ 3 - 3
hw/ipmi/ipmi.c

@@ -28,9 +28,8 @@
 #include "qom/object_interfaces.h"
 #include "qom/object_interfaces.h"
 #include "sysemu/runstate.h"
 #include "sysemu/runstate.h"
 #include "qapi/error.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/visitor.h"
 #include "qemu/module.h"
 #include "qemu/module.h"
+#include "hw/nmi.h"
 
 
 static uint32_t ipmi_current_uuid = 1;
 static uint32_t ipmi_current_uuid = 1;
 
 
@@ -60,7 +59,8 @@ static int ipmi_do_hw_op(IPMIInterface *s, enum ipmi_op op, int checkonly)
         if (checkonly) {
         if (checkonly) {
             return 0;
             return 0;
         }
         }
-        qmp_inject_nmi(NULL);
+        /* We don't care what CPU we use. */
+        nmi_monitor_handle(0, NULL);
         return 0;
         return 0;
 
 
     case IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP:
     case IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP:

+ 1 - 1
hw/ipmi/ipmi_bmc_sim.c

@@ -1194,7 +1194,7 @@ static void set_watchdog_timer(IPMIBmcSim *ibs,
         break;
         break;
 
 
     case IPMI_BMC_WATCHDOG_PRE_NMI:
     case IPMI_BMC_WATCHDOG_PRE_NMI:
-        if (!k->do_hw_op(s, IPMI_SEND_NMI, 1)) {
+        if (k->do_hw_op(s, IPMI_SEND_NMI, 1)) {
             /* NMI not supported. */
             /* NMI not supported. */
             rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
             rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
             return;
             return;