From patchwork Tue Mar 20 02:23:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10295937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C33D602BD for ; Tue, 20 Mar 2018 02:24:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F093D291A1 for ; Tue, 20 Mar 2018 02:24:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E43422959C; Tue, 20 Mar 2018 02:24:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37811291A5 for ; Tue, 20 Mar 2018 02:24:23 +0000 (UTC) Received: from localhost ([::1]:45054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey6wo-0007JU-He for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 22:24:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey6w1-0006gY-Di for qemu-devel@nongnu.org; Mon, 19 Mar 2018 22:23:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey6vy-0001uN-Ac for qemu-devel@nongnu.org; Mon, 19 Mar 2018 22:23:33 -0400 Received: from ozlabs.org ([103.22.144.67]:49983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ey6vx-0001s2-CO; Mon, 19 Mar 2018 22:23:30 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 404xYl5MSLz9sMM; Tue, 20 Mar 2018 13:23:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1521512603; bh=pwIdMYJVnunG7mWbp6n8f6NIyvkiNu62k9aioN1/BKk=; h=From:To:Cc:Subject:Date:From; b=B9uAROtUF/+aW+GXHO7Zv0jfPgXU9W/tH9XMiBUmYqCEDJDhL9Qrff5GV4jXZELwK xoPGE9gwKVC0Y5MI8BcIJCn+jZZFNjs1xcuCJO7FtFE/1t37qMXG9XXdJdG66C3js+ X3fKPCg1FYTRQRJZXpmW1VdDj8Kygs23HNZQmKl0= From: David Gibson To: groug@kaod.org, lvivier@redhat.com, wei.guo.simon@gmail.com Date: Tue, 20 Mar 2018 13:23:19 +1100 Message-Id: <20180320022319.17199-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PATCH] target/ppc: Fix backwards migration of msr_mask 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: ldoktor@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 21b786f "PowerPC: Add TS bits into msr_mask" added the transaction states to msr_mask for recent POWER CPUs to allow correct migration of machines that are in certain interim transactional memory states. This was correct, but unfortunately breaks backwards of pseries-2.7 and earlier machine types which (stupidly) transferred the msr_mask in the migration stream and failed if it wasn't equal on each end. This works around the problem by masking out the new MSR bits in the compatibility code to send the msr_mask on old machine types. Signed-off-by: David Gibson Reviewed-by: Laurent Vivier Reviewed-by: Greg Kurz Tested-by: Greg Kurz Tested-by: Lukáš Doktor --- target/ppc/machine.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index e475206c6a..0634cdb295 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -190,7 +190,15 @@ static int cpu_pre_save(void *opaque) /* Hacks for migration compatibility between 2.6, 2.7 & 2.8 */ if (cpu->pre_2_8_migration) { - cpu->mig_msr_mask = env->msr_mask; + /* Mask out bits that got added to msr_mask since the versions + * which stupidly included it in the migration stream. */ + target_ulong metamask = 0 +#if defined(TARGET_PPC64) + | (1ULL << MSR_TS0) + | (1ULL << MSR_TS1) +#endif + ; + cpu->mig_msr_mask = env->msr_mask & ~metamask; cpu->mig_insns_flags = env->insns_flags & insns_compat_mask; cpu->mig_insns_flags2 = env->insns_flags2 & insns_compat_mask2; cpu->mig_nb_BATs = env->nb_BATs;