From nobody Mon Feb 9 23:01:06 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152937744438278.64224274500236; Mon, 18 Jun 2018 20:04:04 -0700 (PDT) Received: from localhost ([::1]:38877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6w7-0004fA-Lu for importer@patchew.org; Mon, 18 Jun 2018 23:04:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5j8-0002hA-KZ for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5j7-0000Qm-P9 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:34 -0400 Received: from mail-ot0-x244.google.com ([2607:f8b0:4003:c0f::244]:42760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5j7-0000QY-KF; Mon, 18 Jun 2018 21:46:33 -0400 Received: by mail-ot0-x244.google.com with SMTP id 92-v6so20761714otw.9; Mon, 18 Jun 2018 18:46:33 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id p128-v6sm6852482oif.21.2018.06.18.18.46.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:46:31 -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=XO3xLv2nVNNZizsElZCHP2rld+H3I5aK+P4ErQU1/Uc=; b=Y1jOGUmOdj6PJhZbYMC1C/Blbz1lbvPNSqpyD+RNJO2R2r9fhTWPIesOaXyEpAB5B9 MJl7ySk5vIa5osMNv3NDcgQXcdSN9NXsKkRaLWiVeI3wK1Hk8TbohlFYIhZ1hiALLEJv JZMeJ6H8f9Y4Ixsgwbz/+AS2F5ZWnTV+v4jsV9TmId29Fk6TJ9LIrllmD2tywoKoIzIU RcSz1WdyCSyRyMOsXg2lVGJwPZQeXsa2jUn6VumLpiPkIfZjZdF8TrqBLzEQuSZw8ko/ fJj1TX7LN2DY0bgVm7YmjUgYucsbM8WaGJqp+UMHy2uTnLLMBnNv3+lHhRqFdlDpV/zC +z0g== 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=XO3xLv2nVNNZizsElZCHP2rld+H3I5aK+P4ErQU1/Uc=; b=jYobJu5tX8nSStmjFvQXhICrzwv4sE8VBjrmzJSPQEKa2u9zDP1ScuvrHwx5foHfBt Ta1pEZnhr5CPaiqfAX8llcT8hEH63U8wahudlD400f5TDtqnM7SoV/pEiJTGD5C5D6Na UoN2hx6WAXMWWtuzu/u0q3lhdLpZF9UC1lzYpPDFxAr2WfnACWh93NmcUzYPrnU+QfhP Bai9HcXSBPp6CcydFRP1Q+FcRxvdbNH0Ud2OcdDyEDL9CT7aQZg9PMKtj26a1+C0dVwG aYhQiu2/fctrbRvqZ5ANDSCsOCoXzRFyin+MmiiMvgvnVzAVALHhFbhzIvUBIarfjHsf 5vAg== X-Gm-Message-State: APt69E3orkXjijQGGsYikRHsgo5zCvDAp4/fWuOQpBCxby3+bi/45DAB sM6oycZyv3s4iHJmNUQpik4pVXbU2H4= X-Google-Smtp-Source: ADUXVKKSbZVHmNLDKvIiF4cAPN//6XcyxYKC4gjzAHbUGw99Y/qxVqhA0GusT6GBEYUG5JOc+grT1g== X-Received: by 2002:a9d:70d3:: with SMTP id w19-v6mr8477232otj.147.1529372792482; Mon, 18 Jun 2018 18:46:32 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:32 -0500 Message-Id: <20180619014319.28272-67-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:c0f::244 Subject: [Qemu-devel] [PATCH 066/113] 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: 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 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 (cherry picked from commit bce009645b9f1d59195518e35747c8ea30f985f7) Signed-off-by: Michael Roth --- target/ppc/machine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index e475206c6a..feeb449e4d 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -192,6 +192,11 @@ static int cpu_pre_save(void *opaque) if (cpu->pre_2_8_migration) { cpu->mig_msr_mask =3D env->msr_mask; 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.11.0