From patchwork Wed Sep 26 19:23:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 147649 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1111734lji; Wed, 26 Sep 2018 12:26:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV63rhDiNJIaWzyGGdTiK/2nplIJCnc7UgTDlYnvYzJVMTU15y0KhFPsew2H5R46DoayDJMHK X-Received: by 2002:a37:8786:: with SMTP id j128-v6mr5426338qkd.32.1537990019550; Wed, 26 Sep 2018 12:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537990019; cv=none; d=google.com; s=arc-20160816; b=L3FUTcibU5wP/+Jh2Xn6d94lOVl4LsQiZ1cs3NLEj/GGdOfDYci/4rL/TVzOn+FCTU 6WgFNUygixFY30tSnDHY/EZYyErBXST5Nesf07oEd1Fw7Jt19m9mLM1mKqVkwOX/Qm9F RdxM6gwyE7QiCUlWcxMfO2c/xmv8vbJ3xmpC0VhZAGtb3AD8tdE7BH6gdsgXHw447h6S BnaTesoVBA70XDV7JB6GJeX8dEqLs+yo8BnSH8XYTkU377tPw2g3leOxYt5KyP1uimK3 F/sm1TCV/B0mgKOG87bCaWvrHnydKr+ZNoWNmrUpHX+p8va7W9LuIwa/z7O8Lska/RWj K3FQ== 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; bh=jLscj4Rxa2hK6bOQvKfXcu6SzGPxwyEkMrF5e85YaSw=; b=C/vPIEXUow2DGA7i/dCfuNea0yTHeJrZ0pPEd0tPdWnartlBwZDKCgPQgTXrdMn00U moYaUt7G9TxWe1bTeneQNsC/jMogvJfhv1WaI7oaZIcfzoNWLWdJMyvhtW5JrHS/4XLj 2LCHxeHohsuVRNnw8guXwBwplXNnJ+thvsdUvo7tJcvqBH2NxXjXjz2xcQx38gkz9kLm hZUJSpP3vYdSmxGHe8gUVIuG/iZRJCyG3zNkyRFMahxyzhmeB00y7WV/6ADChWy4y0QL uSPqyrlL25075w1ie5cwETWWdlrt1oCu/XMxNcUBm8dgheDFG0OoyWRrEbjVB5RyUFM0 tT0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DNZvw8fb; 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 o4-v6si3371546qkb.21.2018.09.26.12.26.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Sep 2018 12:26:59 -0700 (PDT) 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=DNZvw8fb; 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]:60371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FSd-00048M-1J for patch@linaro.org; Wed, 26 Sep 2018 15:26:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FPU-0001rT-RM for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5FPP-0006pF-1K for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:44 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:41865) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5FPL-0006me-6E for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:37 -0400 Received: by mail-pf1-x42a.google.com with SMTP id m77-v6so54814pfi.8 for ; Wed, 26 Sep 2018 12:23:33 -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; bh=jLscj4Rxa2hK6bOQvKfXcu6SzGPxwyEkMrF5e85YaSw=; b=DNZvw8fbLFtxTjA1kePZoeu+A0Yo99O2QIq3hDmmEF8gw4mPPPVwYYpA+nsTtqdSIm EBlhYvi4Bg5Xmc29vV/fmNS6zkKOQrJ2pS0rNFdHXLpInJEorTB0rAadNXAZTI5cEgq+ gEmlJzUpsTO6e/GczYMANSUtrwWC9cvNKUxWY= 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=jLscj4Rxa2hK6bOQvKfXcu6SzGPxwyEkMrF5e85YaSw=; b=jWoE4Y0HrVz5k9BcK+8RVPGa0o+SRMPMpioZBwuodsf+gXL4WafNAYZTKReJzsqwVA 9mwDu8DguzPlm27J+i5J+h84Q8+A30tzDpuYEphxiK/ZN9BfhoqeT0NpRXoTwAzGnDFQ gpKXmVBYESfx/rHHAYshXIvXc0qiZQgcUigTUrCJxgv+RPQiWkYxq9HSgym4yzFC+oFS Z1Kd6oL6FUJmfurdBriNRtHXaCVoy+SJeMdTkOnmJDSl6wQOrNWB68SY2ZhPdOILoYki azIk08HS4gL0onPdjlCph9GW5UQZY90DI2jEScfQUJqbsKeTgB62SkuM6Lg7dfscfgRd HpIA== X-Gm-Message-State: ABuFfoicphWrVh2VpB6GmUC7TV7pw0OtzIIxSLGBnyFJhji94iL5amEJ SEwFNBfLwAMNlX5SNfkAP5QFog0OpLY= X-Received: by 2002:a17:902:9a04:: with SMTP id v4-v6mr3247718plp.247.1537989812101; Wed, 26 Sep 2018 12:23:32 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id c2-v6sm8493486pfo.107.2018.09.26.12.23.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 12:23:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 12:23:13 -0700 Message-Id: <20180926192323.12659-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926192323.12659-1-richard.henderson@linaro.org> References: <20180926192323.12659-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42a Subject: [Qemu-devel] [PATCH v2 05/15] target/arm: Adjust aarch64_cpu_dump_state for system mode SVE 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the existing helpers to determine if (1) the fpu is enabled, (2) sve state is enabled, and (3) the current sve vector length. Tested-by: Laurent Desnogues Signed-off-by: Richard Henderson --- target/arm/cpu.h | 4 ++++ target/arm/helper.c | 6 +++--- target/arm/translate-a64.c | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a4ee83dc77..da4d3888ea 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -920,6 +920,10 @@ target_ulong do_arm_semihosting(CPUARMState *env); void aarch64_sync_32_to_64(CPUARMState *env); void aarch64_sync_64_to_32(CPUARMState *env); +int fp_exception_el(CPUARMState *env, int cur_el); +int sve_exception_el(CPUARMState *env, int cur_el); +uint32_t sve_zcr_len_for_el(CPUARMState *env, int el); + static inline bool is_a64(CPUARMState *env) { return env->aarch64; diff --git a/target/arm/helper.c b/target/arm/helper.c index 9b1f868efa..05329accd5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4406,7 +4406,7 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { * take care of raising that exception. * C.f. the ARM pseudocode function CheckSVEEnabled. */ -static int sve_exception_el(CPUARMState *env, int el) +int sve_exception_el(CPUARMState *env, int el) { #ifndef CONFIG_USER_ONLY if (el <= 1) { @@ -4464,7 +4464,7 @@ static int sve_exception_el(CPUARMState *env, int el) /* * Given that SVE is enabled, return the vector length for EL. */ -static uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) +uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) { ARMCPU *cpu = arm_env_get_cpu(env); uint32_t zcr_len = cpu->sve_max_vq - 1; @@ -12547,7 +12547,7 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) /* Return the exception level to which FP-disabled exceptions should * be taken, or 0 if FP is enabled. */ -static int fp_exception_el(CPUARMState *env, int cur_el) +int fp_exception_el(CPUARMState *env, int cur_el) { #ifndef CONFIG_USER_ONLY int fpen; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 8ca3876707..8a24278d79 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -166,11 +166,15 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, cpu_fprintf(f, "\n"); return; } + if (fp_exception_el(env, el) != 0) { + cpu_fprintf(f, " FPU disabled\n"); + return; + } cpu_fprintf(f, " FPCR=%08x FPSR=%08x\n", vfp_get_fpcr(env), vfp_get_fpsr(env)); - if (arm_feature(env, ARM_FEATURE_SVE)) { - int j, zcr_len = env->vfp.zcr_el[1] & 0xf; /* fix for system mode */ + if (arm_feature(env, ARM_FEATURE_SVE) && sve_exception_el(env, el) == 0) { + int j, zcr_len = sve_zcr_len_for_el(env, el); for (i = 0; i <= FFR_PRED_NUM; i++) { bool eol;