From patchwork Tue Mar 23 18:43:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 406943 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4701553jai; Tue, 23 Mar 2021 11:46:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2lNifL0B0WucoIFsq3nnDNUmNW5c+vuKbjdokfQNI+ZjNO3W9ubCa8PLZYn6KfNDy476g X-Received: by 2002:a9d:6a0d:: with SMTP id g13mr5600851otn.102.1616525206590; Tue, 23 Mar 2021 11:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616525206; cv=none; d=google.com; s=arc-20160816; b=HTvc3glLvJyQue6SrGkSfcOyZK6a6IWEAP4Nd18ducoqFGaqbnGzGrnf7NpPsII40m +K9wiUvTQV0+0BbBKsALpQSLIZ1orBWXY/WeaYNe1NRbi9zOV4QRhWvCfH/8b3fSB/TD dt/8hFC0u5j/UQK1XK5GpXNgpQlE8eW1FZFPaiLWWmQtf1ZCCihzx35plutJi1bQfmgy XkWqYhjN8w8h5KLbPB8QcSzS5+CnlQvV5Q55YsxTUT7MGoI2UkLq5SHA5RNqzVQuKQpJ fYlwQ7DMXPbpYTOskAxisRbZk4e8PZNCfXUxxX88sORyJ3jg3+2HeVHnUARWgiC2HVwj oLGA== 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=ZZn5IlT2BapleTJTqEZmRXFES9KCoo4eQgHLgV0kshE=; b=ozJUZrSZ7mAI+PffNMPf1sZaVE23MaA0C6wUN/W7n1/tyj/S0Tqj8MGkgp1cbHNcAs QSuBFEO9nKnKWe1scWV5lUXLY5erMBv+cRnxjwazUVLOYOOT9c1b4W8B55ex7DwB9LVZ kdSANmvW5TaNx2rRBtUnKlQe72pv976MUhJNsJFzldf0OC6R820Wcaybo/RBUoPhcixg 2GWILJWbITghXt5iXHnTL8jJX9ddlaugKk4KJXJgB76GgbwQS0TJWhdmbXgJXGoh5ZuV WRYz+6FPJkCU3dneknrNsTO7ulXi/JcupBrg6pXcedXq6TzNrDRpbBDQlbyejGJa0tee 9Exg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KFLJe20O; 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 n9si9501060oij.74.2021.03.23.11.46.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Mar 2021 11:46:46 -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=KFLJe20O; 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]:60102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOm3B-0008I3-U1 for patch@linaro.org; Tue, 23 Mar 2021 14:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOm0l-0008Fb-04 for qemu-devel@nongnu.org; Tue, 23 Mar 2021 14:44:16 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]:46015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOm0L-0003fG-CL for qemu-devel@nongnu.org; Tue, 23 Mar 2021 14:44:11 -0400 Received: by mail-oi1-x22e.google.com with SMTP id d12so18099751oiw.12 for ; Tue, 23 Mar 2021 11:43:45 -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=ZZn5IlT2BapleTJTqEZmRXFES9KCoo4eQgHLgV0kshE=; b=KFLJe20OoyGU7DeNegRcCDinW+fVHZ2S6bCuEfl6Pd8uqm54RBK4MIRF76Vof4ckIN CZYnjs2zrJ2b332cxhKzclrLdiI6Wsd0VPXpHwvXeH/c2lyVYVihCMpFNMdZZmfGEKx7 yzigmPa2FKljB6Rhu1V0mp7+uhDzeJroYtmsgyh8HzuwBqQjy953MrROBpt2DW3ZVyzZ A06uaG0qfBGMX2+AjRtFR6Y5cREtDfJKuBnPr7UcfqnI0sTMJyKuyCq3bjCIvYleMhiG bIkxRVsnrkyEtt9JQazbFEMA1TbyLIAv5OVqdpxLse2wde4vBqnVsuumfUNsLD2YGY2/ HQ5Q== 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=ZZn5IlT2BapleTJTqEZmRXFES9KCoo4eQgHLgV0kshE=; b=AL5ZqEOyWni/Ul1dN5jR5av38yYp9C6ied86LE+XmFi7RxNVx1sBqUV/67fr54FEHb IWrBoEVY3mT5mMIqCYzqry/Pb9m9NplH9c1SAKpHTTPIgrG2Zu5iI+LZ8Uti0bvvfUG1 nkDdjRZQqGATtja7PUExBd/SUD4ywou4QHQNrV+cyjpDddDae6/0kSvp3uUz1DHy4siv iuRBeQFZ/ETBM35wkp6JDgE0tA+Js6wVXY2YB7T7nILpaFAeAmkSGGAGwhaOvPQQahN4 wk7Xt+D7BeVbNrT8vHfhGNN0mHMomk/lXDLkk/UpTkpSdDE7V4wlnDXzrZ4gsalf77ks g37g== X-Gm-Message-State: AOAM533HCX/KT93rr1FFpYa8RZ/22IDtATRo316KHGjjluZvqVB/HZwM mhusuPRPC0uim5RkGsuY7DFd63sQYJq43zeL X-Received: by 2002:a05:6808:13d0:: with SMTP id d16mr4451655oiw.169.1616525024541; Tue, 23 Mar 2021 11:43:44 -0700 (PDT) Received: from localhost.localdomain (171.189-204-159.bestelclientes.com.mx. [189.204.159.171]) by smtp.gmail.com with ESMTPSA id x23sm3902825ood.28.2021.03.23.11.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 11:43:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/10] target/ppc: Extract post_load_update_msr Date: Tue, 23 Mar 2021 12:43:31 -0600 Message-Id: <20210323184340.619757-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323184340.619757-1-richard.henderson@linaro.org> References: <20210323184340.619757-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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, =?utf-8?q?C=C3=A9dric_Le_Goater?= , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Extract post_load_update_msr to share between cpu_load_old and cpu_post_load in updating the msr. Suggested-by: Cédric Le Goater Signed-off-by: Richard Henderson --- target/ppc/machine.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 1f7a353c78..09c5765a87 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -10,6 +10,18 @@ #include "kvm_ppc.h" #include "exec/helper-proto.h" +static void post_load_update_msr(CPUPPCState *env) +{ + target_ulong msr = env->msr; + + /* + * Invalidate all supported msr bits except MSR_TGPR/MSR_HVB + * before restoring. Note that this recomputes hflags and mem_idx. + */ + env->msr ^= env->msr_mask & ~((1ULL << MSR_TGPR) | MSR_HVB); + ppc_store_msr(env, msr); +} + static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) { PowerPCCPU *cpu = opaque; @@ -21,7 +33,6 @@ 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]); @@ -117,13 +128,7 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) 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); + post_load_update_msr(env); return 0; } @@ -343,7 +348,6 @@ static int cpu_post_load(void *opaque, int version_id) PowerPCCPU *cpu = opaque; CPUPPCState *env = &cpu->env; int i; - target_ulong msr; /* * If we're operating in compat mode, we should be ok as long as @@ -417,13 +421,7 @@ static int cpu_post_load(void *opaque, int version_id) ppc_store_sdr1(env, env->spr[SPR_SDR1]); } - /* - * 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); + post_load_update_msr(env); return 0; }