From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: avi@redhat.com, serge@hallyn.com, qemu-devel@nongnu.org,
anbang.ruan@cs.ox.ac.uk, andreas.niederl@iaik.tugraz.at
Subject: Re: [Qemu-devel] [PATCH V9 2/5] Add TPM (frontend) hardware interface (TPM TIS) to Qemu
Date: Mon, 26 Sep 2011 22:09:05 +0300 [thread overview]
Message-ID: <20110926190905.GD22278@redhat.com> (raw)
In-Reply-To: <20110926163729.645611239@linux.vnet.ibm.com>
On Mon, Sep 26, 2011 at 12:35:11PM -0400, Stefan Berger wrote:
> +static int tpm_tis_init(ISADevice *dev)
> +{
> + TPMState *s = DO_UPCAST(TPMState, busdev, dev);
> + TPMTISState *tis = &s->s.tis;
> + int iomemtype, rc;
> +
> + qemu_mutex_init(&s->state_lock);
> + qemu_cond_init(&s->from_tpm_cond);
> + qemu_cond_init(&s->to_tpm_cond);
> +
> + s->be_driver = qemu_find_tpm(s->backend);
> + if (!s->be_driver) {
> + fprintf(stderr,
> + "tpm_tis: backend driver with id %s could not be found.n\n",
> + s->backend);
error_report?
> + return -1;
> + }
> +
> + if (s->be_driver->ops->init(s->be_driver, s, tpm_tis_receive_cb)) {
> + goto err_exit;
> + }
> +
> + isa_init_irq(dev, &tis->irq, tis->irq_num);
> +
> + iomemtype = cpu_register_io_memory(tpm_tis_readfn, tpm_tis_writefn, s,
> + DEVICE_LITTLE_ENDIAN);
A bit of a strange name for a var - it's not a type, is it?
> + cpu_register_physical_memory(TPM_TIS_ADDR_BASE,
> + 0x1000 * TPM_TIS_NUM_LOCALITIES,
> + iomemtype);
I think memory_region_init_io are supposed to be used for new devices
from now on... Right, Avi?
> +
> + rc = tpm_tis_do_startup_tpm(s);
> + if (rc != 0) {
> + goto err_exit;
> + }
> +
> + return 0;
> +
> + err_exit:
Missing cleanup?
> + return -1;
> +}
> +
> +static const VMStateDescription vmstate_tpm_tis = {
> + .name = "tpm",
> + .unmigratable = 1,
> +};
> +
> +static ISADeviceInfo tpm_tis_device_info = {
> + .init = tpm_tis_init,
> + .qdev.name = "tpm-tis",
> + .qdev.size = sizeof(TPMState),
> + .qdev.vmsd = &vmstate_tpm_tis,
> + .qdev.reset = tpm_tis_reset,
> + .qdev.props = (Property[]) {
> + DEFINE_PROP_UINT32("irq", TPMState,
> + s.tis.irq_num, TPM_TIS_IRQ),
> + DEFINE_PROP_STRING("tpmdev", TPMState, backend),
> + DEFINE_PROP_END_OF_LIST(),
> + },
> +};
> +
> +static void tpm_tis_register_device(void)
> +{
> + isa_qdev_register(&tpm_tis_device_info);
> +}
> +
> +device_init(tpm_tis_register_device)
next prev parent reply other threads:[~2011-09-26 19:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-26 16:35 [Qemu-devel] [PATCH V9 0/5] Qemu Trusted Platform Module (TPM) integration Stefan Berger
2011-09-26 16:35 ` [Qemu-devel] [PATCH V9 1/5] Support for TPM command line options Stefan Berger
2011-09-26 19:03 ` Michael S. Tsirkin
2011-09-26 23:33 ` Stefan Berger
2011-09-26 16:35 ` [Qemu-devel] [PATCH V9 2/5] Add TPM (frontend) hardware interface (TPM TIS) to Qemu Stefan Berger
2011-09-26 19:09 ` Michael S. Tsirkin [this message]
2011-09-26 19:09 ` Avi Kivity
2011-09-27 1:48 ` Stefan Berger
2011-09-27 5:28 ` Michael S. Tsirkin
2011-09-26 16:35 ` [Qemu-devel] [PATCH V9 3/5] Add a debug register Stefan Berger
2011-09-26 16:35 ` [Qemu-devel] [PATCH V9 4/5] Build the TPM frontend code Stefan Berger
2011-09-26 16:35 ` [Qemu-devel] [PATCH V9 5/5] Add a TPM Passthrough backend driver implementation Stefan Berger
2011-09-26 19:20 ` Michael S. Tsirkin
2011-09-26 20:12 ` Stefan Berger
2011-09-26 20:24 ` Michael S. Tsirkin
2011-09-27 2:20 ` Stefan Berger
2011-09-26 19:22 ` [Qemu-devel] [PATCH V9 0/5] Qemu Trusted Platform Module (TPM) integration Michael S. Tsirkin
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=20110926190905.GD22278@redhat.com \
--to=mst@redhat.com \
--cc=anbang.ruan@cs.ox.ac.uk \
--cc=andreas.niederl@iaik.tugraz.at \
--cc=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=serge@hallyn.com \
--cc=stefanb@linux.vnet.ibm.com \
/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).