qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: hitmoon <zxq_yx_007@163.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Igor Mitsyanko" <i.mitsyanko@gmail.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Michael Walle" <michael@walle.cc>,
	qemu-arm <qemu-arm@nongnu.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v4 5/9] hw/timer: QOM'ify m48txx_sysbus (pass 2)
Date: Tue, 23 Feb 2016 13:11:56 +0800	[thread overview]
Message-ID: <56CBEA1C.4060900@163.com> (raw)
In-Reply-To: <CAFEAcA-nbrRN7ecP9G4O-bj=K-NtKoOQXpxGygKMPgxpgxQvBA@mail.gmail.com>


在 2016年02月22日 19:03, Peter Maydell 写道:
> On 22 February 2016 at 10:28, hitmoon <zxq_yx_007@163.com> wrote:
>> 在 2016年02月22日 17:24, Peter Maydell 写道:
>>> Just noticed this won't work as it is -- the vmstate
>>> struct is for the M48t59State*, but the ISA and
>>> Sysbus wrappers have their own structs which are
>>> what the dc->vmsd will be wanting to operate on.
>>> You'd need extra VMState structs I think and
>>> somebody who knows migration better than me to say
>>> whether that is a migration compat break.
>> It seems that the old code also use the same vmstate structure. Maybe it's a
>> common structure which will not be used at the same time.
> The old code passes vmstate_register() a pointer to the
> M48t59State, and so the offsets in the vmstate line up correctly
> with the fields it wants to access. If you use dc->vmsd then the
> pointer that is (implicitly) used is the pointer to the device
> structure itself, which is not the same address as the
> M48t59State embedded inside that struct.
>
> You'd basically need to have extra VMState structures for the
> devices themselves which just said "inside this M48txxISAState
> is an M48t59State", and "inside this M48txxSysBusState is a
> M48t59State" and referred to the existing vmstate for the
> M48t59State.
>
> thanks
> -- PMM

I add a new  structure for m48t59_isa as follows:

static const VMStateDescription vmstate_m48t59_isa = {
     .name = "m48t59-isa",
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(state.lock, M48txxISAState),
         VMSTATE_UINT16(state.addr, M48txxISAState),
         VMSTATE_VBUFFER_UINT32(state.buffer, M48txxISAState, 0, NULL, 
0, state.size),
         VMSTATE_END_OF_LIST()
     }
};

is this correct?

  parent reply	other threads:[~2016-02-23  5:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  9:11 [Qemu-devel] [PATCH v4 5/9] hw/timer: QOM'ify m48txx_sysbus (pass 2) xiaoqiang zhao
2016-02-22  9:24 ` Peter Maydell
2016-02-22 10:28   ` hitmoon
2016-02-22 11:03     ` Peter Maydell
2016-02-22 11:24       ` xiaoqiang zhao
2016-02-22 11:25       ` xiaoqiang zhao
2016-02-23  5:11       ` hitmoon [this message]
2016-02-23  9:04         ` Peter Maydell
2016-02-23 10:02           ` hitmoon
2016-02-23 10:26             ` Peter Maydell
2016-02-23 10:36               ` hitmoon

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=56CBEA1C.4060900@163.com \
    --to=zxq_yx_007@163.com \
    --cc=afaerber@suse.de \
    --cc=edgar.iglesias@gmail.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=i.mitsyanko@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=michael@walle.cc \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --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).