From patchwork Fri Jun 22 14:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 139659 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp935572lji; Fri, 22 Jun 2018 07:23:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJss4iVP2PjcJkImDLdrabD5uYM5gXG9ZmOTF4TsuUUhn74CKfofXAmYefcy8mnaul/iwPc X-Received: by 2002:ac8:2d42:: with SMTP id o2-v6mr1564098qta.256.1529677431543; Fri, 22 Jun 2018 07:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529677431; cv=none; d=google.com; s=arc-20160816; b=oUVhvSar6tBhRnCAvI8syNxXvy5gxFE4XJ57KhBlyhpBmICW/Cq7jBmqslNmRjx611 oFAugos4m93XvWGaQKWCf/3rmUC758wOZZDdAg8TcFTgN1QZ7rXi4IBuSwk505rzOSNQ 9zr3Gjwj3vr06Zthgl23PUReVYK/Ql+ZJdZfR4cYKkMtcUwIBkksPdRud92W+a5roGFV sVWbFUaO9JAhYFfDscNxSdjzHNTBSK8nUWaHKWzihgdf2DL07puqY0E+iJmaWBm3vimV U3AERUVgUBiAfI2Bc7KOKOwbVCjv9QNnPm34Jb6atzCWohlBQwQ33vEhos0r7ivDz2Jl Gr0Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Sz7o6YO/4o6EHCNz75Wz5Zg04LtsPIQBylQwFuuURLo=; b=bHExD9HRds+zLpadaf9KCkbfmpYuwU0TdSZ/QpNcRA05hrHVwwZ7aiJBiY7d8dSEg7 Gl9egvIzpSBSEt7pwze6GZ9Arv1wGulLXuUZoFTQwkN1wf+xLP2FoAVOVa/pLNFJBcrq yEvDNuDpje3wBnyVBYnuZDMR5EhdEztXr3V1O6ge+U8+iEyf6DLesdtntVSrWpXHt8xQ J/1KBoWmLqc/ZujCsLtnRpLF0OamA3017IfNCjen4qf9ixSpwaE/CibfFlnG147eoW9U r1WpbvgX82F8PQO0GafNZ79q/zvijzUO4AFX4cO/732zQgyGpdVHDP6w6kJLYddedlXb Dfaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NWzxIj86; 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 k8-v6si6429910qvm.265.2018.06.22.07.23.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jun 2018 07:23:51 -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=NWzxIj86; 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]:34357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWMyc-0007Jy-OD for patch@linaro.org; Fri, 22 Jun 2018 10:23:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWMnX-0006HJ-Au for qemu-devel@nongnu.org; Fri, 22 Jun 2018 10:12:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWMnV-0006FK-0n for qemu-devel@nongnu.org; Fri, 22 Jun 2018 10:12:23 -0400 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:39492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fWMnU-0006Dy-Q4 for qemu-devel@nongnu.org; Fri, 22 Jun 2018 10:12:20 -0400 Received: by mail-wr0-x22a.google.com with SMTP id b8-v6so1425972wro.6 for ; Fri, 22 Jun 2018 07:12:20 -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 :mime-version:content-transfer-encoding; bh=Sz7o6YO/4o6EHCNz75Wz5Zg04LtsPIQBylQwFuuURLo=; b=NWzxIj86W1MC17JYYtJdl++9aCnJ5jymp2bLVrKAlZcvnGmU6RZj/WsoYdntPTPbDN JwcjL5ytSi/Gti8OyTugI8Nny33ssOLwncB/mM2NyXYiILDqnJFqeW2SJbBEoMGu5vTY Syfo58rTpabvAb6YyBmpwv3fZtgj5bmTVcKwk= 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:mime-version:content-transfer-encoding; bh=Sz7o6YO/4o6EHCNz75Wz5Zg04LtsPIQBylQwFuuURLo=; b=WMoUzxK7TnDA7vNLO1n/U1tlPbWAS+BBeuUh8EEtlHOLnwTzm6MbABJpssS+J09Llu VROejIP2Hehrl7eaudLnMsN3H2OLrgcGh6Kt+uqizdQ6S2dElqAsjWeBYqeujo5coTuN iXPCjCHlUqNxySmsdWinvQra8KyqT5UZVvJYbHzEpkSdttuGT2pMcNepS1QwjIg0VPlp 00ypABNArHWKjUOFY9/WH2Jihl3JiLWW8BZuELxUGJouk5a1mQuuq/Jge267OJgKRnBq eQNGzT9GZiI9r1+vN2w9+z7I6zKsxyWas7pzggF2aHjWu5OBrwiLSa3TwpHDPOBm0q8q qC+w== X-Gm-Message-State: APt69E2Z0sc8Q/wFmAdbeQsr7HT+TR+hsJhFtYodT27d802r/Vb6zV5Y 4Gb4yOfl5GW+MIvaerEW7FXboQagQ7E= X-Received: by 2002:adf:fd88:: with SMTP id d8-v6mr1697987wrr.276.1529676739776; Fri, 22 Jun 2018 07:12:19 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o15-v6sm1191295wrm.38.2018.06.22.07.12.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Jun 2018 07:12:17 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 643453E0D45; Fri, 22 Jun 2018 15:12:06 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 22 Jun 2018 15:12:05 +0100 Message-Id: <20180622141205.16306-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622141205.16306-1-alex.bennee@linaro.org> References: <20180622141205.16306-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22a Subject: [Qemu-devel] [RISU PATCH v4 22/22] risu_reginfo_aarch64: handle variable VQ 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, richard.henderson@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This involves parsing the command line parameter and calling the kernel to set the VQ limit. We also add dumping of the register state in the main register dump. Signed-off-by: Alex Bennée --- risu_reginfo_aarch64.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Richard Henderson diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index bf98ba1..00d1c8b 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "risu.h" #include "risu_reginfo_aarch64.h" @@ -30,17 +32,41 @@ const char * const arch_extra_help; /* Should we test SVE register state */ static int test_sve; static const struct option extra_opts[] = { - {"test-sve", no_argument, &test_sve, 1}, + {"test-sve", required_argument, NULL, FIRST_ARCH_OPT }, {0, 0, 0, 0} }; const struct option * const arch_long_opts = &extra_opts[0]; -const char * const arch_extra_help = " --test-sve Compare SVE registers\n"; +const char * const arch_extra_help + = " --test-sve= Compare SVE registers with VQ\n"; #endif void process_arch_opt(int opt, const char *arg) { +#ifdef SVE_MAGIC + long want, got; + + assert(opt == FIRST_ARCH_OPT); + test_sve = strtol(arg, 0, 10); + + if (test_sve <= 0 || test_sve > SVE_VQ_MAX) { + fprintf(stderr, "Invalid value for VQ (1-%d)\n", SVE_VQ_MAX); + exit(1); + } + want = sve_vl_from_vq(test_sve); + got = prctl(PR_SVE_SET_VL, want); + if (want != got) { + if (got < 0) { + perror("prctl PR_SVE_SET_VL"); + } else { + fprintf(stderr, "Unsupported value for VQ (%d != %d)\n", + test_sve, (int)sve_vq_from_vl(got)); + } + exit(1); + } +#else abort(); +#endif } const int reginfo_size(void) @@ -113,12 +139,18 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) #ifdef SVE_MAGIC if (test_sve) { - int vq = sve_vq_from_vl(sve->vl); /* number of quads for whole vl */ + int vq = test_sve; if (sve == NULL) { fprintf(stderr, "risu_reginfo_aarch64: failed to get SVE state\n"); return; } + if (sve->vl != sve_vl_from_vq(vq)) { + fprintf(stderr, "risu_reginfo_aarch64: " + "unexpected SVE state: %d != %d\n", + sve->vl, sve_vl_from_vq(vq)); + return; + } ri->sve.vl = sve->vl;