From patchwork Tue Jan 23 03:53:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125475 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1519899ljf; Mon, 22 Jan 2018 19:58:36 -0800 (PST) X-Google-Smtp-Source: AH8x225FY6w2vcR8n2DXD78WCbJp4XkMCh5VZ2GjQfi/hs9f8sekXS1wgNqyg4ymwyZXjLuZsc+X X-Received: by 10.13.203.138 with SMTP id n132mr1069194ywd.39.1516679916817; Mon, 22 Jan 2018 19:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516679916; cv=none; d=google.com; s=arc-20160816; b=vObEjhhfWy5OJvVdzrGm+1g/7X9tj917Kbg7UwRuwSPB+S9IbgvCep6V4J7JXxopA8 sm54WIBMk9RSrqedfnpGjUV2ZEn1EZ2vjVw8QZ1gBO6RzqTIZtaeIVMqFvQ9GXJ+ZOEO tXcdOLXlF4ch1Gw5SEZnGgCIItZtn7pnMkKgdxtfYF2+o14wuYA0h7CWgowLx4i9Ow6D 67NnP4BUwywPW+OTJPvZ2GLEdFSRryICVnrSgurbeWTr2MF8T9giDGSszrphZGfsdtgl hAGIgXCDfccrYH/KLmyN8j3KVgh/gkZyd6XE4jclogFAYCZ40ykSYniw59pAr+6SL53j EiOQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=AE7ZBQLrQVD+0bszxAP1edyDl0SoKvKTyGyhp4uboQ7l11pKh5I6E6SN0OzKQh+sXK 7hiUab6CUdjTEDxaCiHvOdisjePTiEEDsg2VhmWucyuxM+hSddIFs5SyXp3YmMYL02eK pSqfGhs8w1DpyE4HJLazm9CZO0cHO3GCleji4DgJjEkKh2qkLvLKdFoAg9OBusoiuBjr 7msa3qiv8TVNzTsm5ZNKpjRBfGs5Xbectw4Qztq2frgACeexntWEQr+axhBV7eSwJKrn rcex2zRrnaMHrrwvr0IJxtFEAV6uYdCTuTG+Ws02pXkPjqiQOFGspyNvsHqZLMvOYPHH Ar1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PKa2a16/; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t63si2249403yba.104.2018.01.22.19.58.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 22 Jan 2018 19:58:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PKa2a16/; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:60828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edpjH-0005Bp-U3 for patch@linaro.org; Mon, 22 Jan 2018 22:58:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edpep-0001t2-Dd for qemu-devel@nongnu.org; Mon, 22 Jan 2018 22:54:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edpeo-00047V-G4 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 22:53:59 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:42916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edpeo-00046l-Aq for qemu-devel@nongnu.org; Mon, 22 Jan 2018 22:53:58 -0500 Received: by mail-pg0-x243.google.com with SMTP id q67so8762871pga.9 for ; Mon, 22 Jan 2018 19:53:58 -0800 (PST) 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; bh=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=PKa2a16/TMZ8XwergD5sZp/vzIA7Cjb4+OArfZMAjiVPkX2RW6mS0+Onie2u3XK2YB RBQ5yzKrMxLWZbFndOS/9X2F+nmDrqQRyLxrXKuLfvT1KMDDWcMAdJR3r97vpy66UAHO DAMsVEx04lO1WmRFPZGnKPROiq122dDchZaW4= 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; bh=rtUJek3aPDGG5LW/JtqEYY8tEezLcf4E59P/pioBFKI=; b=hctbg4tehkLSlPHAIfbJcjfb5KyvEkhQgfZ7IbjR2LbawWG3fB319hBQgt85D843iV 6zW0n1NBmYzXMFzxBGBql3bC+pLYgtHuaQQq/avWZl1VwC4tLJLUDQAW3ZR9/G+Z52YA y4H6J+yXL9TIIyetWEQ8LKXgdOfMbHR/eqSRAGY/EwGkNWLEqI1mZzaAHO9du4zhYHoi QXLvamYeZ2w8PLnMLSMDqSDiqn0wYX0cCAszuSxuxA+eHpjOSUiEnCyBD+Xv2MW1x7aT yUwMGgDVGSYd3ftQ+gVDaT+lPXzOLYO2V0pNKsrbqrJhSbLK7/IHLGX6AhUG9/qeJ4E/ qeAQ== X-Gm-Message-State: AKwxyteW6dJ/MpoZra0FEp/KTdSMnLf5zLUQ04jDBBI2BbWzv6Cnsfoy /wadHjBxEdca/GxEarSMmKYjd8t5FBc= X-Received: by 10.99.112.81 with SMTP id a17mr8201317pgn.293.1516679636953; Mon, 22 Jan 2018 19:53:56 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id t1sm3444680pfj.21.2018.01.22.19.53.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 19:53:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 22 Jan 2018 19:53:47 -0800 Message-Id: <20180123035349.24538-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180123035349.24538-1-richard.henderson@linaro.org> References: <20180123035349.24538-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v3 3/5] target/arm: Add SVE to migration state 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: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Save the high parts of the Zregs and all of the Pregs. The ZCR_ELx registers are migrated via the CP mechanism. Signed-off-by: Richard Henderson --- target/arm/machine.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) -- 2.14.3 Reviewed-by: Alex Bennée Reviewed-by: Peter Maydell diff --git a/target/arm/machine.c b/target/arm/machine.c index cb0e1c92bb..2c8b43062f 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -122,6 +122,56 @@ static const VMStateDescription vmstate_iwmmxt = { } }; +#ifdef TARGET_AARCH64 +/* The expression ARM_MAX_VQ - 2 is 0 for pure AArch32 build, + * and ARMPredicateReg is actively empty. This triggers errors + * in the expansion of the VMSTATE macros. + */ + +static bool sve_needed(void *opaque) +{ + ARMCPU *cpu = opaque; + CPUARMState *env = &cpu->env; + + return arm_feature(env, ARM_FEATURE_SVE); +} + +/* The first two words of each Zreg is stored in VFP state. */ +static const VMStateDescription vmstate_zreg_hi_reg = { + .name = "cpu/sve/zreg_hi", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_SUB_ARRAY(d, ARMVectorReg, 2, ARM_MAX_VQ - 2), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_preg_reg = { + .name = "cpu/sve/preg", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_ARRAY(p, ARMPredicateReg, 2 * ARM_MAX_VQ / 8), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_sve = { + .name = "cpu/sve", + .version_id = 1, + .minimum_version_id = 1, + .needed = sve_needed, + .fields = (VMStateField[]) { + VMSTATE_STRUCT_ARRAY(env.vfp.zregs, ARMCPU, 32, 0, + vmstate_zreg_hi_reg, ARMVectorReg), + VMSTATE_STRUCT_ARRAY(env.vfp.pregs, ARMCPU, 17, 0, + vmstate_preg_reg, ARMPredicateReg), + VMSTATE_END_OF_LIST() + } +}; +#endif /* AARCH64 */ + static bool m_needed(void *opaque) { ARMCPU *cpu = opaque; @@ -586,6 +636,9 @@ const VMStateDescription vmstate_arm_cpu = { &vmstate_pmsav7, &vmstate_pmsav8, &vmstate_m_security, +#ifdef TARGET_AARCH64 + &vmstate_sve, +#endif NULL } };