From patchwork Tue Dec 22 16:53:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 58941 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3358295lbb; Tue, 22 Dec 2015 09:03:31 -0800 (PST) X-Received: by 10.55.72.3 with SMTP id v3mr33811952qka.107.1450803811059; Tue, 22 Dec 2015 09:03:31 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j66si35215004qhd.63.2015.12.22.09.03.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 22 Dec 2015 09:03:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:51755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQLS-0005QM-Ic for patch@linaro.org; Tue, 22 Dec 2015 12:03:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQC5-0006st-K0 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:53:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBQC4-0000of-Qd for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:53:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQC4-0000ob-L8 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:53:48 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 3BCE28EA48; Tue, 22 Dec 2015 16:53:48 +0000 (UTC) Received: from redhat.com (vpn1-5-205.ams2.redhat.com [10.36.5.205]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id tBMGrk3I012844; Tue, 22 Dec 2015 11:53:47 -0500 Date: Tue, 22 Dec 2015 18:53:46 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1450803119-4223-24-git-send-email-mst@redhat.com> References: <1450803119-4223-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1450803119-4223-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Corey Minyard Subject: [Qemu-devel] [PULL 23/55] ipmi: Add a force off function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Corey Minyard Allow the IPMI interface to request a forced power off. Signed-off-by: Corey Minyard Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/ipmi/ipmi_bmc_extern.c | 6 ++++++ 1 file changed, 6 insertions(+) -- MST diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index 05b9121..56073b3 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -30,6 +30,7 @@ #include #include "qemu/timer.h" #include "sysemu/char.h" +#include "sysemu/sysemu.h" #include "hw/ipmi/ipmi.h" #define VM_MSG_CHAR 0xA0 /* Marks end of message */ @@ -52,6 +53,7 @@ #define VM_CAPABILITIES_IRQ 0x04 #define VM_CAPABILITIES_NMI 0x08 #define VM_CAPABILITIES_ATTN 0x10 +#define VM_CMD_FORCEOFF 0x09 #define TYPE_IPMI_BMC_EXTERN "ipmi-bmc-extern" #define IPMI_BMC_EXTERN(obj) OBJECT_CHECK(IPMIBmcExtern, (obj), \ @@ -268,6 +270,10 @@ static void handle_hw_op(IPMIBmcExtern *ibe, unsigned char hw_op) case VM_CMD_SEND_NMI: k->do_hw_op(s, IPMI_SEND_NMI, 0); break; + + case VM_CMD_FORCEOFF: + qemu_system_shutdown_request(); + break; } }