From patchwork Sun Mar 14 17:58:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 400102 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp2837271jai; Sun, 14 Mar 2021 11:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv3G3+msbfaqiGS+Bm7S0TZiAAl2crzQvcarFFPmO2thzbXzv+1FTLwtPKiyMBQb0en8aL X-Received: by 2002:a02:c894:: with SMTP id m20mr6963856jao.80.1615745438292; Sun, 14 Mar 2021 11:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615745438; cv=none; d=google.com; s=arc-20160816; b=WJAOcDzPlz+mq1AcKkUkUrXi962X3NaimjU7Y1W8IykwSFB99P8AZ5snR5KKSyyPFg THicy3esRKRDzE1B13u7382RuwlADZeO2Jo8XixYWOTrR8CKhtXofeAgLOR+YGForl0D EUk2A6nJx+Zeht7+us7RKnAWH4Ia2RVgSuaITDafqHkhEYZp+2yz2+/ZDkyUoVd3mqX+ AbWVm+6cFt/26uDMEPPJEtTkDubNN9iN4s4SHiCWkq7mWReKFYfHAq5U/6DRBDuJGPT6 wCxb9YfYh6+DLIxiCl/sZSH3/kQjJtk24ltTh1pPkJ98DqvrmqPoCt1o58h2nDQ/4YRR fVpw== 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=rBNBEOcSDYR+VlJXpnn63cl+iKupYCFGcFqK74D/RBs=; b=LX3CXnp2dnSLdY+TK8mjF4YNLB4jAYOcmPuDxUj1rdAshpwu3/onOstmYmO7G+Ufjq iKLe3/YHacjvOYFs1oZPVSUnAxjOC/93x4kRFesQNsyXpSBX7DrYliUjdGRzf6WdiKW0 I9+/akw/v1nqUYgBzuWRxjtU+CZI5W8jHR9yWZSNXioSZdy5iqESiuzbxy05uDqyolV8 6fRLBKyOPD6quKyd8lvq8vUG1IH2rgUNMR9T48oBJroYUpbjnez5JK6N/vTh1wv+wFYe EKv+EF0pPZQZaNr2IpRx0N1iNlcQqWlgEm/L3McPlbYYotU9yt3rToXdDaSavwIqdun+ TEAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hogfgALt; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h13si10284874iow.73.2021.03.14.11.10.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Mar 2021 11:10:38 -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=@linaro.org header.s=google header.b=hogfgALt; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLVCH-00021I-Lh for patch@linaro.org; Sun, 14 Mar 2021 14:10:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLV1T-0002AV-2H for qemu-devel@nongnu.org; Sun, 14 Mar 2021 13:59:27 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:39894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLV1G-00027Y-MP for qemu-devel@nongnu.org; Sun, 14 Mar 2021 13:59:25 -0400 Received: by mail-qt1-x832.google.com with SMTP id g24so7648033qts.6 for ; Sun, 14 Mar 2021 10:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rBNBEOcSDYR+VlJXpnn63cl+iKupYCFGcFqK74D/RBs=; b=hogfgALtGlsqQ5w1/cHzG6Sv1M3ALoCmPautd4DpBsiThPtn1As+Fakcz+BEEroTeu PaW8DLplFHSB8MlKs0SpustMFygWNCBTTSDM2IsjVzb1UDCzIre/h1D2uBGvENNzWA9g lBZVY3AhQL2uNIzAJ4G2dYK9WICEnZz8VvWbaGul+4m92iStQnZiXkHitCnMGmB2/MyN qbOJyIkdpwHrrIzoyFTUjpDAaAI7VSPSoYB5q0/NvzMFTpXy5R5HAqfefPXWS1VDXTAh KtOwD27LO/oNGlaZv9X15lajvVl/76ydWjejkfVdjB4jOm8ufyhPTI4rvA5O5sCwuBKV TvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rBNBEOcSDYR+VlJXpnn63cl+iKupYCFGcFqK74D/RBs=; b=p3p7o0zsCRj6RpN1QAtM4gD8rfwMXKEwm2zyofkSwi3Em0/+arZUw4JARErjtbJgd6 TAkkW4sfTYbKpIWOMVzNIay5/DuBWoIBCpIBU72B3ImxNVhkqOb57GxW2DtataIde94R ny9/h/JQpemB/QjpjMS4ESX7G0uqCfuHJhg2CC7fcgvs1qfAMstFfAaYhwhXhHrQvKII aJrnRQn/LMIdktwnUTz7XSik0aVMGJcs9eimb/v0BXC7KbNS8SxfmpTF/2+vDBAszeT6 0l3URKqDZJ/AsdOxL3ICZgAxXKeJYoTtAEU/DeOlqBfqMYf8PzcUc3pfOKR5JYpVOPy+ RqHw== X-Gm-Message-State: AOAM533kvq3r59iDgdqwd3dp2+r4QleEPWMVrZEx8Su9iS2zxLREJVKg 7pIOvGeFNuKssNGGsTtezp5VzCbRF+6OUOjz X-Received: by 2002:aed:2c61:: with SMTP id f88mr19747491qtd.337.1615744752778; Sun, 14 Mar 2021 10:59:12 -0700 (PDT) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id c127sm10216240qkd.87.2021.03.14.10.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 10:59:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/16] target/ppc: Properly sync cpu state with new msr in cpu_load_old Date: Sun, 14 Mar 2021 11:58:53 -0600 Message-Id: <20210314175906.1733746-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314175906.1733746-1-richard.henderson@linaro.org> References: <20210314175906.1733746-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: ivan@vmfacility.fr, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/ppc/machine.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.25.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);