qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Corey Minyard <minyard@acm.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Corey Minyard <cminyard@mvista.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] i2c: Add an SMBus vmstate structure
Date: Thu, 8 Nov 2018 14:40:30 +0000	[thread overview]
Message-ID: <CAFEAcA85HTT-yTmL8Fu1uxbtWLdHVZiQS2PcJim45s65GPob5g@mail.gmail.com> (raw)
In-Reply-To: <98b1f2e3-bf71-24a2-f339-9fd63b40d26f@redhat.com>

On 8 November 2018 at 14:23, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Hi Corey,
>
>
> On 7/11/18 16:54, minyard@acm.org wrote:
>>
>> From: Corey Minyard <cminyard@mvista.com>
>>
>> There is no vmstate handling for SMBus, so no device sitting on SMBus
>> can have a state transfer that works reliable.  So add it.
>>
>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>>   hw/i2c/smbus.c         | 14 ++++++++++++++
>>   include/hw/i2c/smbus.h | 18 +++++++++++++++---
>>   2 files changed, 29 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c
>> index 6ff77c582f..b0774d7683 100644
>> --- a/hw/i2c/smbus.c
>> +++ b/hw/i2c/smbus.c
>> @@ -349,6 +349,20 @@ int smbus_write_block(I2CBus *bus, uint8_t addr,
>> uint8_t command, uint8_t *data,
>>       return 0;
>>   }
>>   +const VMStateDescription vmstate_smbus_device = {
>> +    .name = TYPE_SMBUS_DEVICE,
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>> +    .fields      = (VMStateField[]) {
>> +        VMSTATE_I2C_SLAVE(i2c, SMBusDevice),
>> +        VMSTATE_INT32(mode, SMBusDevice),
>> +        VMSTATE_INT32(data_len, SMBusDevice),
>> +        VMSTATE_UINT8_ARRAY(data_buf, SMBusDevice, SMBUS_DATA_MAX_LEN),
>> +        VMSTATE_UINT8(command, SMBusDevice),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
>> +
>>   static void smbus_device_class_init(ObjectClass *klass, void *data)
>>   {
>>       I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass);
>> diff --git a/include/hw/i2c/smbus.h b/include/hw/i2c/smbus.h
>> index d8b1b9ee81..7b52020121 100644
>> --- a/include/hw/i2c/smbus.h
>> +++ b/include/hw/i2c/smbus.h
>> @@ -53,14 +53,16 @@ typedef struct SMBusDeviceClass
>>       uint8_t (*read_data)(SMBusDevice *dev, uint8_t cmd, int n);
>>   } SMBusDeviceClass;
>>   +#define SMBUS_DATA_MAX_LEN 34  /* command + len + 32 bytes of data.  */
>> +
>>   struct SMBusDevice {
>>       /* The SMBus protocol is implemented on top of I2C.  */
>>       I2CSlave i2c;
>>         /* Remaining fields for internal use only.  */
>> -    int mode;
>> -    int data_len;
>> -    uint8_t data_buf[34]; /* command + len + 32 bytes of data.  */
>> +    int32_t mode;
>> +    int32_t data_len;
>> +    uint8_t data_buf[SMBUS_DATA_MAX_LEN];
>
>
> Those changes are not in your commit description.
> Can you include them in a separate patch?

These are just the standard "promote types in the state struct
to fixed-width ones required by the VMSTATE macros", aren't
they? I think they're fine as part of the vmstate conversion.

thanks
-- PMM

  reply	other threads:[~2018-11-08 14:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 15:54 [Qemu-devel] [PATCH 0/3] Fix/add vmstate handling in some I2C code minyard
2018-11-07 15:54 ` [Qemu-devel] [PATCH 1/3] i2c:pm_smbus: Fix state transfer minyard
2018-11-12 17:47   ` Dr. David Alan Gilbert
2018-11-12 20:32     ` Corey Minyard
2018-11-07 15:54 ` [Qemu-devel] [PATCH 2/3] i2c: Add an SMBus vmstate structure minyard
2018-11-08 14:23   ` Philippe Mathieu-Daudé
2018-11-08 14:40     ` Peter Maydell [this message]
2018-11-08 14:48       ` Philippe Mathieu-Daudé
2018-11-07 15:54 ` [Qemu-devel] [PATCH 3/3] i2c: Add vmstate handling to the smbus eeprom minyard
2018-11-08 14:08   ` Peter Maydell
2018-11-08 17:58     ` Corey Minyard
2018-11-08 18:03       ` Peter Maydell
2018-11-09 14:56         ` Corey Minyard
2018-11-09 15:02           ` Peter Maydell
2018-11-09 17:19             ` Corey Minyard
2018-11-09 17:53               ` Peter Maydell
2018-11-12 17:38                 ` Dr. David Alan Gilbert
2018-11-12 17:41                   ` Peter Maydell
2018-11-12 17:28         ` Dr. David Alan Gilbert

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=CAFEAcA85HTT-yTmL8Fu1uxbtWLdHVZiQS2PcJim45s65GPob5g@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=cminyard@mvista.com \
    --cc=dgilbert@redhat.com \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).