From nobody Tue May 7 21:09:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529500117174460.37823754878673; Wed, 20 Jun 2018 06:08:37 -0700 (PDT) Received: from localhost ([::1]:49419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVcqi-0004WY-9W for importer@patchew.org; Wed, 20 Jun 2018 09:08:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVcdA-0002c8-AJ for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:54:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVcd7-0008Fk-6e for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:54:36 -0400 Received: from 2.mo179.mail-out.ovh.net ([178.33.250.45]:37155) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVcd6-0008FJ-TG for qemu-devel@nongnu.org; Wed, 20 Jun 2018 08:54:33 -0400 Received: from player786.ha.ovh.net (unknown [10.109.120.26]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 1E805D104B for ; Wed, 20 Jun 2018 14:54:30 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player786.ha.ovh.net (Postfix) with ESMTPA id 3709938009D; Wed, 20 Jun 2018 14:54:21 +0200 (CEST) From: Greg Kurz To: qemu-stable@nongnu.org Date: Wed, 20 Jun 2018 14:54:15 +0200 Message-ID: <152949925592.606785.4717120428688653960.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 5657928509191657778 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtiedrtddvgdehudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.250.45 Subject: [Qemu-devel] [PATCH v2 for-2.11.2] spapr: make pseries-2.11 the default machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Gibson , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The spapr capability framework was introduced in QEMU 2.12. It allows to have an explicit control on how host features are exposed to the guest. This is especially needed to handle migration between hetero- geneous hosts (eg, POWER8 to POWER9). It is also used to expose fixes/ workarounds against speculative execution vulnerabilities to guests. The framework was hence backported to QEMU 2.11.1, especially these commits: 0fac4aa93074 spapr: Add pseries-2.12 machine type 9070f408f491 spapr: Treat Hardware Transactional Memory (HTM) as an optional capability 0fac4aa93074 has the confusing effect of making pseries-2.12 the default machine type for QEMU 2.11.1, instead of the expected pseries-2.11. This patch changes the default machine back to pseries-2.11. Unfortunately, 9070f408f491 enforces the HTM capability for pseries-2.11 to be enabled by default, ie, when not passing cap-htm on the command line. This breaks several 'make check' testcases that run qemu-system-ppc64 with TCG. The only sane way to fix this is to adapt the impacted testcases so that they all pass cap-htm=3Doff in this case. This patch does that as well. Signed-off-by: Greg Kurz Reviewed-by: David Gibson --- v2: - have the testcases to pass cap-htm=3Doff instead of violating the capabilities logic. Upstream doesn't need anything like that since newer pseries machine types start with HTM disabled by default. This is really a oneshot fix for 2.11.2, and I've tried to make it as small as possible. This is a full replacement of the previous version. It is based on Mike's staging tree for 2.11: https://github.com/mdroth/qemu/commits/stable-2.11-staging 72cc467aabd1a2 --- hw/ppc/spapr.c | 4 ++-- tests/boot-serial-test.c | 8 ++++++-- tests/migration-test.c | 4 ++-- tests/prom-env-test.c | 6 ++++-- tests/pxe-test.c | 10 +++++++--- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 1a2dd1f597d9..6499a867520f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3820,7 +3820,7 @@ static void spapr_machine_2_12_class_options(MachineC= lass *mc) /* Defaults for the latest behaviour inherited from the base class */ } =20 -DEFINE_SPAPR_MACHINE(2_12, "2.12", true); +DEFINE_SPAPR_MACHINE(2_12, "2.12", false); =20 /* * pseries-2.11 @@ -3842,7 +3842,7 @@ static void spapr_machine_2_11_class_options(MachineC= lass *mc) SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11); } =20 -DEFINE_SPAPR_MACHINE(2_11, "2.11", false); +DEFINE_SPAPR_MACHINE(2_11, "2.11", true); =20 /* * pseries-2.10 diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index c935d69824bd..98c5462377f8 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -73,18 +73,22 @@ static void test_machine(const void *data) const testdef_t *test =3D data; char tmpname[] =3D "/tmp/qtest-boot-serial-XXXXXX"; int fd; + const char *machine_props; =20 fd =3D mkstemp(tmpname); g_assert(fd !=3D -1); =20 + machine_props =3D strcmp(test->machine, "pseries") =3D=3D 0 ? ",cap-ht= m=3Doff" : ""; + /* * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - global_qtest =3D qtest_startf("-M %s,accel=3Dtcg:kvm " + global_qtest =3D qtest_startf("-M %s%s,accel=3Dtcg:kvm " "-chardev file,id=3Dserial0,path=3D%s " "-no-shutdown -serial chardev:serial0 %s", - test->machine, tmpname, test->extra); + test->machine, machine_props, tmpname, + test->extra); unlink(tmpname); =20 check_guest_output(test, fd); diff --git a/tests/migration-test.c b/tests/migration-test.c index be598d3257ba..906d29b38241 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -460,12 +460,12 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, /* On ppc64, the test only works with kvm-hv, but not with kvm-pr = */ accel =3D access("/sys/module/kvm_hv", F_OK) ? "tcg" : "kvm:tcg"; init_bootfile_ppc(bootpath); - cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 256M" + cmd_src =3D g_strdup_printf("-machine accel=3D%s,cap-htm=3Doff -m = 256M" " -name pcsource,debug-threads=3Don" " -serial file:%s/src_serial" " -drive file=3D%s,if=3Dpflash,format=3D= raw", accel, tmpfs, bootpath); - cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 256M" + cmd_dst =3D g_strdup_printf("-machine accel=3D%s,cap-htm=3Doff -m = 256M" " -name pcdest,debug-threads=3Don" " -serial file:%s/dest_serial" " -incoming %s", diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c index 8c867e631ab6..f6946090d183 100644 --- a/tests/prom-env-test.c +++ b/tests/prom-env-test.c @@ -45,14 +45,16 @@ static void check_guest_memory(void) static void test_machine(const void *machine) { const char *extra_args; + const char *extra_props; =20 /* The pseries firmware boots much faster without the default devices = */ extra_args =3D strcmp(machine, "pseries") =3D=3D 0 ? "-nodefaults" : "= "; + extra_props =3D strcmp(machine, "pseries") =3D=3D 0 ? ",cap-htm=3Doff"= : ""; =20 - global_qtest =3D qtest_startf("-M %s,accel=3Dtcg %s " + global_qtest =3D qtest_startf("-M %s%s,accel=3Dtcg %s " "-prom-env 'use-nvramrc?=3Dtrue' " "-prom-env 'nvramrc=3D%x %x l!' ", - (const char *)machine, extra_args, + (const char *)machine, extra_props, extra_= args, MAGIC, ADDRESS); check_guest_memory(); qtest_quit(global_qtest); diff --git a/tests/pxe-test.c b/tests/pxe-test.c index 937f29e63193..f3a65bd80cb1 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -25,11 +25,15 @@ static char disk[] =3D "tests/pxe-test-disk-XXXXXX"; static void test_pxe_one(const char *params, bool ipv6) { char *args; + const char *machine_props; =20 - args =3D g_strdup_printf("-machine accel=3Dkvm:tcg -nodefaults -boot o= rder=3Dn " + machine_props =3D + strcmp(qtest_get_arch(), "ppc64") =3D=3D 0 ? ",cap-htm=3Doff" : ""; + + args =3D g_strdup_printf("-machine accel=3Dkvm:tcg%s -nodefaults -boot= order=3Dn " "-netdev user,id=3D" NETNAME ",tftp=3D./,bootfi= le=3D%s," - "ipv4=3D%s,ipv6=3D%s %s", disk, ipv6 ? "off" : = "on", - ipv6 ? "on" : "off", params); + "ipv4=3D%s,ipv6=3D%s %s", machine_props, disk, + ipv6 ? "off" : "on", ipv6 ? "on" : "off", param= s); =20 qtest_start(args); boot_sector_test();