From nobody Fri Apr 19 17:06:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502964928785.1320868801853; Mon, 18 Feb 2019 07:16:04 -0800 (PST) Received: from localhost ([127.0.0.1]:60315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkeH-0000g7-KV for importer@patchew.org; Mon, 18 Feb 2019 10:16:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyF-0006qy-Ro for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxx-0003Gx-Gg for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:27 -0500 Received: from ozlabs.org ([203.11.71.1]:52461) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxw-0003Ds-QR; Mon, 18 Feb 2019 09:32:17 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s30k9Dz9sQm; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=3dZ+99kwfp6L+lvyxQtGfMWD/0+jLACIq9+NuLPc/dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1v4W3Bv06d6KeBsQoW8dqjNqsW/h6O3mHCX1/koEnGKbKeaxlw36+eQ0NxQr3lkW FG2YZ2eHIrQa+4gqXuluJNDCh07Se6lhRb7CIAlYrFk6AFg9yjD4YtWYemyNVU0ETV 984otIMwCuJ7iUf5ZfievQfWDsNMYLcqX3Ag450Y= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:45 +1100 Message-Id: <20190218143049.17142-40-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 39/43] target/ppc: Use mtvscr/mfvscr for vmstate 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Richard Henderson This is required before changing the representation of the register. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-14-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/machine.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index eff30053b0..756b6d2971 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -10,6 +10,7 @@ #include "migration/cpu.h" #include "qapi/error.h" #include "kvm_ppc.h" +#include "exec/helper-proto.h" =20 static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) { @@ -17,7 +18,7 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int ve= rsion_id) CPUPPCState *env =3D &cpu->env; unsigned int i, j; target_ulong sdr1; - uint32_t fpscr; + uint32_t fpscr, vscr; #if defined(TARGET_PPC64) int32_t slb_nr; #endif @@ -84,7 +85,8 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int ve= rsion_id) if (!cpu->vhyp) { ppc_store_sdr1(env, sdr1); } - qemu_get_be32s(f, &env->vscr); + qemu_get_be32s(f, &vscr); + helper_mtvscr(env, vscr); qemu_get_be64s(f, &env->spe_acc); qemu_get_be32s(f, &env->spe_fscr); qemu_get_betls(f, &env->msr_mask); @@ -429,6 +431,28 @@ static bool altivec_needed(void *opaque) return (cpu->env.insns_flags & PPC_ALTIVEC); } =20 +static int get_vscr(QEMUFile *f, void *opaque, size_t size, + const VMStateField *field) +{ + PowerPCCPU *cpu =3D opaque; + helper_mtvscr(&cpu->env, qemu_get_be32(f)); + return 0; +} + +static int put_vscr(QEMUFile *f, void *opaque, size_t size, + const VMStateField *field, QJSON *vmdesc) +{ + PowerPCCPU *cpu =3D opaque; + qemu_put_be32(f, helper_mfvscr(&cpu->env)); + return 0; +} + +static const VMStateInfo vmstate_vscr =3D { + .name =3D "cpu/altivec/vscr", + .get =3D get_vscr, + .put =3D put_vscr, +}; + static const VMStateDescription vmstate_altivec =3D { .name =3D "cpu/altivec", .version_id =3D 1, @@ -436,7 +460,21 @@ static const VMStateDescription vmstate_altivec =3D { .needed =3D altivec_needed, .fields =3D (VMStateField[]) { VMSTATE_AVR_ARRAY(env.vsr, PowerPCCPU, 32), - VMSTATE_UINT32(env.vscr, PowerPCCPU), + /* + * Save the architecture value of the vscr, not the internally + * expanded version. Since this architecture value does not + * exist in memory to be stored, this requires a but of hoop + * jumping. We want OFFSET=3D0 so that we effectively pass CPU + * to the helper functions. + */ + { + .name =3D "vscr", + .version_id =3D 0, + .size =3D sizeof(uint32_t), + .info =3D &vmstate_vscr, + .flags =3D VMS_SINGLE, + .offset =3D 0 + }, VMSTATE_END_OF_LIST() }, }; --=20 2.20.1