From nobody Wed Oct 29 11:49:23 2025 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525414487848153.484059141456; Thu, 3 May 2018 23:14:47 -0700 (PDT) Received: from localhost ([::1]:60727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fETzT-0001Vh-3P for importer@patchew.org; Fri, 04 May 2018 02:14:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fETkw-00069T-Mj for qemu-devel@nongnu.org; Fri, 04 May 2018 01:59:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fETku-0007Xy-Us for qemu-devel@nongnu.org; Fri, 04 May 2018 01:59:46 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42143) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fETku-0007R1-Eu; Fri, 04 May 2018 01:59:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 40chDT2H8Wz9s8p; Fri, 4 May 2018 15:59:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1525413577; bh=LHPocH22l98hjJWZUctX2ctaGTliIMHsNyB/OQLuNqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oB1NHklWsfJJd6vKYND5tbv8gdtu5mOjo8SuftFdBTDcRqTV18q3B4xT2mKvz8cMU pZYg8U12Hxcp4GQPcQ0+P9m2IeXoiXkBNkVmOLPv+TrjfMW2ytB85cxl9K/tCAtzxK 8V7xcNIrbmKGFj6CFg8C3UBppz9FsJpkinS8I9+A= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 4 May 2018 15:59:30 +1000 Message-Id: <20180504055930.3786-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504055930.3786-1-david@gibson.dropbear.id.au> References: <20180504055930.3786-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 17/17] 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: lvivier@redhat.com, groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson 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 --- 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 19997f66c0..32ab3c43b6 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2512,6 +2512,7 @@ static void spapr_machine_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 @@ -2592,11 +2593,6 @@ static void spapr_machine_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) { @@ -2614,6 +2610,15 @@ static void spapr_machine_init(MachineState *machine) /* init CPUs */ 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.17.0