qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ninad Palsule <ninad@linux.vnet.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Joel Stanley" <joel@jms.id.au>,
	"Ninad Palsule" <ninad@linux.ibm.com>
Cc: qemu-devel@nongnu.org, andrew@aj.id.au, stefanb@linux.ibm.com
Subject: Re: [PATCH v7 1/3] docs: Add support for TPM devices over I2C bus
Date: Mon, 27 Mar 2023 09:48:03 -0500	[thread overview]
Message-ID: <b30609d2-2b4b-2c51-d957-936127032ffa@linux.vnet.ibm.com> (raw)
In-Reply-To: <24c4b174-21d2-32ce-c944-8f76eec0281c@kaod.org>

Hi Cedric,

On 3/27/23 2:52 AM, Cédric Le Goater wrote:
> On 3/27/23 09:47, Joel Stanley wrote:
>> On Sun, 26 Mar 2023 at 22:44, Ninad Palsule <ninad@linux.ibm.com> wrote:
>>>
>>> This is a documentation change for I2C TPM device support.
>>>
>>> Qemu already supports devices attached to ISA and sysbus.
>>> This drop adds support for the I2C bus attached TPM devices.
>>>
>>> Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
>>>
>>> ---
>>> V2:
>>>
>>> Incorporated Stephen's review comments
>>> - Added example in the document.
>>>
>>> ---
>>> V4:
>>> Incorporate Cedric & Stefan's comments
>>>
>>> - Added example for ast2600-evb
>>> - Corrected statement about arm virtual machine.
>>>
>>> ---
>>> V6:
>>> Incorporated review comments from Stefan.
>>> ---
>>>   docs/specs/tpm.rst | 32 ++++++++++++++++++++++++++++++++
>>>   1 file changed, 32 insertions(+)
>>>
>>> diff --git a/docs/specs/tpm.rst b/docs/specs/tpm.rst
>>> index 535912a92b..590e670a9a 100644
>>> --- a/docs/specs/tpm.rst
>>> +++ b/docs/specs/tpm.rst
>>> @@ -21,12 +21,16 @@ QEMU files related to TPM TIS interface:
>>>    - ``hw/tpm/tpm_tis_common.c``
>>>    - ``hw/tpm/tpm_tis_isa.c``
>>>    - ``hw/tpm/tpm_tis_sysbus.c``
>>> + - ``hw/tpm/tpm_tis_i2c.c``
>>>    - ``hw/tpm/tpm_tis.h``
>>>
>>>   Both an ISA device and a sysbus device are available. The former is
>>>   used with pc/q35 machine while the latter can be instantiated in the
>>>   Arm virt machine.
>>>
>>> +An I2C device support is also provided which can be instantiated in 
>>> the Arm
>>> +based emulation machines. This device only supports the TPM 2 
>>> protocol.
>>> +
>>>   CRB interface
>>>   -------------
>>>
>>> @@ -348,6 +352,34 @@ In case an Arm virt machine is emulated, use 
>>> the following command line:
>>>       -drive if=pflash,format=raw,file=flash0.img,readonly=on \
>>>       -drive if=pflash,format=raw,file=flash1.img
>>>
>>> +In case a ast2600-evb bmc machine is emulated and want to use TPM 
>>> device
>>> +attached to I2C bus, use the following command line:
>>> +
>>> +.. code-block:: console
>>> +
>>> +  qemu-system-arm -M ast2600-evb -nographic \
>>> +    -kernel arch/arm/boot/zImage \
>>> +    -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \
>>> +    -initrd rootfs.cpio \
>>> +    -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
>>> +    -tpmdev emulator,id=tpm0,chardev=chrtpm \
>>> +    -device tpm-tis-i2c,tpmdev=tpm0,bus=aspeed.i2c.bus.12,address=0x2e
>>
>> For testing, use this command to load the driver to the correct address:
>>
>> echo tpm_tis_i2c 0x2e > /sys/bus/i2c/devices/i2c-12/new_device
>>
>> (I don't know how specific we want to make the instructions, but
>> adding a line like above would help others from having to re-discover
>> the command).
>
> or/and add an avocado test for it. See tests/avocado/machine_aspeed.py.
>
> The avocado framework is a bit fragile when reading from the console but
> we hope to fix that.

I never used it before so it will take little longer.

Is it required to merge this i2c work?

Thanks for the review.

Ninad


>
> Thanks
>
> C.
>
>>
>>> +
>>> +In case a Rainier bmc machine is emulated and want to use TPM device
>>> +attached to I2C bus, use the following command line:
>>> +
>>> +.. code-block:: console
>>> +
>>> +  qemu-system-arm -M rainier-bmc -nographic \
>>> +    -kernel ${IMAGEPATH}/fitImage-linux.bin \
>>> +    -dtb ${IMAGEPATH}/aspeed-bmc-ibm-rainier.dtb \
>>> +    -initrd ${IMAGEPATH}/obmc-phosphor-initramfs.rootfs.cpio.xz \
>>> +    -drive 
>>> file=${IMAGEPATH}/obmc-phosphor-image.rootfs.wic.qcow2,if=sd,index=2\
>>> +    -net nic -net 
>>> user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443\
>>> +    -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
>>> +    -tpmdev emulator,id=tpm0,chardev=chrtpm \
>>> +    -device tpm-tis-i2c,tpmdev=tpm0,bus=aspeed.i2c.bus.12,address=0x2e
>>> +
>>
>> I'd drop this example, the above one is enough.
>>
>>>   In case SeaBIOS is used as firmware, it should show the TPM menu item
>>>   after entering the menu with 'ESC'.
>>>
>>> -- 
>>> 2.37.2
>>>
>


  reply	other threads:[~2023-03-27 14:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 22:44 [PATCH v7 0/3] Add support for TPM devices over I2C bus Ninad Palsule
2023-03-26 22:44 ` [PATCH v7 1/3] docs: " Ninad Palsule
2023-03-27  7:47   ` Joel Stanley
2023-03-27  7:52     ` Cédric Le Goater
2023-03-27 14:48       ` Ninad Palsule [this message]
2023-03-27 15:10         ` Cédric Le Goater
2023-03-27 15:28           ` Ninad Palsule
2023-03-27 13:04     ` Ninad Palsule
2023-03-26 22:44 ` [PATCH v7 2/3] tpm: Extend common APIs to support TPM TIS I2C Ninad Palsule
2023-03-27  0:14   ` Stefan Berger
2023-03-26 22:44 ` [PATCH v7 3/3] tpm: Add support for TPM device over I2C bus Ninad Palsule
2023-03-27 13:40   ` Stefan Berger
2023-03-27 15:54     ` Ninad Palsule
2023-03-27  1:05 ` [PATCH v7 0/3] Add support for TPM devices " Joel Stanley
2023-03-27  3:52   ` Ninad Palsule
2023-03-27  8:04     ` Joel Stanley
2023-03-27  8:20       ` Cédric Le Goater
2023-03-27 10:49         ` Joel Stanley
2023-03-27 11:17       ` Stefan Berger
2023-03-27 11:11   ` Stefan Berger
2023-03-27 11:18     ` Joel Stanley
2023-03-27 11:24       ` Stefan Berger
2023-03-27 12:31     ` Stefan Berger
2023-03-27 13:09       ` Stefan Berger

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=b30609d2-2b4b-2c51-d957-936127032ffa@linux.vnet.ibm.com \
    --to=ninad@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=ninad@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.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).