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 1525414415495393.02536337210324; Thu, 3 May 2018 23:13:35 -0700 (PDT) Received: from localhost ([::1]:60719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fETyH-0000Do-SZ for importer@patchew.org; Fri, 04 May 2018 02:13:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fETkv-00068Y-PV for qemu-devel@nongnu.org; Fri, 04 May 2018 01:59:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fETku-0007V7-0e for qemu-devel@nongnu.org; Fri, 04 May 2018 01:59:45 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:33277) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fETkt-0007Oi-Fx; Fri, 04 May 2018 01:59:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 40chDS3KLkz9s8k; Fri, 4 May 2018 15:59:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1525413576; bh=EoOhIUFfs6M61LTrJOCSzU8rwjvU5adBgiFbUgVtBOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iwWHKnbBSenTeasmnzGVzvBIruRjTb0P+Mh5AaQFI876pk7KdeowTdYLlv2iu4lwG +7QjZtyNKMGTOrSBzc3KJdsL+z+IUagpQp7iob7gf10Ebsb1e1Re8moumWVmRU+OdM sypPLpUeBtTpJlnr1QWLb+MVP7u8x2VuOp/AKo7I= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 4 May 2018 15:59:28 +1000 Message-Id: <20180504055930.3786-16-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 15/17] target/ppc: always set PPC_MEM_TLBIE in pre 2.8 migration hack 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 The pseries-2.7 and older machine types require CPUPPCState::insns_flags to be strictly equal between source and destination. This checking is abusive and breaks migration of KVM guests when the host CPU models are different, even if they are compatible enough to allow the guest to run transparently. This buggy behaviour was fixed for pseries-2.8 and we added some hacks to allow backward migration of older machine types. These hacks assume that the CPU belongs to the POWER8 family, which was true for most KVM based setup we cared about at the time. But now POWER9 systems are coming, and backward migration of pre 2.8 guests running in POWER8 architected mode from a POWER9 host to a POWER8 host is broken: qemu-system-ppc64: error while loading state for instance 0x0 of device 'cpu' qemu-system-ppc64: load of migration failed: Invalid argument This happens because POWER9 doesn't set PPC_MEM_TLBIE in insns_flags, while POWER8 does. Let's force PPC_MEM_TLBIE in the migration hack to fix the issue. This is an acceptable hack because these old machine types only support CPU models that do set PPC_MEM_TLBIE. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- target/ppc/machine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 3d6434a006..ba1b9e531f 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -212,6 +212,11 @@ static int cpu_pre_save(void *opaque) ; cpu->mig_msr_mask =3D env->msr_mask & ~metamask; cpu->mig_insns_flags =3D env->insns_flags & insns_compat_mask; + /* CPU models supported by old machines all have PPC_MEM_TLBIE, + * so we set it unconditionally to allow backward migration from + * a POWER9 host to a POWER8 host. + */ + cpu->mig_insns_flags |=3D PPC_MEM_TLBIE; cpu->mig_insns_flags2 =3D env->insns_flags2 & insns_compat_mask2; cpu->mig_nb_BATs =3D env->nb_BATs; } --=20 2.17.0