From nobody Tue Feb 10 08:27:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494531179638853.6516223157478; Thu, 11 May 2017 12:32:59 -0700 (PDT) Received: from localhost ([::1]:49811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8tpa-0006wS-5Y for importer@patchew.org; Thu, 11 May 2017 15:32:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8tcj-0002vK-AH for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8tci-000829-4A for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28127) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8tch-00081u-SL for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D91B67F4BC; Thu, 11 May 2017 19:19:38 +0000 (UTC) Received: from localhost (ovpn-116-62.gru2.redhat.com [10.97.116.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 625BE8A8C1; Thu, 11 May 2017 19:19:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D91B67F4BC Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D91B67F4BC From: Eduardo Habkost To: Peter Maydell Date: Thu, 11 May 2017 16:18:41 -0300 Message-Id: <20170511191843.13784-28-ehabkost@redhat.com> In-Reply-To: <20170511191843.13784-1-ehabkost@redhat.com> References: <20170511191843.13784-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 11 May 2017 19:19:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/29] migration/i386: Remove old non-softfloat 64bit FP support 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: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Long long ago, we used to support storing the x86 FP registers in a 64bit format. Then c31da136a0bf8caad70c348f5ffc283206e9c7fc in v0.14-rc0 removed the last support for writing that in the migration format. Even before that, it was only used if you had softfloat disabled (i.e. !USE_X86LDOUBLE) so in practice use of it in even earlier qemu is unlikely for most users. Kill it off, it's complicated, and possibly broken. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170405190024.27581-2-dgilbert@redhat.com> Reviewed-by: Juan Quintela Signed-off-by: Eduardo Habkost --- target/i386/machine.c | 107 +++-------------------------------------------= ---- 1 file changed, 6 insertions(+), 101 deletions(-) diff --git a/target/i386/machine.c b/target/i386/machine.c index 78ae2f986b..bf9567cbd4 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -136,36 +136,6 @@ static const VMStateDescription vmstate_mtrr_var =3D { #define VMSTATE_MTRR_VARS(_field, _state, _n, _v) \ VMSTATE_STRUCT_ARRAY(_field, _state, _n, _v, vmstate_mtrr_var, MTRRVar) =20 -static int put_fpreg_error(QEMUFile *f, void *opaque, size_t size, - VMStateField *field, QJSON *vmdesc) -{ - fprintf(stderr, "call put_fpreg() with invalid arguments\n"); - exit(0); - return 0; -} - -/* XXX: add that in a FPU generic layer */ -union x86_longdouble { - uint64_t mant; - uint16_t exp; -}; - -#define MANTD1(fp) (fp & ((1LL << 52) - 1)) -#define EXPBIAS1 1023 -#define EXPD1(fp) ((fp >> 52) & 0x7FF) -#define SIGND1(fp) ((fp >> 32) & 0x80000000) - -static void fp64_to_fp80(union x86_longdouble *p, uint64_t temp) -{ - int e; - /* mantissa */ - p->mant =3D (MANTD1(temp) << 11) | (1LL << 63); - /* exponent + sign */ - e =3D EXPD1(temp) - EXPBIAS1 + 16383; - e |=3D SIGND1(temp) >> 16; - p->exp =3D e; -} - static int get_fpreg(QEMUFile *f, void *opaque, size_t size, VMStateField *field) { @@ -200,76 +170,6 @@ static const VMStateInfo vmstate_fpreg =3D { .put =3D put_fpreg, }; =20 -static int get_fpreg_1_mmx(QEMUFile *f, void *opaque, size_t size, - VMStateField *field) -{ - union x86_longdouble *p =3D opaque; - uint64_t mant; - - qemu_get_be64s(f, &mant); - p->mant =3D mant; - p->exp =3D 0xffff; - return 0; -} - -static const VMStateInfo vmstate_fpreg_1_mmx =3D { - .name =3D "fpreg_1_mmx", - .get =3D get_fpreg_1_mmx, - .put =3D put_fpreg_error, -}; - -static int get_fpreg_1_no_mmx(QEMUFile *f, void *opaque, size_t size, - VMStateField *field) -{ - union x86_longdouble *p =3D opaque; - uint64_t mant; - - qemu_get_be64s(f, &mant); - fp64_to_fp80(p, mant); - return 0; -} - -static const VMStateInfo vmstate_fpreg_1_no_mmx =3D { - .name =3D "fpreg_1_no_mmx", - .get =3D get_fpreg_1_no_mmx, - .put =3D put_fpreg_error, -}; - -static bool fpregs_is_0(void *opaque, int version_id) -{ - X86CPU *cpu =3D opaque; - CPUX86State *env =3D &cpu->env; - - return (env->fpregs_format_vmstate =3D=3D 0); -} - -static bool fpregs_is_1_mmx(void *opaque, int version_id) -{ - X86CPU *cpu =3D opaque; - CPUX86State *env =3D &cpu->env; - int guess_mmx; - - guess_mmx =3D ((env->fptag_vmstate =3D=3D 0xff) && - (env->fpus_vmstate & 0x3800) =3D=3D 0); - return (guess_mmx && (env->fpregs_format_vmstate =3D=3D 1)); -} - -static bool fpregs_is_1_no_mmx(void *opaque, int version_id) -{ - X86CPU *cpu =3D opaque; - CPUX86State *env =3D &cpu->env; - int guess_mmx; - - guess_mmx =3D ((env->fptag_vmstate =3D=3D 0xff) && - (env->fpus_vmstate & 0x3800) =3D=3D 0); - return (!guess_mmx && (env->fpregs_format_vmstate =3D=3D 1)); -} - -#define VMSTATE_FP_REGS(_field, _state, _n) \ - VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_0, vmstate_fpreg, FPR= eg), \ - VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_1_mmx, vmstate_fpreg_= 1_mmx, FPReg), \ - VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_1_no_mmx, vmstate_fpr= eg_1_no_mmx, FPReg) - static bool version_is_5(void *opaque, int version_id) { return version_id =3D=3D 5; @@ -356,6 +256,10 @@ static int cpu_post_load(void *opaque, int version_id) return -EINVAL; } =20 + if (env->fpregs_format_vmstate) { + error_report("Unsupported old non-softfloat CPU state"); + return -EINVAL; + } /* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly. @@ -943,7 +847,8 @@ VMStateDescription vmstate_x86_cpu =3D { VMSTATE_UINT16(env.fpus_vmstate, X86CPU), VMSTATE_UINT16(env.fptag_vmstate, X86CPU), VMSTATE_UINT16(env.fpregs_format_vmstate, X86CPU), - VMSTATE_FP_REGS(env.fpregs, X86CPU, 8), + + VMSTATE_STRUCT_ARRAY(env.fpregs, X86CPU, 8, 0, vmstate_fpreg, FPRe= g), =20 VMSTATE_SEGMENT_ARRAY(env.segs, X86CPU, 6), VMSTATE_SEGMENT(env.ldt, X86CPU), --=20 2.11.0.259.g40922b1