qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] Add TPM 1.2 device interface
Date: Fri, 18 Feb 2011 16:03:04 -0500	[thread overview]
Message-ID: <4D5EDE88.9010407@linux.vnet.ibm.com> (raw)
In-Reply-To: <1298043215-10083-2-git-send-email-andreas.niederl@iaik.tugraz.at>

On 02/18/2011 10:33 AM, Andreas Niederl wrote:
> +
> +static const VMStateDescription vmstate_loc = {
> +    .name       = "loc",
> +    .version_id = 0,
> +    .fields     = (VMStateField []) {
> +        VMSTATE_UINT32(state, TPMLocality),
> +        VMSTATE_UINT32(inte,  TPMLocality),
> +        VMSTATE_UINT32(ints,  TPMLocality),
> +        VMSTATE_UINT8(access, TPMLocality),
> +        VMSTATE_UINT8(sts,    TPMLocality),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
> +static const VMStateDescription vmstate_tpm = {
> +    .name       = "tpm",
> +    .version_id = 0,
> +    .minimum_version_id     = 0,
> +    .minimum_version_id_old = 0,
> +    .pre_save   = tpm_pre_save,
> +    .fields     = (VMStateField []) {
> +        VMSTATE_UINT32(irq,    TPMState),
> +        VMSTATE_UINT32(offset, TPMState),
> +        VMSTATE_BUFFER(buf,    TPMState),
> +        VMSTATE_UINT8(  active_locty, TPMState),
> +        VMSTATE_UINT8(aborting_locty, TPMState),
> +        VMSTATE_UINT8(    next_locty, TPMState),
> +        VMSTATE_STRUCT_ARRAY(loc, TPMState, NUM_LOCALITIES, 0,
> +                             vmstate_loc, TPMLocality),
Here you are pointing to the above vmstate_loc ...
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
> +/*

> +
> +    vmstate_register(&dev->qdev, 1,&vmstate_tpm, s);
> +    for (i = 0; i<  NUM_LOCALITIES; i++) {
> +        vmstate_register(&dev->qdev, 1,&vmstate_loc,&s->loc[i]);
... here you are (again) registering the localities ...
> +    }
> +
> +    isa_init_irq(dev,&s->pic, isairq);
> +    s->irq = isairq;
> +
> +    iomem = cpu_register_io_memory(tis_readfn, tis_writefn, s,
> +            DEVICE_LITTLE_ENDIAN);
> +    cpu_register_physical_memory(TIS_ADDR_BASE,
> +            0x1000 * NUM_LOCALITIES, iomem);
> +
> +    s->poll_timer = qemu_new_timer(vm_clock, tis_poll_timer, s);
> +
> +    return 0;
> +}
> +
> +static void qdev_tpm_reset(DeviceState *dev)
> +{
> +    TPMState *s = DO_UPCAST(TPMState, dev.qdev, dev);
> +    tpm_reset(s);
> +}
> +
> +static ISADeviceInfo tpm_info = {
> +    .init          = tpm_init,
> +    .qdev.name     = "tpm",
> +    .qdev.desc     = "TPM TIS Interface",
> +    .qdev.size     = sizeof (TPMState),
> +    .qdev.vmsd     =&vmstate_tpm,
... and here you're pointing to vmstate_tpm, which was also registered 
above using

+
+    vmstate_register(&dev->qdev, 1,&vmstate_tpm, s);


Are you sure this is necessary? In my implementation I only have the 
qdev.vmsd set and need not explicitly use vmstate_register(). Aren't you 
writing the state two times if you do that?

    Stefan

  parent reply	other threads:[~2011-02-18 21:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18 15:33 [Qemu-devel] [PATCH 0/5] TPM device emulation Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 1/5] Add TPM 1.2 device interface Andreas Niederl
2011-02-18 16:37   ` Stefan Berger
2011-02-18 17:37     ` Andreas Niederl
2011-02-18 20:27       ` Stefan Berger
2011-02-21 17:03         ` Andreas Niederl
2011-02-22 16:47           ` Stefan Berger
2011-02-24 15:30     ` Andreas Niederl
2011-02-24 17:44       ` Stefan Berger
2011-02-18 21:03   ` Stefan Berger [this message]
2011-02-21 17:13     ` Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 2/5] Provide SSDT for enabled TPM device Andreas Niederl
2011-02-18 17:02   ` Stefan Berger
2011-02-21 16:55     ` Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 3/5] Add TPM host passthrough device backend Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 4/5] Add configure script and command line options for TPM interface Andreas Niederl
2011-02-18 15:33 ` [Qemu-devel] [PATCH 5/5] Adapt TPM host backend to use threadlets Andreas Niederl

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=4D5EDE88.9010407@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.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).