qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Joelle van Dyne <j@getutm.app>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>
Subject: Re: [PATCH v5 12/14] tests: acpi: implement TPM CRB tests for ARM virt
Date: Fri, 24 Nov 2023 11:17:43 -0500	[thread overview]
Message-ID: <d850ca40-d822-4e7d-b2ee-848f6d4208a7@linux.ibm.com> (raw)
In-Reply-To: <CA+E+eSDnC9cnm2CfPxFkp=yYkcjuBDaLbxb6Uwz3A4nzwAM3CQ@mail.gmail.com>



On 11/23/23 19:56, Joelle van Dyne wrote:
> On Tue, Nov 14, 2023 at 4:12 PM Stefan Berger <stefanb@linux.ibm.com> wrote:
>>
>>
>>
>> On 11/14/23 16:05, Stefan Berger wrote:
>>>
>>>
>>> On 11/14/23 13:03, Stefan Berger wrote:
>>>>
>>>>
>>>> On 11/14/23 04:36, Marc-André Lureau wrote:
>>>>> Hi
>>>>>
>>>>> On Tue, Nov 14, 2023 at 6:12 AM Joelle van Dyne <j@getutm.app> wrote:
>>>>>>
>>>>>> Signed-off-by: Joelle van Dyne <j@getutm.app>
>>>>>> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
>>>>>
>>>>> nit: you also added tests for x86, could be a different patch?
>>>>>
>>>>> For arm, the test fails until next patch with:
>>>>>
>>>>> # starting QEMU: exec ./qemu-system-aarch64 -qtest
>>>>> unix:/tmp/qtest-991279.sock -qtest-log /dev/null -chardev
>>>>> socket,path=/tmp/qtest-991279.qmp,id=char0 -mon
>>>>> chardev=char0,mode=control -display none -audio none -machine virt
>>>>> -accel tcg -nodefaults -nographic -drive
>>>>> if=pflash,format=raw,file=pc-bios/edk2-aarch64-code.fd,readonly=on
>>>>> -drive if=pflash,format=raw,file=pc-bios/edk2-arm-vars.fd,snapshot=on
>>>>> -cdrom tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2
>>>>> -cpu cortex-a57 -chardev
>>>>> socket,id=chr,path=/tmp/qemu-test_acpi_virt_tcg_crb-device.KZ3GE2/sock
>>>>> -tpmdev emulator,id=dev,chardev=chr -device tpm-crb-device,tpmdev=dev
>>>>> -accel qtest
>>>>> Warning! zero length expected file
>>>>> 'tests/data/acpi/virt/TPM2.crb-device.tpm2'
>>>>> Warning! zero length expected file
>>>>> 'tests/data/acpi/virt/DSDT.crb-device.tpm2'
>>>>> acpi-test: Warning!  binary file mismatch. Actual
>>>>> [aml:/tmp/aml-GO4ME2], Expected
>>>>> [aml:tests/data/acpi/virt/TPM2.crb-device.tpm2].
>>>>> See source file tests/qtest/bios-tables-test.c for instructions on how
>>>>> to update expected files.
>>>>> acpi-test: Warning!  binary file mismatch. Actual
>>>>> [aml:/tmp/aml-6N4ME2], Expected
>>>>> [aml:tests/data/acpi/virt/DSDT.crb-device.tpm2].
>>>>> See source file tests/qtest/bios-tables-test.c for instructions on how
>>>>> to update expected files.
>>>>> to see ASL diff between mismatched files install IASL, rebuild QEMU
>>>>> from scratch and re-run tests with V=1 environment variable set**
>>>>> ERROR:../tests/qtest/bios-tables-test.c:538:test_acpi_asl: assertion
>>>>> failed: (all_tables_match)
>>>>> not ok /aarch64/acpi/virt/tpm2-crb -
>>>>> ERROR:../tests/qtest/bios-tables-test.c:538:test_acpi_asl: assertion
>>>>> failed: (all_tables_match)
>>>>> Bail out!
>>>>> qemu-system-aarch64: tpm-emulator: Could not cleanly shutdown the TPM:
>>>>> Resource temporarily unavailable
>>>>> Unexpected error in qio_channel_socket_writev() at
>>>>> ../io/channel-socket.c:622:
>>>>> /home/elmarco/src/qemu/buildall/tests/qtest/bios-tables-test: Unable
>>>>> to write to socket: Bad file descriptor
>>>>>
>>>>
>>>> Travis testing on s390x I see the following failures for this patchset
>>>> (search for 'ERROR'):
>>>>
>>>> https://app.travis-ci.com/github/stefanberger/qemu-tpm/builds/267230363
>>>>
>>>> Summary of Failures:
>>>>
>>>> 134/320 qemu:qtest+qtest-aarch64 / qtest-aarch64/tpm-crb-device-test
>>>> ERROR           0.70s   killed by signal 6 SIGABRT
>>>>
>>>> 219/320 qemu:qtest+qtest-x86_64 / qtest-x86_64/tpm-crb-test
>>>> ERROR           0.88s   killed by signal 6 SIGABRT
>>>>
>>>>
>>>> Summary of Failures:
>>>>
>>>> 271/537 qemu:qtest+qtest-i386 / qtest-i386/tpm-crb-test
>>>> ERROR           0.59s   killed by signal 6 SIGABRT
>>>>
>>>>
>>>> My guess is it's an endianess issue on big endian machines due to
>>>> reading from the ROM device where we lost the .endianess:
>>>>
>>>> +const MemoryRegionOps tpm_crb_memory_ops = {
>>>> +    .read = tpm_crb_mmio_read,
>>>> +    .write = tpm_crb_mmio_write,
>>>> +    .endianness = DEVICE_LITTLE_ENDIAN,
>>>> +    .valid = {
>>>> +        .min_access_size = 1,
>>>> +        .max_access_size = 4,
>>>> +    },
>>>> +};
>>>>
>>>
>>> I think we need a 2nd set of registers to support the endianess
>>> conversion. It's not exactly nice, though. Basically the saved_regs
>>> could be used for this directly, even though I did not do that but
>>> introduced n_regs:
>>> https://github.com/stefanberger/qemu-tpm/commit/90f6b21c0dd93dbb13d9e80a628f5b631fd07d91
>>>
>>> This patch allows the tests on s390x to run farther but the execution of
>>> the command doesn't seem to work maybe due to command data that were
>>> also written in wrong endianess. I don't know. I would have to get
>>> access to a big endian / s390 machine to be able to fix it.
>>>
>>>
>>
>> The latest version now passes on Travis s390x:
>> https://app.travis-ci.com/github/stefanberger/qemu-tpm/builds/267245220
>>
> 
> Are the tests failing on S390X due to the added code or are they
> failing because previously it was untested? I don't think the original
> code took account of endianness and that should be fixed, but feels
> like it should be in a separate patch set?

They are failing because something like the topmost one or two patches 
as in this branch here are missing for a big endian host:

https://github.com/stefanberger/qemu-tpm/tree/joelle.v5%2B2nd_registers


  reply	other threads:[~2023-11-24 16:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14  2:09 [PATCH v5 00/14] tpm: introduce TPM CRB SysBus device Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 01/14] tpm_crb: refactor common code Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 02/14] tpm_crb: CTRL_RSP_ADDR is 64-bits wide Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 03/14] tpm_ppi: refactor memory space initialization Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 04/14] tpm_crb: use a single read-as-mem/write-as-mmio mapping Joelle van Dyne
2023-11-14 15:46   ` Stefan Berger
2023-11-14  2:09 ` [PATCH v5 05/14] tpm_crb: move ACPI table building to device interface Joelle van Dyne
2023-11-14 16:37   ` Stefan Berger
2023-11-14 16:44     ` Stefan Berger
2023-11-14 19:29       ` Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 06/14] tpm-sysbus: add plug handler for TPM on SysBus Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 07/14] hw/arm/virt: connect TPM to platform bus Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 08/14] hw/loongarch/virt: " Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 09/14] tpm_tis_sysbus: move DSDT AML generation to device Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 10/14] tests: acpi: prepare for TPM CRB tests Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 11/14] tpm_crb_sysbus: introduce TPM CRB SysBus device Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 12/14] tests: acpi: implement TPM CRB tests for ARM virt Joelle van Dyne
2023-11-14  9:36   ` Marc-André Lureau
2023-11-14 13:04     ` Stefan Berger
2023-11-14 18:03     ` Stefan Berger
2023-11-14 21:05       ` Stefan Berger
2023-11-15  0:12         ` Stefan Berger
2023-11-24  0:56           ` Joelle van Dyne
2023-11-24 16:17             ` Stefan Berger [this message]
2023-11-24 16:21               ` Joelle van Dyne
2023-11-24 16:26                 ` Stefan Berger
2023-11-25  2:39                   ` Joelle van Dyne
2023-11-27 14:12                     ` Stefan Berger
2023-11-14  2:09 ` [PATCH v5 13/14] tests: acpi: updated expected blobs for TPM CRB Joelle van Dyne
2023-11-14  2:09 ` [PATCH v5 14/14] tests: add TPM-CRB sysbus tests for aarch64 Joelle van Dyne
2023-11-14  9:38 ` [PATCH v5 00/14] tpm: introduce TPM CRB SysBus device Marc-André Lureau
2023-11-14 19:25   ` Joelle van Dyne
2023-11-20  8:29     ` Marc-André Lureau
2023-11-20 15:01       ` Stefan Berger
2024-04-30 11:54 ` Peter Maydell

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=d850ca40-d822-4e7d-b2ee-848f6d4208a7@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=anisinha@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=j@getutm.app \
    --cc=marcandre.lureau@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).