Received: from eggs.gnu.org ([2001:4830:134:3::10]:42796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZpo-0007a5-7l for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:24:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMZpl-0004eF-1R for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:24:56 -0500 Received: from e06smtp08.uk.ibm.com ([195.75.94.104]:45235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZpk-0004e9-Oj for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:24:52 -0500 Received: from localhost by e06smtp08.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jan 2016 11:24:50 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 451031B08067 for ; Fri, 22 Jan 2016 11:24:53 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0MBOlGS9503222 for ; Fri, 22 Jan 2016 11:24:47 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0MAOmYt024919 for ; Fri, 22 Jan 2016 03:24:49 -0700 Date: Fri, 22 Jan 2016 12:24:43 +0100 From: Greg Kurz Message-ID: <20160122122443.6edc67b7@bahia.huguette.org> In-Reply-To: <1453396734-9363-9-git-send-email-clg@fr.ibm.com> References: <1453396734-9363-1-git-send-email-clg@fr.ibm.com> <1453396734-9363-9-git-send-email-clg@fr.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 8/9] ipmi: add ACPI power and GUID commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater Cc: Corey Minyard , qemu-devel@nongnu.org, Marcel Apfelbaum , "Michael S. Tsirkin" On Thu, 21 Jan 2016 18:18:53 +0100 C=C3=A9dric Le Goater wrote: > Signed-off-by: C=C3=A9dric Le Goater > --- >=20 > Changes since v1: > - added ACPI to command names. >=20 > hw/ipmi/ipmi_bmc_sim.c | 49 ++++++++++++++++++++++++++++++++++++++++++++= +++++ > 1 file changed, 49 insertions(+) >=20 > diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c > index e882af3f1b40..53c75cb21c1a 100644 > --- a/hw/ipmi/ipmi_bmc_sim.c > +++ b/hw/ipmi/ipmi_bmc_sim.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include "sysemu/sysemu.h" > #include "qemu/timer.h" > #include "hw/ipmi/ipmi.h" > #include "qemu/error-report.h" > @@ -51,6 +52,9 @@ > #define IPMI_CMD_GET_DEVICE_ID 0x01 > #define IPMI_CMD_COLD_RESET 0x02 > #define IPMI_CMD_WARM_RESET 0x03 > +#define IPMI_CMD_SET_ACPI_POWER_STATE 0x06 > +#define IPMI_CMD_GET_ACPI_POWER_STATE 0x07 > +#define IPMI_CMD_GET_DEVICE_GUID 0x08 > #define IPMI_CMD_RESET_WATCHDOG_TIMER 0x22 > #define IPMI_CMD_SET_WATCHDOG_TIMER 0x24 > #define IPMI_CMD_GET_WATCHDOG_TIMER 0x25 > @@ -200,6 +204,9 @@ struct IPMIBmcSim { >=20 > uint8_t restart_cause; >=20 > + uint8_t acpi_power_state[2]; > + uint8_t uuid[16]; > + > IPMISel sel; > IPMISdr sdr; > IPMISensor sensors[MAX_SENSORS]; > @@ -828,6 +835,36 @@ static void warm_reset(IPMIBmcSim *ibs, > k->reset(s, false); > } > } > +static void set_acpi_power_state(IPMIBmcSim *ibs, > + uint8_t *cmd, unsigned int cmd_len, > + uint8_t *rsp, unsigned int *rsp_len, > + unsigned int max_rsp_len) > +{ > + IPMI_CHECK_CMD_LEN(4); > + ibs->acpi_power_state[0] =3D cmd[2]; > + ibs->acpi_power_state[1] =3D cmd[3]; > +} > + > +static void get_acpi_power_state(IPMIBmcSim *ibs, > + uint8_t *cmd, unsigned int cmd_len, > + uint8_t *rsp, unsigned int *rsp_len, > + unsigned int max_rsp_len) > +{ > + IPMI_ADD_RSP_DATA(ibs->acpi_power_state[0]); > + IPMI_ADD_RSP_DATA(ibs->acpi_power_state[1]); > +} > + > +static void get_device_guid(IPMIBmcSim *ibs, > + uint8_t *cmd, unsigned int cmd_len, > + uint8_t *rsp, unsigned int *rsp_len, > + unsigned int max_rsp_len) > +{ > + unsigned int i; > + > + for (i =3D 0; i < 16; i++) { > + IPMI_ADD_RSP_DATA(ibs->uuid[i]); > + } > +} >=20 > static void set_bmc_global_enables(IPMIBmcSim *ibs, > uint8_t *cmd, unsigned int cmd_len, > @@ -1609,6 +1646,9 @@ static const IPMICmdHandler app_cmds[] =3D { > [IPMI_CMD_GET_DEVICE_ID] =3D get_device_id, > [IPMI_CMD_COLD_RESET] =3D cold_reset, > [IPMI_CMD_WARM_RESET] =3D warm_reset, > + [IPMI_CMD_SET_ACPI_POWER_STATE] =3D set_acpi_power_state, > + [IPMI_CMD_GET_ACPI_POWER_STATE] =3D get_acpi_power_state, > + [IPMI_CMD_GET_DEVICE_GUID] =3D get_device_guid, > [IPMI_CMD_SET_BMC_GLOBAL_ENABLES] =3D set_bmc_global_enables, > [IPMI_CMD_GET_BMC_GLOBAL_ENABLES] =3D get_bmc_global_enables, > [IPMI_CMD_CLR_MSG_FLAGS] =3D clr_msg_flags, > @@ -1734,6 +1774,15 @@ static void ipmi_sim_init(Object *obj) > i +=3D len; > } >=20 > + ibs->acpi_power_state[0] =3D 0; > + ibs->acpi_power_state[1] =3D 0; > + > + if (qemu_uuid_set) { > + memcpy(&ibs->uuid, qemu_uuid, 16); > + } else { > + memset(&ibs->uuid, 0, 16); > + } > + Sorry if this is a dumb question: why does the VM's UUID gets copied here ? > ipmi_init_sensors_from_sdrs(ibs); > register_cmds(ibs); >=20