From patchwork Fri Feb 15 10:00:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 158496 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp527146jaa; Fri, 15 Feb 2019 02:16:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IavM+vjBP6g+Exl/8Xif4TkA7hbZpky/SkJrfcjOa2+Halo4IbV7DG7WuuxEao9mi/8T70S X-Received: by 2002:a81:5e09:: with SMTP id s9mr7249655ywb.261.1550225811088; Fri, 15 Feb 2019 02:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550225811; cv=none; d=google.com; s=arc-20160816; b=zSLNyv0h2eWA2i9ncI23k4RmnCFHccwWFi732SA+f4kzUm/MDki/ltj1QnCdwlGi49 Pa+lRUdflU0kBLA31VQPJZHjKKlUnYSS+vPtEHDopdRHxkYjbqGu3KRsNBMXuOTjJPji pNszJO8/JMgafyd13pEW0AaCBAqXs7QYcNqpdplzqjoRngWWNiwpIYYtmLlSIUgWjlu0 4bmX2omgrhCVqekxDshjzpEQpQCqL0bwlQOa0Qk5pkKQopO/U0Ky01+bOL94i8mMZ/Ry j0CRe4NYukCHVBR4HXAiyAXI3IFUTnNgD95RRAy3iLdEUkSXsIau52f7/uGnCwSEoa8g rCxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from; bh=v+/TKRmGj0PLZfuMrTBfBNAbHvfyLfM3u02B+epjNRk=; b=sPN0N5CsoIyq2e9K9nNJ2III5QCu1FulpmRl1RSCrdkTyWQUqHIooBQP7F3a03ifuv eQSFjTbWR/sOlwOGq+ycKVdwWjfGuGgIfesAXWDPvwhVReuys9zQtuosEVj1URMlxaf/ C1sWStmMoqxKHXPUrEXGU1c4zGln7xXRpY5MoX0fOD9SZXj3w90TJ5CCi7tJWKPZkoxd +vD/RivW3RVX6xgzCJ1dm4Jof8Nf0T95OhqsLTL4jd+KwdF1z2YFRPI0eWkaoCR8k7Wa 4tEGSey2tD8Bdmx5DLVYXcJo0g5+r5jJDLZ8ggm/p2bpyo/OyCd0BIM/x1AMoxv6dHch dq2g== ARC-Authentication-Results: i=1; mx.google.com; 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 b32si2884335ybi.1.2019.02.15.02.16.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Feb 2019 02:16:51 -0800 (PST) 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; 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 ([127.0.0.1]:35982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guaY6-0000Q6-J0 for patch@linaro.org; Fri, 15 Feb 2019 05:16:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guaPm-00034O-Na for qemu-devel@nongnu.org; Fri, 15 Feb 2019 05:08:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guaPl-0002Yk-CJ for qemu-devel@nongnu.org; Fri, 15 Feb 2019 05:08:14 -0500 Received: from chuckie.co.uk ([82.165.15.123]:38834 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1guaPk-0002VD-7O; Fri, 15 Feb 2019 05:08:12 -0500 Received: from host86-133-194-245.range86-133.btcentralplus.com ([86.133.194.245] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1guaJf-00027S-0d; Fri, 15 Feb 2019 10:01:56 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, richard.henderson@linaro.org Date: Fri, 15 Feb 2019 10:00:54 +0000 Message-Id: <20190215100058.20015-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190215100058.20015-1-mark.cave-ayland@ilande.co.uk> References: <20190215100058.20015-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.133.194.245 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 13/17] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is required before changing the representation of the register. Signed-off-by: Richard Henderson Acked-by: David Gibson --- target/ppc/machine.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) -- 2.11.0 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" 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 version_id) CPUPPCState *env = &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 version_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); } +static int get_vscr(QEMUFile *f, void *opaque, size_t size, + const VMStateField *field) +{ + PowerPCCPU *cpu = 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 = opaque; + qemu_put_be32(f, helper_mfvscr(&cpu->env)); + return 0; +} + +static const VMStateInfo vmstate_vscr = { + .name = "cpu/altivec/vscr", + .get = get_vscr, + .put = put_vscr, +}; + static const VMStateDescription vmstate_altivec = { .name = "cpu/altivec", .version_id = 1, @@ -436,7 +460,21 @@ static const VMStateDescription vmstate_altivec = { .needed = altivec_needed, .fields = (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=0 so that we effectively pass CPU + * to the helper functions. + */ + { + .name = "vscr", + .version_id = 0, + .size = sizeof(uint32_t), + .info = &vmstate_vscr, + .flags = VMS_SINGLE, + .offset = 0 + }, VMSTATE_END_OF_LIST() }, };