From patchwork Tue May 4 05:52:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 430802 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3487191jao; Mon, 3 May 2021 22:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDvdDej2aBNEI6oiaCd/ZMKGbG6fxUSJ7l0VWgrX6XKjpwV9jZWZXTe0MAvPmMeWpKjLMp X-Received: by 2002:a37:40d5:: with SMTP id n204mr22680822qka.79.1620107651532; Mon, 03 May 2021 22:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620107651; cv=none; d=google.com; s=arc-20160816; b=y16VJ3VQgxFA5/EklMBz3xHZDcnD//S9wBiWuZv3igY9aLQ/zx9RlcS+OU/tApsK6A zqE0tqtcD1y/uPzkTmcsJlxB13xrirwvmTqIE9kG2OQBocXR2IEDTt/xvKBAWjeRZgbb TQBSdb7NSK5G92FtIxjvAP+c793o6AD7vBGHeYKcRyha2EcXJm/mUDUu6t7WpUf4XXiJ 0WT71GMoawXKTLQkeVAUO/xuojVUUVWcYX8XWyyH0dAQUQpwwyqIC5UBhSNvcBuM/pWA +YSDVRBdQd9YUPfz37zQVIz/bmKQ26x7l3f6NuEdrunjfSIRnCvE7EH9LGELbq00ct7W VPpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=raCF2vn88sF8rQ0ooL9VF7est1Xp53bPcSMgYctwGKg=; b=A7Jg5MDzIhowtizIcxIffsyBFBMiTVYB/5QzDLacMBqabE9RVdrnIRyksgcUpH4fzQ ud50T2HiU4pWAdGYQiUfT4fwZgGuXyCIjlvbkBVqmwKh3uQ0cbFuC+PrX0F5SVSMAdX3 KY2vA7L6WKUKmqGurPBZt6Sk8HHhpeOgzZr/JVcruLmdmY/o2KHCUsO3qSQz49WY4Vhs qBIrFT0l//21qyFkLGQrz72oJE0E0CZWXZ5s6gsXuKnlHbWtkiGQkQJwk0e1P6azZI4G SlpmfuOzsqnPuRwdtzJTnhy+sdsSlfWvta+eEZ7EZ9EqCnTY15Q4Q6o0/UTVdb63Ew5A Z5fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=gWvivPjD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c19si1445393qtd.294.2021.05.03.22.54.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 May 2021 22:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=gWvivPjD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:47168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldo0Y-0005hL-Tv for patch@linaro.org; Tue, 04 May 2021 01:54:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldnzq-00057z-Jw; Tue, 04 May 2021 01:53:26 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:49311 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldnzn-0004a3-Jh; Tue, 04 May 2021 01:53:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FZ8CK0MzZz9sWB; Tue, 4 May 2021 15:53:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1620107597; bh=vah07RKjf90sFxm6WFtEddSHyy3538FGdU5PnH34764=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWvivPjDv4vcoNWkNG9bunqtf75/jkyu56D4FZ95GKQol7cKzrVjZVwfpz301Uhda GEs4QPmvEq49yfBbPB3uFlhKdAcmKINiKA+wJJenm+dvkLJICSZdiTkGCA6DgwzMos NtHEsbM6Svoy5E4OqGWbqkuJioBCc8w5LLVfvntE= From: David Gibson To: peter.maydell@linaro.org, groug@kaod.org Subject: [PULL 04/46] target/ppc: Properly sync cpu state with new msr in cpu_load_old Date: Tue, 4 May 2021 15:52:30 +1000 Message-Id: <20210504055312.306823-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210504055312.306823-1-david@gibson.dropbear.id.au> References: <20210504055312.306823-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Match cpu_post_load in using ppc_store_msr to set all of the cpu state implied by the value of msr. Do not restore hflags or hflags_nmsr, as we recompute them in ppc_store_msr. Signed-off-by: Richard Henderson Message-Id: <20210315184615.1985590-4-richard.henderson@linaro.org> Reviewed-by: Cédric Le Goater Signed-off-by: David Gibson --- target/ppc/machine.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 283db1d28a..87d7bffb86 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -21,6 +21,7 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) int32_t slb_nr; #endif target_ulong xer; + target_ulong msr; for (i = 0; i < 32; i++) { qemu_get_betls(f, &env->gpr[i]); @@ -111,11 +112,19 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) qemu_get_betls(f, &env->ivpr_mask); qemu_get_betls(f, &env->hreset_vector); qemu_get_betls(f, &env->nip); - qemu_get_betls(f, &env->hflags); - qemu_get_betls(f, &env->hflags_nmsr); + qemu_get_sbetl(f); /* Discard unused hflags */ + qemu_get_sbetl(f); /* Discard unused hflags_nmsr */ qemu_get_sbe32(f); /* Discard unused mmu_idx */ qemu_get_sbe32(f); /* Discard unused power_mode */ + /* + * Invalidate all supported msr bits except MSR_TGPR/MSR_HVB + * before restoring. Note that this recomputes hflags and mem_idx. + */ + msr = env->msr; + env->msr ^= env->msr_mask & ~((1ULL << MSR_TGPR) | MSR_HVB); + ppc_store_msr(env, msr); + /* Recompute mmu indices */ hreg_compute_mem_idx(env);