From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyJNs-0006Nh-Qs for qemu-devel@nongnu.org; Mon, 06 Aug 2012 05:14:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyJNo-00061q-Gs for qemu-devel@nongnu.org; Mon, 06 Aug 2012 05:13:56 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:35374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyJNo-00061i-Bd for qemu-devel@nongnu.org; Mon, 06 Aug 2012 05:13:52 -0400 Received: by yhpp34 with SMTP id p34so2211152yhp.4 for ; Mon, 06 Aug 2012 02:13:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <49f6758224161a570d25b3ee24e1812fc747e0c1.1344218410.git.peter.crosthwaite@petalogix.com> References: <49f6758224161a570d25b3ee24e1812fc747e0c1.1344218410.git.peter.crosthwaite@petalogix.com> Date: Mon, 6 Aug 2012 10:13:50 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v5 02/15] ssi: Added VMSD stub List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter A. G. Crosthwaite" Cc: Anthony Liguori , i.mitsyanko@samsung.com, Juan Quintela , stefanha@gmail.com, qemu-devel@nongnu.org, paul@codesourcery.com, edgar.iglesias@gmail.com, john.williams@petalogix.com On 6 August 2012 03:16, Peter A. G. Crosthwaite wrote: > Added VMSD stub for SSI slaves. Fields may be added to this VMSD for generic > SSI slave state (e.g. the CS line state). This is more me being confused about how this should work than a review comment, but it seems a bit odd that we have a hierarchy Device->SSI->ADS7846[etc], where the VMState for the ADS7846 includes a field for the SSI VMState, but the SSI VMState doesn't include a field for the Device VMState. What you've done here matches how i2c works currently, but I've just cc'd Anthony and Juan to check whether there's a better way of doing it. > Signed-off-by: Peter A. G. Crosthwaite > --- > hw/ads7846.c | 1 + > hw/max111x.c | 1 + > hw/spitz.c | 2 ++ > hw/ssi.c | 10 ++++++++++ > hw/ssi.h | 10 ++++++++++ > hw/stellaris.c | 1 + > hw/z2.c | 1 + > 7 files changed, 26 insertions(+), 0 deletions(-) > > diff --git a/hw/ads7846.c b/hw/ads7846.c > index 41c7f10..6a523f6 100644 > --- a/hw/ads7846.c > +++ b/hw/ads7846.c > @@ -124,6 +124,7 @@ static const VMStateDescription vmstate_ads7846 = { > .minimum_version_id_old = 0, > .post_load = ads7856_post_load, > .fields = (VMStateField[]) { > + VMSTATE_SSI_SLAVE(ssidev, ADS7846State), > VMSTATE_INT32_ARRAY(input, ADS7846State, 8), > VMSTATE_INT32(noise, ADS7846State), > VMSTATE_INT32(cycle, ADS7846State), > diff --git a/hw/max111x.c b/hw/max111x.c > index 706d89f..948fd97 100644 > --- a/hw/max111x.c > +++ b/hw/max111x.c > @@ -103,6 +103,7 @@ static const VMStateDescription vmstate_max111x = { > .minimum_version_id = 0, > .minimum_version_id_old = 0, > .fields = (VMStateField[]) { > + VMSTATE_SSI_SLAVE(ssidev, MAX111xState), > VMSTATE_UINT8(tb1, MAX111xState), > VMSTATE_UINT8(rb2, MAX111xState), > VMSTATE_UINT8(rb3, MAX111xState), > diff --git a/hw/spitz.c b/hw/spitz.c > index 20e7835..f5d502d 100644 > --- a/hw/spitz.c > +++ b/hw/spitz.c > @@ -1087,6 +1087,7 @@ static const VMStateDescription vmstate_corgi_ssp_regs = { > .minimum_version_id = 1, > .minimum_version_id_old = 1, > .fields = (VMStateField []) { > + VMSTATE_SSI_SLAVE(ssidev, CorgiSSPState), > VMSTATE_UINT32_ARRAY(enable, CorgiSSPState, 3), > VMSTATE_END_OF_LIST(), > } > @@ -1115,6 +1116,7 @@ static const VMStateDescription vmstate_spitz_lcdtg_regs = { > .minimum_version_id = 1, > .minimum_version_id_old = 1, > .fields = (VMStateField []) { > + VMSTATE_SSI_SLAVE(ssidev, SpitzLCDTG), > VMSTATE_UINT32(bl_intensity, SpitzLCDTG), > VMSTATE_UINT32(bl_power, SpitzLCDTG), > VMSTATE_END_OF_LIST(), > diff --git a/hw/ssi.c b/hw/ssi.c > index 35d0a04..2db88fc 100644 > --- a/hw/ssi.c > +++ b/hw/ssi.c > @@ -80,6 +80,16 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) > return r; > } > > +const VMStateDescription vmstate_ssi_slave = { > + .name = "SSISlave", > + .version_id = 1, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, > + .fields = (VMStateField[]) { > + VMSTATE_END_OF_LIST() > + } > +}; > + > static void ssi_slave_register_types(void) > { > type_register_static(&ssi_bus_info); > diff --git a/hw/ssi.h b/hw/ssi.h > index 06657d7..975f9fb 100644 > --- a/hw/ssi.h > +++ b/hw/ssi.h > @@ -38,6 +38,16 @@ struct SSISlave { > #define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev) > #define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev) > > +extern const VMStateDescription vmstate_ssi_slave; > + > +#define VMSTATE_SSI_SLAVE(_field, _state) { \ > + .name = (stringify(_field)), \ > + .size = sizeof(SSISlave), \ > + .vmsd = &vmstate_ssi_slave, \ > + .flags = VMS_STRUCT, \ > + .offset = vmstate_offset_value(_state, _field, SSISlave), \ > +} > + > DeviceState *ssi_create_slave(SSIBus *bus, const char *name); > > /* Master interface. */ > diff --git a/hw/stellaris.c b/hw/stellaris.c > index 562fbbf..4d26857 100644 > --- a/hw/stellaris.c > +++ b/hw/stellaris.c > @@ -1188,6 +1188,7 @@ static const VMStateDescription vmstate_stellaris_ssi_bus = { > .minimum_version_id = 1, > .minimum_version_id_old = 1, > .fields = (VMStateField[]) { > + VMSTATE_SSI_SLAVE(ssidev, stellaris_ssi_bus_state), > VMSTATE_INT32(current_dev, stellaris_ssi_bus_state), > VMSTATE_END_OF_LIST() > } > diff --git a/hw/z2.c b/hw/z2.c > index 289cee9..721aaf1 100644 > --- a/hw/z2.c > +++ b/hw/z2.c > @@ -165,6 +165,7 @@ static VMStateDescription vmstate_zipit_lcd_state = { > .minimum_version_id = 1, > .minimum_version_id_old = 1, > .fields = (VMStateField[]) { > + VMSTATE_SSI_SLAVE(ssidev, ZipitLCD), > VMSTATE_INT32(selected, ZipitLCD), > VMSTATE_INT32(enabled, ZipitLCD), > VMSTATE_BUFFER(buf, ZipitLCD), > -- > 1.7.0.4 > -- PMM