From nobody Sun Feb 8 10:33:55 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 1532381777548411.7265649658026; Mon, 23 Jul 2018 14:36:17 -0700 (PDT) Received: from localhost ([::1]:36831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiUy-0004GI-G3 for importer@patchew.org; Mon, 23 Jul 2018 17:36:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhLC-0004PZ-OV for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:22:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhLA-0005g4-Vq for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:58 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:41195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhLA-0005fr-Pi; Mon, 23 Jul 2018 16:21:56 -0400 Received: by mail-oi0-x241.google.com with SMTP id k12-v6so3472578oiw.8; Mon, 23 Jul 2018 13:21:56 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id j193-v6sm7591528oih.55.2018.07.23.13.21.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:54 -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=NULqqU/3dIueE3+ZPBvLtCUWVQe7/KOjN1JMityETwE=; b=GmF1nv2qt7ACrGnu/ghrvOkSjwQT5XI7Irx5GOhi9K7eDcektH2npNa2RI3d8sRMbn Z3yDmc7aQNSjFAWbph5IvyXmyH+N79aKSkvzrs7CpZUShiRkNubMpKiCTkvxsVS/cRHT 5Fc8vCQOX0OKaIuhTEVAFhpazoZhoVqOU1DGWzz21OKxNA94BR2aXV/Eqz+7TH52UxIU RrB6AVEUUdg+SfSt3BtsS6RgF9jQp6ag+N4bjOBCNDJ4aWkmw41NZmUBC/4MDI8Nb9fD K+nyFJs8SQ6MN8NdxK6rSj5+8XCFb/G9QbZfdIt/6zQzzsP2Jp9XKcXqXvFbWZ/E07Fb PV5A== 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=NULqqU/3dIueE3+ZPBvLtCUWVQe7/KOjN1JMityETwE=; b=X3iNRwP3WNW6I8Q2hYdG/8w85nWYvC6tgA7klBxMU9R4x5wnIqfLHRw+BXGapSZM3/ dliDGuSEDA5Ny1+8xZYBIKVsGfXbi9OfmMGgIow/ymRM+Ygr002basQ8o4H3lN/rKzxT OGAOE4AXxqVBErfdxkE1ejpO2JMx3hPBxHoK0pfZIt69d0E2zxmV/hp8Otaw5vi8GDR4 e54SA1ueLkUP8USCpk3KLo0PV+kc0DLgl7l8/v7/YAl3JKbw8yRwm+/qQoVKfInm390h E6kS9sCnmVv5jlW1XKALt40bqakoFX1aHq6yBYyc5OIyalHRDhfdRo3szbOpsY6TLQm3 1N8w== X-Gm-Message-State: AOUpUlFSr5JpaShYM40Lndctqft80qBOZtvrqFNXDYKARpp5gsczDzdQ /k0vZ25dRT8ZhYYU4X+9G/y+iQuGJc3Zlw== X-Google-Smtp-Source: AAOMgpeCyS3OHMUlyF1cGeMuzZ1NkegSyWp9D5C6H20KgxP/rPBQSZ/MPX/7R8tsB5+4I8tPP/BlJQ== X-Received: by 2002:aca:3ad4:: with SMTP id h203-v6mr302644oia.294.1532377315565; Mon, 23 Jul 2018 13:21:55 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:16:17 -0500 Message-Id: <20180723201748.25573-9-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-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::241 Subject: [Qemu-devel] [PATCH 08/99] 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 0634cdb295..cf44b97ced 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -200,6 +200,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.1