diff mbox series

[01/15] ipmi: Fix watchdog NMI handling

Message ID 20190919213924.31852-2-minyard@acm.org
State New
Headers show
Series [01/15] ipmi: Fix watchdog NMI handling | expand

Commit Message

Corey Minyard Sept. 19, 2019, 9:39 p.m. UTC
From: Corey Minyard <cminyard@mvista.com>

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>
---
 hw/ipmi/ipmi.c         | 6 +++---
 hw/ipmi/ipmi_bmc_sim.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Cédric Le Goater Sept. 20, 2019, 3:45 p.m. UTC | #1
On 19/09/2019 23:39, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
> 
> 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>

C.

> ---
>  hw/ipmi/ipmi.c         | 6 +++---
>  hw/ipmi/ipmi_bmc_sim.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
> index 136c86b7a7..cbe158f815 100644
> --- a/hw/ipmi/ipmi.c
> +++ b/hw/ipmi/ipmi.c
> @@ -28,9 +28,8 @@
>  #include "qom/object_interfaces.h"
>  #include "sysemu/runstate.h"
>  #include "qapi/error.h"
> -#include "qapi/qapi-commands-misc.h"
> -#include "qapi/visitor.h"
>  #include "qemu/module.h"
> +#include "hw/nmi.h"
>  
>  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) {
>              return 0;
>          }
> -        qmp_inject_nmi(NULL);
> +        /* We don't care what CPU we use. */
> +        nmi_monitor_handle(0, NULL);
>          return 0;
>  
>      case IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP:
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index 246a6d390c..8f63bb7181 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -1194,7 +1194,7 @@ static void set_watchdog_timer(IPMIBmcSim *ibs,
>          break;
>  
>      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. */
>              rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
>              return;
>
diff mbox series

Patch

diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
index 136c86b7a7..cbe158f815 100644
--- a/hw/ipmi/ipmi.c
+++ b/hw/ipmi/ipmi.c
@@ -28,9 +28,8 @@ 
 #include "qom/object_interfaces.h"
 #include "sysemu/runstate.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/visitor.h"
 #include "qemu/module.h"
+#include "hw/nmi.h"
 
 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) {
             return 0;
         }
-        qmp_inject_nmi(NULL);
+        /* We don't care what CPU we use. */
+        nmi_monitor_handle(0, NULL);
         return 0;
 
     case IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP:
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 246a6d390c..8f63bb7181 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -1194,7 +1194,7 @@  static void set_watchdog_timer(IPMIBmcSim *ibs,
         break;
 
     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. */
             rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
             return;