From: Auger Eric <eric.auger@redhat.com>
To: Stefan Berger <stefanb@linux.ibm.com>,
eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com,
shannon.zhaosl@gmail.com, imammedo@redhat.com
Cc: marcandre.lureau@redhat.com, drjones@redhat.com,
lersek@redhat.com, ardb@kernel.org, philmd@redhat.com
Subject: Re: [RFC 4/6] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS
Date: Fri, 5 Jun 2020 17:47:08 +0200 [thread overview]
Message-ID: <fe6c6130-e027-af88-e005-d850a8ce0c89@redhat.com> (raw)
In-Reply-To: <aab64eab-f524-3385-c0c9-c0cd7a41e04e@linux.ibm.com>
Hi Stefan,
On 6/5/20 5:25 PM, Stefan Berger wrote:
> On 6/5/20 5:35 AM, Auger Eric wrote:
>> Hi Stefan,
>>
>> On 6/2/20 6:17 PM, Stefan Berger wrote:
>>> On 6/2/20 12:13 PM, Auger Eric wrote:
>>>> Hi Stefan,
>>>>
>>>> On 6/2/20 3:39 PM, Stefan Berger wrote:
>>>>> On 6/1/20 6:21 AM, Eric Auger wrote:
>>>>>> While writing tests for checking the content of TPM2 and DSDT
>>>>>> along with TPM-TIS instantiation I attempted to reuse the
>>>>>> framework used for TPM-TIS tests. However While dumping the
>>>>>> ACPI tables I get an assert on TPM2_ST_NO_SESSIONS. My assumption
>>>>>> is maybe the other tests did not execute long enough to encounter
>>>>>> this. So I tentatively propose to remove the assert as it
>>>>>> does not seem to break other tests and enable the new ones.
>>>>>>
>>>>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>>>>> ---
>>>>>> tests/qtest/tpm-emu.c | 1 -
>>>>>> 1 file changed, 1 deletion(-)
>>>>>>
>>>>>> diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
>>>>>> index c43ac4aef8..298d0eec74 100644
>>>>>> --- a/tests/qtest/tpm-emu.c
>>>>>> +++ b/tests/qtest/tpm-emu.c
>>>>>> @@ -49,7 +49,6 @@ static void *tpm_emu_tpm_thread(void *data)
>>>>>> s->tpm_msg->tag = be16_to_cpu(s->tpm_msg->tag);
>>>>>> s->tpm_msg->len = be32_to_cpu(s->tpm_msg->len);
>>>>>> g_assert_cmpint(s->tpm_msg->len, >=, minhlen);
>>>>>> - g_assert_cmpint(s->tpm_msg->tag, ==, TPM2_ST_NO_SESSIONS);
>>>>> You should not have to remove this. The tests are skipped if swtpm
>>>>> does
>>>>> not support TPM 2 via --tpm2 option. This would be a very old swtpm
>>>>> version, though. So, all tests are run with --tpm2 option and any
>>>>> response received from the TPM would be a TPM 2 response that should
>>>>> have TPM2_ST_NO_SESSIONS as the tag. I'd be curious what other
>>>>> value you
>>>>> are seeing there.
>>>> If I revert this patch I am getting TPM2_ST_SESSIONS on my end.
>>> Is firmware/BIOS active? There's no TPM2_ST_SESSIONS coming out of QEMU.
>> So it looks SeaBIOS is in use (bios-256k.bin loaded).
>>
>> I can see MMIO accesses to the TPM and the following commands are
>> observable:
>> tpm_emu_tpm_thread code=0x181 tag=0x8001 len=0xa
>> tpm_emu_tpm_thread code=0x144 tag=0x8001 len=0xc
>> tpm_emu_tpm_thread code=0x121 tag=0x8002 len=0x20
>> This last one causes the assert (TPM2_CC_HierarchyControl)
>>
>> I checked in Seabios and effectively tpm20_hierarchycontrol() tags the
>> TPM2_CC_HierarchyControl command with TPM2_ST_SESSIONS
>>
>> Due to our emulation, maybe tpm_set_failure() gets called, inducing
>> tpm20_hierarchycontrol() call.
>>
>> That being said, what do you recommend? Remove the assert, improve the
>> emulation, other?
>
> So this is an ACPI test. What role does the firmware play for success of
> the test? If the test relies on the firmware showing some sort of
> expected result, then I would recommend only running this test with an
> attached swtpm, like we run some other tests. If we don't need the
> firmware to succeed then I would just get rid of the assert. Probably no
> other test we have implemented so far was running the firmware...
FWIU The goal of this test is to compare the acpi tables generated by
qemu against reference ones. I dont think we expect from the FW any
specific result but I would prefer Igor or Michael to confirm.
In that case, removing the assert() allows to compare the specific DSDT
and TPM2 tables and that's our expectation here I think.
Thanks
Eric
>
>
> Stefan
>
>
>>
>> Thank you in advance
>>
>> Best Regards
>>
>> Eric
>>
>>> Stefan
>>>
>>>
>>>
>
>
next prev parent reply other threads:[~2020-06-05 15:50 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 10:21 [RFC 0/6] TPM-TIS bios-tables-test Eric Auger
2020-06-01 10:21 ` [RFC 1/6] test/tpm-emu: include sockets and channel headers in tpm-emu header Eric Auger
2020-06-02 14:08 ` Stefan Berger
2020-06-01 10:21 ` [RFC 2/6] tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test Eric Auger
2020-06-02 14:08 ` Stefan Berger
2020-06-05 14:54 ` Igor Mammedov
2020-06-01 10:21 ` [RFC 3/6] tests/acpi: Ignore TPM2.tis and DSDT.tis Eric Auger
2020-06-02 14:09 ` Stefan Berger
2020-06-05 14:55 ` Igor Mammedov
2020-06-01 10:21 ` [RFC 4/6] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS Eric Auger
2020-06-02 13:39 ` Stefan Berger
2020-06-02 14:43 ` Stefan Berger
2020-06-02 16:13 ` Auger Eric
2020-06-02 16:17 ` Stefan Berger
2020-06-02 17:15 ` Auger Eric
2020-06-05 9:35 ` Auger Eric
2020-06-05 15:25 ` Stefan Berger
2020-06-05 15:47 ` Auger Eric [this message]
2020-06-08 8:34 ` Igor Mammedov
2020-06-08 9:11 ` Auger Eric
2020-06-01 10:21 ` [RFC 5/6] bios-tables-test: Add Q35/TPM-TIS test Eric Auger
2020-06-02 14:38 ` Stefan Berger
2020-06-05 15:17 ` Igor Mammedov
2020-06-09 12:10 ` Auger Eric
2020-06-01 10:21 ` [RFC 6/6] bios-tables-test: Generate reference tables for Q35/TPM-TIS Eric Auger
2020-06-02 14:39 ` Stefan Berger
2020-06-02 11:42 ` [RFC 0/6] TPM-TIS bios-tables-test Auger Eric
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=fe6c6130-e027-af88-e005-d850a8ce0c89@redhat.com \
--to=eric.auger@redhat.com \
--cc=ardb@kernel.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhaosl@gmail.com \
--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).