[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 42/42] WIP: add TPM CRB device
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH 42/42] WIP: add TPM CRB device |
Date: |
Tue, 10 Oct 2017 17:19:00 -0300 |
User-agent: |
Mutt/1.9.0 (2017-09-02) |
On Tue, Oct 10, 2017 at 02:28:19PM -0400, Stefan Berger wrote:
> On 10/09/2017 06:56 PM, Marc-André Lureau wrote:
> > +
> > +static void tpm_crb_realizefn(DeviceState *dev, Error **errp)
> > +{
> > + CRBState *s = CRB(dev);
> > + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> > +
> > + if (!tpm_find()) {
> > + error_setg(errp, "at most one TPM device is permitted");
>
>
> Shouldn't that be the case if tpm_find() != NULL ?
It's tricky: due to the way it's implemented (using
object_resolve_path_type()) tpm_find() will be able to find @dev
itself, because it is already attached to the device tree, but it
will return NULL if there are multiple TPM devices.
You can see the same pattern being used at
find_vmgenid_dev()/vmgenid_realize() and
fw_cfg_find()/fw_cfg_common_realize(). The difference is that
find_vmgenid_dev() and fw_cfg_find() are explicitly documented
with a "returns NULL unless there is exactly one device" comment,
while tpm_find() is not.
--
Eduardo
- [Qemu-devel] [PATCH 38/42] tpm: add TPM interface to lookup TPM version, (continued)
- [Qemu-devel] [PATCH 38/42] tpm: add TPM interface to lookup TPM version, Marc-André Lureau, 2017/10/09
- [Qemu-devel] [PATCH 39/42] tpm: add tpm_cmd_get_size() to tpm_util, Marc-André Lureau, 2017/10/09
- [Qemu-devel] [PATCH 40/42] acpi: change TPM TIS data conditions, Marc-André Lureau, 2017/10/09
- [Qemu-devel] [PATCH 41/42] tpm-emulator: add a FIXME comment about blocking cancel, Marc-André Lureau, 2017/10/09
- [Qemu-devel] [PATCH 42/42] WIP: add TPM CRB device, Marc-André Lureau, 2017/10/09
- Re: [Qemu-devel] [PATCH 00/42] TPM: code cleanup & CRB device, no-reply, 2017/10/09
- Re: [Qemu-devel] [PATCH 00/42] TPM: code cleanup & CRB device, Stefan Berger, 2017/10/09
- Re: [Qemu-devel] [PATCH 00/42] TPM: code cleanup & CRB device, Stefan Berger, 2017/10/19