From: "Cédric Le Goater" <clg@kaod.org>
To: Stefan Berger <stefanb@linux.ibm.com>, <qemu-devel@nongnu.org>
Cc: <marcandre.lureau@redhat.com>, <ninad@linux.ibm.com>,
<joel@jms.id.au>, <andrew@aj.id.au>
Subject: Re: [PATCH 3/3] qtest: Add a test case for TPM TIS I2C connected to Aspeed I2C controller
Date: Tue, 28 Mar 2023 13:52:38 +0200 [thread overview]
Message-ID: <0b6bc13e-937f-0106-5849-bed7dba6b70a@kaod.org> (raw)
In-Reply-To: <f947d10a-4edd-1376-cea9-cdc5dae216f8@linux.ibm.com>
On 3/28/23 13:31, Stefan Berger wrote:
>
>
> On 3/28/23 05:17, Cédric Le Goater wrote:
>>> +static void tpm_tis_i2c_test_basic(const void *data)
>>> +{
>>> + uint8_t access;
>>> + uint32_t v;
>>> +
>>> + /*
>>> + * All register accesses below must work without locality 0 being the
>>> + * active locality. Therefore, ensure access is released.
>>> + */
>>> + tpm_tis_i2c_writeb(0, TPM_I2C_REG_ACCESS,
>>> + TPM_TIS_ACCESS_ACTIVE_LOCALITY);
>>> + access = tpm_tis_i2c_readb(0, TPM_I2C_REG_ACCESS);
>>> + g_assert_cmpint(access, ==, TPM_TIS_ACCESS_TPM_REG_VALID_STS |
>>> + TPM_TIS_ACCESS_TPM_ESTABLISHMENT);
>>> +
>>> + /* read interrupt capability -- none are supported */
>>> + v = tpm_tis_i2c_readl(0, TPM_I2C_REG_INT_CAPABILITY);
>>> + g_assert_cmpint(v, ==, 0);
>>> +
>>> + /* try to enable all interrupts */
>>> + tpm_tis_i2c_writel(0, TPM_I2C_REG_INT_ENABLE, 0xffffffff);
>>> + v = tpm_tis_i2c_readl(0, TPM_I2C_REG_INT_ENABLE);
>>> + /* none could be enabled */
>>> + g_assert_cmpint(v, ==, 0);
>>> +
>>> + /* enable csum */
>>> + tpm_tis_i2c_writeb(0, TPM_I2C_REG_DATA_CSUM_ENABLE, TPM_DATA_CSUM_ENABLED);
>>> + /* check csum enable register has bit 0 set */
>>> + v = tpm_tis_i2c_readb(0, TPM_I2C_REG_DATA_CSUM_ENABLE);
>>> + g_assert_cmpint(v, ==, TPM_DATA_CSUM_ENABLED);
>>> + /* reading it as 32bit register returns same result */
>>> + v = tpm_tis_i2c_readl(0, TPM_I2C_REG_DATA_CSUM_ENABLE);
>>> + g_assert_cmpint(v, ==, TPM_DATA_CSUM_ENABLED);
>>> +
>>> + /* disable csum */
>>> + tpm_tis_i2c_writeb(0, TPM_I2C_REG_DATA_CSUM_ENABLE, 0);
>>> + /* check csum enable register has bit 0 clear */
>>> + v = tpm_tis_i2c_readb(0, TPM_I2C_REG_DATA_CSUM_ENABLE);
>>> + g_assert_cmpint(v, ==, 0);
>>> +
>>> + /* write to unsupported register '1' */
>>> + tpm_tis_i2c_writel(0, 1, 0x12345678);
>>> + v = tpm_tis_i2c_readl(0, 1);
>>> + g_assert_cmpint(v, ==, 0xffffffff);
>>> +}
>>
>> I am seeing some errors :
>
>
> There's a small fix to apply to 3/3 of Ninad's patches. See my comment here:
>
>
> https://lists.nongnu.org/archive/html/qemu-devel/2023-03/msg06464.html
That was it.
Tested-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
next prev parent reply other threads:[~2023-03-28 11:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 20:24 [PATCH 0/3] qtests: tpm: Add test cases for TPM TIS I2C device emulation Stefan Berger
2023-03-27 20:24 ` [PATCH 1/3] qtest: Add functions for accessing devices on Aspeed I2C controller Stefan Berger
2023-03-28 6:39 ` Cédric Le Goater
2023-03-28 12:26 ` Stefan Berger
2023-03-28 13:10 ` Cédric Le Goater
2023-03-28 13:26 ` Ninad Palsule
2023-03-27 20:24 ` [PATCH 2/3] qtest: Move tpm_util_tis_transmit() into tpm-tis-utils.c and rename it Stefan Berger
2023-03-28 13:31 ` Ninad Palsule
2023-03-27 20:24 ` [PATCH 3/3] qtest: Add a test case for TPM TIS I2C connected to Aspeed I2C controller Stefan Berger
2023-03-28 6:44 ` Cédric Le Goater
2023-03-28 9:17 ` Cédric Le Goater
2023-03-28 11:31 ` Stefan Berger
2023-03-28 11:52 ` Cédric Le Goater [this message]
2023-03-28 14:10 ` Ninad Palsule
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=0b6bc13e-937f-0106-5849-bed7dba6b70a@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=marcandre.lureau@redhat.com \
--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).