All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@fr.ibm.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: Corey Minyard <cminyard@mvista.com>,
	qemu-devel@nongnu.org,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 8/9] ipmi: add ACPI power and GUID commands
Date: Fri, 22 Jan 2016 12:58:06 +0100	[thread overview]
Message-ID: <56A2194E.6050208@fr.ibm.com> (raw)
In-Reply-To: <20160122122443.6edc67b7@bahia.huguette.org>

On 01/22/2016 12:24 PM, Greg Kurz wrote:
> On Thu, 21 Jan 2016 18:18:53 +0100
> Cédric Le Goater <clg@fr.ibm.com> wrote:
> 
>> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
>> ---
>>
>> Changes since v1:
>>  - added ACPI to command names.
>>
>>  hw/ipmi/ipmi_bmc_sim.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 49 insertions(+)
>>
>> 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 <stdio.h>
>>  #include <string.h>
>>  #include <stdint.h>
>> +#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 {
>>
>>      uint8_t restart_cause;
>>
>> +    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] = cmd[2];
>> +    ibs->acpi_power_state[1] = 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 = 0; i < 16; i++) {
>> +        IPMI_ADD_RSP_DATA(ibs->uuid[i]);
>> +    }
>> +}
>>
>>  static void set_bmc_global_enables(IPMIBmcSim *ibs,
>>                                     uint8_t *cmd, unsigned int cmd_len,
>> @@ -1609,6 +1646,9 @@ static const IPMICmdHandler app_cmds[] = {
>>      [IPMI_CMD_GET_DEVICE_ID] = get_device_id,
>>      [IPMI_CMD_COLD_RESET] = cold_reset,
>>      [IPMI_CMD_WARM_RESET] = warm_reset,
>> +    [IPMI_CMD_SET_ACPI_POWER_STATE] = set_acpi_power_state,
>> +    [IPMI_CMD_GET_ACPI_POWER_STATE] = get_acpi_power_state,
>> +    [IPMI_CMD_GET_DEVICE_GUID] = get_device_guid,
>>      [IPMI_CMD_SET_BMC_GLOBAL_ENABLES] = set_bmc_global_enables,
>>      [IPMI_CMD_GET_BMC_GLOBAL_ENABLES] = get_bmc_global_enables,
>>      [IPMI_CMD_CLR_MSG_FLAGS] = clr_msg_flags,
>> @@ -1734,6 +1774,15 @@ static void ipmi_sim_init(Object *obj)
>>          i += len;
>>      }
>>
>> +    ibs->acpi_power_state[0] = 0;
>> +    ibs->acpi_power_state[1] = 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 ?

>From the specs (20.8 Get Device GUID Command), the command needs to return 
a GUID (Globally Unique ID), or UUID, that should never change over the 
lifetime of the device. 

qemu_uuid looked like a good candidate to start with but we could use a 
property also if needed.

Thanks,

C.

  reply	other threads:[~2016-01-22 11:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 17:18 [Qemu-devel] [PATCH v2 0/9] ipmi: a couple of enhancements to the BMC simulator Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 1/9] ppc: add IPMI support Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 2/9] ipmi: replace goto by a return statement Cédric Le Goater
2016-01-22  5:49   ` Marcel Apfelbaum
2016-01-22  6:28   ` Greg Kurz
2016-01-22 12:56   ` Corey Minyard
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 3/9] ipmi: replace *_MAXCMD defines Cédric Le Goater
2016-01-22  8:05   ` Greg Kurz
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 4/9] ipmi: introduce a struct ipmi_sdr_compact Cédric Le Goater
2016-01-22 10:49   ` Greg Kurz
2016-01-22 11:10     ` Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 5/9] ipmi: fix SDR length value Cédric Le Goater
2016-01-22 10:56   ` Greg Kurz
2016-01-22 11:15     ` Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 6/9] ipmi: add get and set SENSOR_TYPE commands Cédric Le Goater
2016-01-22 11:07   ` Greg Kurz
2016-01-22 11:13     ` Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 7/9] ipmi: add GET_SYS_RESTART_CAUSE chassis command Cédric Le Goater
2016-01-22 11:09   ` Greg Kurz
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 8/9] ipmi: add ACPI power and GUID commands Cédric Le Goater
2016-01-22 11:24   ` Greg Kurz
2016-01-22 11:58     ` Cédric Le Goater [this message]
2016-01-22 13:04   ` Corey Minyard
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 9/9] ipmi: add SET_SENSOR_READING command (tentative try) Cédric Le Goater
2016-01-22 11:28   ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A2194E.6050208@fr.ibm.com \
    --to=clg@fr.ibm.com \
    --cc=cminyard@mvista.com \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.