From patchwork Mon Mar 15 18:46:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 400532 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3679022jai; Mon, 15 Mar 2021 11:58:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykASwP7ex/DFLSD7/sDtp0xb8EW5PaZUpRVU6qyEKzWsbjPa9tlXzBLxokHVyfFe04gTUN X-Received: by 2002:a92:d981:: with SMTP id r1mr837747iln.98.1615834729139; Mon, 15 Mar 2021 11:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615834729; cv=none; d=google.com; s=arc-20160816; b=nsnVLUDDVOAXc9KRdmf0VDHkhLy+xmwALGlJJORYo+tlVjr9ggG901LaaZADWdiBjd pS8ehxi1zToe/eBhxft7MHXElzVetOK7YU8knAanNADn9r0RT3AMJASmin/aZqIL65NP svVK3DtuMnvvCfPe57HtcaVLF6MifMnlQ7+eB8H+qUrCIoNHpXG6oo/WUECJTxvddo2r 1RHE87acQYDj38XjWFhfHBkD0DeeLFlG1rs9rX33cdrmRxV7AipwyNxuAHydZrejFtMQ Z+LnQNcQ5+9WaVwSDJ7Wplm/Rxqyfe3VqNgXQLYsBMVgCoA0aL9P5N3K36Owe5whQbxk NPTA== 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=k34KSPPqz+W+K7ZpjYzs8tYdgcChJ38KIBfS4bwesJcH+RAluGEOY+MJNM/cbnMXbU 3mYtgzkNjY8vLt1tWV8ZAGeEF7lnQNfBpiS7jSkiZ4BEOXY9Lqfloe//8LVJrH6Uizga 9VjUe/vh2KcO7A7DXRnVpTRRpUh6r9fRCb2DDNn/zTY9zmG4ecKHXpWih8v1qHJvvjy3 qmOYP47dU9ZH+m/B2PUuXbke/EtIpBP1I6Thg9EfUgwHZDRZ4o/CfQHcORN4Pxuw40qz AgHALnRjbWw2ZZgVlhzctI0JmLr5zBKjyJ6ZYj/62Dg0p51Jm7mRiCKJHCwb1Kg5D38x 7RPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wZm8jMEd; 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=pass (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 b5si11290044iok.57.2021.03.15.11.58.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Mar 2021 11:58:49 -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=pass header.i=@linaro.org header.s=google header.b=wZm8jMEd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLsQS-0006i2-Ic for patch@linaro.org; Mon, 15 Mar 2021 14:58:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLsEU-00076O-7r for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:46:26 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:40635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLsEQ-0001Yo-87 for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:46:25 -0400 Received: by mail-ot1-x32a.google.com with SMTP id 101-20020a9d04ee0000b02901b506659320so5632696otm.7 for ; Mon, 15 Mar 2021 11:46:21 -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=wZm8jMEdbTSmXDM5ChDmW3ArJseKfZTcYwJM1P1DAihYWVCqXw36xC4bEibf5uVmoU cdrTRDXlZjAvY6rFD2/Xpn2d0wCD+5oXGRYgQIlp+ASp0aJm7zGHcHH9kaNmpk8XqBM3 8LoP5WgglDWk98iJXF+sxPKxjbFb5VUD+HoxlCaJOIANHmo7hI5Obn0Aq4/4ywwDfu9s V0yuXXDq0W7bHlIqI+Qx+ocGClent/iRcT7/jaSseLGvofmbK5CDxih7nF39SPpJzh5i czZN0t8PFsMejx+ZK12XMQmz2ZAGAh8Sgi5+KN85acaf+H+DKgLUj/GZdpFi5y5X+HK4 yjJQ== 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=EvOLMBxqKj4MV1Xwoqf7PuNaZv9K4f+MjIbfUPs1vVfMTwAfs+7zPFDjutp4CpiYNX pzujNmrSFGAabUofLpavebsR2C7Fh/Z017AA6xa9o0j1mIj39wEvswz2kNoM1RB4SfhC mqfL9Yimug8B1uayLeVhxTIIxRmQ430iERXJ23nn2iBMVQsvaribGDZGOqdeO5zJackx iaBsasMpmkepsUgGJ/fxRgGBPhKYzNKO0db6VDBU396+HbqkjoZWiGU8/Sa17zCvFRAO 9KQ5UPBhSDVxC+nPca+4lefZ6h7ud+9+pZ0ZyimQP8ffu1Mq9eAvODTazEPimi0X0+Xv +thA== X-Gm-Message-State: AOAM532hEQzQSBxtpQO0YWj+QutP6irTogNRxwX5scOvTAniyBWLz75a k2MQGf1nKjG7916rw9ZItei2Pne25oy/xbxX X-Received: by 2002:a9d:6013:: with SMTP id h19mr442782otj.72.1615833981207; Mon, 15 Mar 2021 11:46:21 -0700 (PDT) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id o25sm7519851otk.11.2021.03.15.11.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 11:46:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 03/17] target/ppc: Properly sync cpu state with new msr in cpu_load_old Date: Mon, 15 Mar 2021 12:46:01 -0600 Message-Id: <20210315184615.1985590-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210315184615.1985590-1-richard.henderson@linaro.org> References: <20210315184615.1985590-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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: 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 Reviewed-by: Cédric Le Goater 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);