X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=tests%2Fprom-env-test.c;h=61bc1d1e7b2e972cbde356baef633426946a85bc;hb=c4107e8208d0222f9b328691b519aaee4101db87;hp=bd33bc353d437f859603ea27e42e53cd83aca56e;hpb=61eedf7aec0e2395aabd628cc055096909a3ea15;p=mirror_qemu.git diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c index bd33bc353d..61bc1d1e7b 100644 --- a/tests/prom-env-test.c +++ b/tests/prom-env-test.c @@ -1,7 +1,7 @@ /* - * Test OpenBIOS-based machines. + * Test Open-Firmware-based machines. * - * Copyright (c) 2016 Red Hat Inc. + * Copyright (c) 2016, 2017 Red Hat Inc. * * Author: * Thomas Huth @@ -25,14 +25,14 @@ #define MAGIC 0xcafec0de #define ADDRESS 0x4000 -static void check_guest_memory(void) +static void check_guest_memory(QTestState *qts) { uint32_t signature; int i; - /* Poll until code has run and modified memory. Wait at most 120 seconds */ - for (i = 0; i < 12000; ++i) { - signature = readl(ADDRESS); + /* Poll until code has run and modified memory. Wait at most 600 seconds */ + for (i = 0; i < 60000; ++i) { + signature = qtest_readl(qts, ADDRESS); if (signature == MAGIC) { break; } @@ -44,21 +44,24 @@ static void check_guest_memory(void) static void test_machine(const void *machine) { - char *args; - const char *extra_args; - - /* The pseries firmware boots much faster without the default devices */ - extra_args = strcmp(machine, "pseries") == 0 ? "-nodefaults" : ""; - - args = g_strdup_printf("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " - "-prom-env 'nvramrc=%x %x l!' ", - (const char *)machine, extra_args, MAGIC, ADDRESS); - - qtest_start(args); - check_guest_memory(); - qtest_quit(global_qtest); + const char *extra_args = ""; + QTestState *qts; + + /* + * The pseries firmware boots much faster without the default + * devices, it also needs Spectre/Meltdown workarounds disabled to + * avoid warnings with TCG + */ + if (strcmp(machine, "pseries") == 0) { + extra_args = "-nodefaults" + " -machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken"; + } - g_free(args); + qts = qtest_initf("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " + "-prom-env 'nvramrc=%x %x l!' ", (const char *)machine, + extra_args, MAGIC, ADDRESS); + check_guest_memory(qts); + qtest_quit(qts); } static void add_tests(const char *machines[]) @@ -76,9 +79,8 @@ static void add_tests(const char *machines[]) int main(int argc, char *argv[]) { const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", NULL }; - const char *sparc64_machines[] = { "sun4u", "sun4v", NULL }; + const char *sparc64_machines[] = { "sun4u", NULL }; const char *ppc_machines[] = { "mac99", "g3beige", NULL }; - const char *ppc64_machines[] = { "mac99", "g3beige", "pseries", NULL }; const char *arch = qtest_get_arch(); g_test_init(&argc, &argv, NULL); @@ -86,7 +88,10 @@ int main(int argc, char *argv[]) if (!strcmp(arch, "ppc")) { add_tests(ppc_machines); } else if (!strcmp(arch, "ppc64")) { - add_tests(ppc64_machines); + add_tests(ppc_machines); + if (g_test_slow()) { + qtest_add_data_func("prom-env/pseries", "pseries", test_machine); + } } else if (!strcmp(arch, "sparc")) { add_tests(sparc_machines); } else if (!strcmp(arch, "sparc64")) {