/*
- * Test OpenBIOS-based machines.
+ * Test Open-Firmware-based machines.
*
- * Copyright (c) 2016 Red Hat Inc.
+ * Copyright (c) 2016, 2017 Red Hat Inc.
*
* Author:
#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;
}
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[])
const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", 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);
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")) {