From: Stefan Berger <stefanb@linux.ibm.com>
To: Eric Auger <eric.auger@redhat.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: [PATCH v2 4/5] bios-tables-test: Add Q35/TPM-TIS test
Date: Wed, 10 Jun 2020 12:39:13 -0400 [thread overview]
Message-ID: <657c5530-728f-fd1d-fd4e-e0ca62cdd029@linux.ibm.com> (raw)
In-Reply-To: <20200609125409.24179-5-eric.auger@redhat.com>
On 6/9/20 8:54 AM, Eric Auger wrote:
> Test tables specific to the TPM-TIS instantiation.
> The TPM2 is added in the framework. Also the DSDT
> is updated with the TPM. The new function should be
> be usable for CRB as well, later one.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
>
> ---
>
> v2 -> v3:
> - use test_acpi_tcg_tpm() helper and stick to the current
> qtest_add_func model
> - hardcode TPM_TIS_ADDR_BASE
> ---
> tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++++++
> tests/qtest/Makefile.include | 1 +
> 2 files changed, 59 insertions(+)
>
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index c9843829b3..53f104a9c5 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -57,6 +57,9 @@
> #include "qemu/bitmap.h"
> #include "acpi-utils.h"
> #include "boot-sector.h"
> +#include "tpm-emu.h"
> +#include "hw/acpi/tpm.h"
> +
>
> #define MACHINE_PC "pc"
> #define MACHINE_Q35 "q35"
> @@ -874,6 +877,60 @@ static void test_acpi_piix4_tcg_numamem(void)
> free_test_data(&data);
> }
>
> +uint64_t tpm_tis_base_addr;
> +
> +static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
> + uint64_t base)
> +{
> + gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
> + machine, tpm_if);
> + char *tmp_path = g_dir_make_tmp(tmp_dir_name, NULL);
> + TestState test;
> + test_data data;
> + GThread *thread;
> + char *args, *variant = g_strdup_printf(".%s", tpm_if);
> +
> + tpm_tis_base_addr = base;
> +
> + module_call_init(MODULE_INIT_QOM);
> +
> + test.addr = g_new0(SocketAddress, 1);
> + test.addr->type = SOCKET_ADDRESS_TYPE_UNIX;
> + test.addr->u.q_unix.path = g_build_filename(tmp_path, "sock", NULL);
> + g_mutex_init(&test.data_mutex);
> + g_cond_init(&test.data_cond);
> + test.data_cond_signal = false;
> +
> + thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
> + tpm_emu_test_wait_cond(&test);
> +
> + memset(&data, 0, sizeof(data));
> + data.machine = machine;
> + data.variant = variant;
> +
> + args = g_strdup_printf(
> + " -chardev socket,id=chr,path=%s"
> + " -tpmdev emulator,id=dev,chardev=chr"
> + " -device tpm-%s,tpmdev=dev",
> + test.addr->u.q_unix.path, tpm_if);
> +
> + test_acpi_one(args, &data);
> +
> + g_thread_join(thread);
> + g_unlink(test.addr->u.q_unix.path);
> + qapi_free_SocketAddress(test.addr);
> + g_rmdir(tmp_path);
> + g_free(variant);
> + g_free(tmp_path);
> + g_free(tmp_dir_name);
> + free_test_data(&data);
> +}
> +
> +static void test_acpi_q35_tcg_tpm_tis(void)
> +{
> + test_acpi_tcg_tpm("q35", "tis", 0xFED40000);
> +}
> +
> static void test_acpi_tcg_dimm_pxm(const char *machine)
> {
> test_data data;
> @@ -1037,6 +1094,7 @@ int main(int argc, char *argv[])
> return ret;
> }
>
> + qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> diff --git a/tests/qtest/Makefile.include b/tests/qtest/Makefile.include
> index 9e5a51d033..5023fa413d 100644
> --- a/tests/qtest/Makefile.include
> +++ b/tests/qtest/Makefile.include
> @@ -262,6 +262,7 @@ tests/qtest/hd-geo-test$(EXESUF): tests/qtest/hd-geo-test.o $(libqos-obj-y)
> tests/qtest/boot-order-test$(EXESUF): tests/qtest/boot-order-test.o $(libqos-obj-y)
> tests/qtest/boot-serial-test$(EXESUF): tests/qtest/boot-serial-test.o $(libqos-obj-y)
> tests/qtest/bios-tables-test$(EXESUF): tests/qtest/bios-tables-test.o \
> + tests/qtest/tpm-emu.o $(test-io-obj-y) \
> tests/qtest/boot-sector.o tests/qtest/acpi-utils.o $(libqos-obj-y)
> tests/qtest/pxe-test$(EXESUF): tests/qtest/pxe-test.o tests/qtest/boot-sector.o $(libqos-obj-y)
> tests/qtest/microbit-test$(EXESUF): tests/qtest/microbit-test.o
next prev parent reply other threads:[~2020-06-10 16:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 12:54 [PATCH v2 0/5] TPM-TIS bios-tables-test Eric Auger
2020-06-09 12:54 ` [PATCH v2 1/5] test/tpm-emu: include sockets and channel headers in tpm-emu header Eric Auger
2020-06-09 12:54 ` [PATCH v2 2/5] tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test Eric Auger
2020-06-09 12:54 ` [PATCH v2 3/5] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS Eric Auger
2020-06-10 16:38 ` Stefan Berger
2020-06-09 12:54 ` [PATCH v2 4/5] bios-tables-test: Add Q35/TPM-TIS test Eric Auger
2020-06-10 16:39 ` Stefan Berger [this message]
2020-06-09 12:54 ` [PATCH v2 5/5] bios-tables-test: Generate reference tables for Q35/TPM-TIS Eric Auger
2020-06-09 14:00 ` [PATCH v2 0/5] TPM-TIS bios-tables-test no-reply
2020-06-09 14:24 ` Auger Eric
2020-06-09 14:15 ` no-reply
2020-06-09 14:30 ` no-reply
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=657c5530-728f-fd1d-fd4e-e0ca62cdd029@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.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 \
/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).