From nobody Mon Feb 9 23:01:05 2026 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; dkim=fail; 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529377083515710.244654509908; Mon, 18 Jun 2018 19:58:03 -0700 (PDT) Received: from localhost ([::1]:38809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6qD-0007vc-IS for importer@patchew.org; Mon, 18 Jun 2018 22:57:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5jB-0002kH-I2 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5jA-0000RW-GM for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:37 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:35012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5jA-0000RQ-Ag; Mon, 18 Jun 2018 21:46:36 -0400 Received: by mail-oi0-x244.google.com with SMTP id e8-v6so16715150oii.2; Mon, 18 Jun 2018 18:46:36 -0700 (PDT) Received: from localhost ([2600:1700:70:e488:b0ee:9bda:ee6f:91be]) by smtp.gmail.com with ESMTPSA id q45-v6sm8236618otg.56.2018.06.18.18.46.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9tjAKbPgny696731XBfyhj+4ngyr+HgUq64S7Qf3juk=; b=ZJKcR+bl35bN29b1VqJfQGMbyZ93OvW+5qLVG/Y4fe1Rg2DCmgeoZJhTTxpJAUzeap 8WaNgrzOM/XQSdoJXsFRbaEcNQ7WguoO+nwgoYGzrDwyLOdGqpWe6EvhilVq/1JI677F dXR+jSj0d55GOiqJGChdaF7qdFVL/+fMyt52NGwd2azF5XMQEfCeKoYHV76boxs//rI/ 3ThryIxLZtIfNL3rFv2/h0e+c7747l6o0XlnVV6a7LClW/HhDN5TnkynGdp1anQ7+r0O JaXPty8UvmTIzAQhxKWHi/WA9BlvD/gNqNLhSAv0cDrH4My0Ao9IcU2+FILsKDpR/O4X yWyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9tjAKbPgny696731XBfyhj+4ngyr+HgUq64S7Qf3juk=; b=jgH/yS3l1/Cvklni5xRG4UxwEnhaVBN99wUl0w4y9PpQgGgTOpA43Q5hCA+3AasK6o N3+ugrwTOL/wNzP/mIscSJJTSkMyRC+RVpgr4CxsMBL2MVKfKCNEqfC8JgdWiTWTGEjo oZ8eUS9rPVZpbs5ABIcbv7PEKfuMQp3H4EdzRuYir/Gy7wZ1Zk9Gvc4zP9b+U70oSeM5 hIDaPtOfR2kXT9ONYLz6xNjANB1r5bwQyRjQPsHRd8mu9574oMhWCBrG0jRnkjnSC1Sj ZHiTqE+JsftWkrlLUYCggHVQvDyZLRdkVvwaxhKKEO4VDlRtReJcyh2roQnCmes8GoHn uP1g== X-Gm-Message-State: APt69E2LLUgdd3tC9RIIYCFe4RTRjGlo6S3UZ5ZAJHA21PW8nY2Mjven hCqFAiGbUk+DsqM/gos8iU/C+rGuq0U= X-Google-Smtp-Source: ADUXVKJD9/2Jqv4vZwrXuTcmXT03a9ClgSG2D+cyBXoskW71plunWiv9EyiTOcuJAs0awbStbfoaZg== X-Received: by 2002:aca:75cc:: with SMTP id q195-v6mr7736064oic.292.1529372794979; Mon, 18 Jun 2018 18:46:34 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:33 -0500 Message-Id: <20180619014319.28272-68-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::244 Subject: [Qemu-devel] [PATCH 067/113] spapr: don't advertise radix GTSE if max-compat-cpu < power9 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: David Gibson , qemu-stable@nongnu.org, Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz On a POWER9 host, if a guest runs in pre POWER9 compat mode, it necessarily uses the hash MMU mode. In this case, we shouldn't advertise radix GTSE in the ibm,arch-vec-5-platform-support DT property as the current code does. The first reason is that it doesn't make sense, and the second one is that causes the CAS-negotiated options subsection to be migrated. This breaks backward migration to QEMU 2.7 and older versions on POWER8 hosts: qemu-system-ppc64: error while loading state for instance 0x0 of device 'spapr' qemu-system-ppc64: load of migration failed: No such file or directory This patch hence initialize CPUs a bit earlier so that we can check the requested compat mode, and don't set OV5_MMU_RADIX_GTSE for power8 and older. Signed-off-by: Greg Kurz Signed-off-by: David Gibson (cherry picked from commit 0550b1206a91d66051a21441a02c4ff126b531fe) Signed-off-by: Michael Roth --- hw/ppc/spapr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6499a86752..a74eb2dc68 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2356,6 +2356,7 @@ static void ppc_spapr_init(MachineState *machine) long load_limit, fw_size; char *filename; Error *resize_hpt_err =3D NULL; + PowerPCCPU *first_ppc_cpu; =20 msi_nonbroken =3D true; =20 @@ -2448,11 +2449,6 @@ static void ppc_spapr_init(MachineState *machine) } =20 spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); - if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { - /* KVM and TCG always allow GTSE with radix... */ - spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); - } - /* ... but not with hash (currently). */ =20 /* advertise support for dedicated HP event source to guests */ if (spapr->use_hotplug_event_source) { @@ -2469,6 +2465,15 @@ static void ppc_spapr_init(MachineState *machine) =20 spapr_init_cpus(spapr); =20 + first_ppc_cpu =3D POWERPC_CPU(first_cpu); + if ((!kvm_enabled() || kvmppc_has_cap_mmu_radix()) && + ppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0, + spapr->max_compat_pvr)) { + /* KVM and TCG always allow GTSE with radix... */ + spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); + } + /* ... but not with hash (currently). */ + if (kvm_enabled()) { /* Enable H_LOGICAL_CI_* so SLOF can talk to in-kernel devices */ kvmppc_enable_logical_ci_hcalls(); --=20 2.11.0