From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83CD6C433DB for ; Mon, 11 Jan 2021 14:51:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D7B62255F for ; Mon, 11 Jan 2021 14:51:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D7B62255F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyyXd-0002c6-1H for qemu-devel@archiver.kernel.org; Mon, 11 Jan 2021 09:51:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyyWb-0001O0-Io for qemu-devel@nongnu.org; Mon, 11 Jan 2021 09:50:29 -0500 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:33724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyyWY-0008PJ-Bo for qemu-devel@nongnu.org; Mon, 11 Jan 2021 09:50:29 -0500 Received: by mail-qk1-x733.google.com with SMTP id f26so14768027qka.0 for ; Mon, 11 Jan 2021 06:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SQhJjiT30eyMG2iIN9BvDrzibRA2vr/Sy8VxkTsg2pg=; b=DTu01/QnQlCC1jLeJdymYmtLykHi/w8A9FD1Kioojq4K/uH+2Q3jYTaOQaSEQGfBy9 B/ap7cGLuOuqWqU/JrUVkeUd7yqKGodWOjcuwCP6wLFVslJ9ko2yuBPBezY/7fgQ+zI3 5UlFiHd9MHFb9uI8ZS/j9cI8+D1kotVwllQH7sAk3UZbcnfCa5FM8onIFZITyrvfRMQd 8JKbIpqIzwBKuGtSFx4v/+9HQ+a0eIeq5ghAlmWp/ORThZGBf7O3dkJ+l7engzRuFE0i s0J6zGPwbx0e7lmNasE/0NAM1kxYfRL4G1fMwjYjlOHgz7B6oqZ6n1z1uCbvMqtJ6O9O qb6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SQhJjiT30eyMG2iIN9BvDrzibRA2vr/Sy8VxkTsg2pg=; b=ZTWi2QDjPkIAoD8AGrBLkjw6b4hHzUlMQkImTfVoqFsydvZ3TMxDciuMfcjzJXtfUN E31vw9teEkpTH1URB6jPWs1sWR/wyFmtb0dH5Bj8MkrzxBQUyjj+09X4xxKoZysb5fEQ heaIhvUJTRJ2LNUZGc9yiW2sYIsjZuY1Dkf3fAoJg/4JC0m0dCmjrAbejym1vHuF3A3/ m6HVWxASVSbdkMs0tT0VwwZr/wUZy0ouGJGvzvwNp2SUtAwbl4EBkFPqR/5Xv1oQIoCG WrnqUk1m6NldeLQty7h1lHy+bs9tKVG1JUoXi1qvykIXl3SsrU5340vJbtuA+xNr5Kad 5Yzg== X-Gm-Message-State: AOAM532S2bqVMElJWRwlPnra1Af5WelEWbRwgLZ72yFWLM/nq/ac8SvV rko0P+vz+Iz2iSTxHyqtL+DVyA== X-Google-Smtp-Source: ABdhPJzP9bsY5iTjF7UMC44syih9U8GSMoE/3BVnBK/GCDk2tSocPfx4Gta2iwRzFeopuebzjJz+eA== X-Received: by 2002:a37:a8a:: with SMTP id 132mr16382414qkk.327.1610376624245; Mon, 11 Jan 2021 06:50:24 -0800 (PST) Received: from ?IPv6:2804:7f0:8284:874d:20e9:a3d4:1db5:c30a? ([2804:7f0:8284:874d:20e9:a3d4:1db5:c30a]) by smtp.gmail.com with ESMTPSA id i129sm8265616qkd.114.2021.01.11.06.50.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jan 2021 06:50:23 -0800 (PST) Subject: Re: [PATCH v1 10/20] target/arm: use official org.gnu.gdb.aarch64.sve layout for registers To: =?UTF-8?Q?Alex_Benn=c3=a9e?= References: <20210108224256.2321-1-alex.bennee@linaro.org> <20210108224256.2321-11-alex.bennee@linaro.org> <9ee1443e-821d-9cec-c29a-6111385937ad@linaro.org> <87zh1fo7yd.fsf@linaro.org> From: Luis Machado Message-ID: <50da05ee-f7fb-1a18-391d-a707b5df2dba@linaro.org> Date: Mon, 11 Jan 2021 11:50:20 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87zh1fo7yd.fsf@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::733; envelope-from=luis.machado@linaro.org; helo=mail-qk1-x733.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "open list:ARM TCG CPUs" , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi, On 1/11/21 11:36 AM, Alex Bennée wrote: > > Luis Machado writes: > >> For the record, the layout looks OK to me. > > So a Reviewed-by? > Yes. >> Just a reminder that GDB will soon support bfloat16 types. A patch may >> be pushed this month. > > Will we be able to probe for the support - or will an older GDB silently > accept and drop any bfloat16 fields? > No probing unfortunately. I think GDB wouldn't handle it nicely. Older GDB's not supporting bfloat16 may throw an internal error when they see an unknown type. That may need to be corrected to make it more robust. >> >> On 1/8/21 7:42 PM, Alex Bennée wrote: >>> While GDB can work with any XML description given to it there is >>> special handling for SVE registers on the GDB side which makes the >>> users life a little better. The changes aren't that major and all the >>> registers save the $vg reported the same. All that changes is: >>> >>> - report org.gnu.gdb.aarch64.sve >>> - use gdb nomenclature for names and types >>> - minor re-ordering of the types to match reference >>> - re-enable ieee_half (as we know gdb supports it now) >>> - $vg is now a 64 bit int >>> - check $vN and $zN aliasing in test >>> >>> Signed-off-by: Alex Bennée >>> Cc: Luis Machado >>> Message-Id: <20201218112707.28348-10-alex.bennee@linaro.org> >>> Signed-off-by: Alex Bennée >>> --- >>> target/arm/gdbstub.c | 75 ++++++++------------- >>> target/arm/helper.c | 2 +- >>> tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 11 +++ >>> 3 files changed, 41 insertions(+), 47 deletions(-) >>> >>> diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c >>> index 866595b4f1..a8fff2a3d0 100644 >>> --- a/target/arm/gdbstub.c >>> +++ b/target/arm/gdbstub.c >>> @@ -195,22 +195,17 @@ static const struct TypeSize vec_lanes[] = { >>> { "uint128", 128, 'q', 'u' }, >>> { "int128", 128, 'q', 's' }, >>> /* 64 bit */ >>> + { "ieee_double", 64, 'd', 'f' }, >>> { "uint64", 64, 'd', 'u' }, >>> { "int64", 64, 'd', 's' }, >>> - { "ieee_double", 64, 'd', 'f' }, >>> /* 32 bit */ >>> + { "ieee_single", 32, 's', 'f' }, >>> { "uint32", 32, 's', 'u' }, >>> { "int32", 32, 's', 's' }, >>> - { "ieee_single", 32, 's', 'f' }, >>> /* 16 bit */ >>> + { "ieee_half", 16, 'h', 'f' }, >>> { "uint16", 16, 'h', 'u' }, >>> { "int16", 16, 'h', 's' }, >>> - /* >>> - * TODO: currently there is no reliable way of telling >>> - * if the remote gdb actually understands ieee_half so >>> - * we don't expose it in the target description for now. >>> - * { "ieee_half", 16, 'h', 'f' }, >>> - */ >>> /* bytes */ >>> { "uint8", 8, 'b', 'u' }, >>> { "int8", 8, 'b', 's' }, >>> @@ -223,17 +218,16 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) >>> GString *s = g_string_new(NULL); >>> DynamicGDBXMLInfo *info = &cpu->dyn_svereg_xml; >>> g_autoptr(GString) ts = g_string_new(""); >>> - int i, bits, reg_width = (cpu->sve_max_vq * 128); >>> + int i, j, bits, reg_width = (cpu->sve_max_vq * 128); >>> info->num = 0; >>> g_string_printf(s, ""); >>> g_string_append_printf(s, ""); >>> - g_string_append_printf(s, ""); >>> + g_string_append_printf(s, ""); >>> >>> /* First define types and totals in a whole VL */ >>> for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { >>> int count = reg_width / vec_lanes[i].size; >>> - g_string_printf(ts, "vq%d%c%c", count, >>> - vec_lanes[i].sz, vec_lanes[i].suffix); >>> + g_string_printf(ts, "svev%c%c", vec_lanes[i].sz, vec_lanes[i].suffix); >>> g_string_append_printf(s, >>> "", >>> ts->str, vec_lanes[i].gdb_type, count); >>> @@ -243,39 +237,37 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) >>> * signed and potentially float versions of each size from 128 to >>> * 8 bits. >>> */ >>> - for (bits = 128; bits >= 8; bits /= 2) { >>> - int count = reg_width / bits; >>> - g_string_append_printf(s, "", count); >>> - for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { >>> - if (vec_lanes[i].size == bits) { >>> - g_string_append_printf(s, "", >>> - vec_lanes[i].suffix, >>> - count, >>> - vec_lanes[i].sz, vec_lanes[i].suffix); >>> + for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { >>> + const char suf[] = { 'q', 'd', 's', 'h', 'b' }; >>> + g_string_append_printf(s, "", suf[i]); >>> + for (j = 0; j < ARRAY_SIZE(vec_lanes); j++) { >>> + if (vec_lanes[j].size == bits) { >>> + g_string_append_printf(s, "", >>> + vec_lanes[j].suffix, >>> + vec_lanes[j].sz, vec_lanes[j].suffix); >>> } >>> } >>> g_string_append(s, ""); >>> } >>> /* And now the final union of unions */ >>> - g_string_append(s, ""); >>> - for (bits = 128; bits >= 8; bits /= 2) { >>> - int count = reg_width / bits; >>> - for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { >>> - if (vec_lanes[i].size == bits) { >>> - g_string_append_printf(s, "", >>> - vec_lanes[i].sz, count); >>> - break; >>> - } >>> - } >>> + g_string_append(s, ""); >>> + for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { >>> + const char suf[] = { 'q', 'd', 's', 'h', 'b' }; >>> + g_string_append_printf(s, "", >>> + suf[i], suf[i]); >>> } >>> g_string_append(s, ""); >>> >>> + /* Finally the sve prefix type */ >>> + g_string_append_printf(s, >>> + "", >>> + reg_width / 8); >>> + >>> /* Then define each register in parts for each vq */ >>> for (i = 0; i < 32; i++) { >>> g_string_append_printf(s, >>> ">> - " regnum=\"%d\" group=\"vector\"" >>> - " type=\"vq\"/>", >>> + " regnum=\"%d\" type=\"svev\"/>", >>> i, reg_width, base_reg++); >>> info->num++; >>> } >>> @@ -287,31 +279,22 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) >>> " regnum=\"%d\" group=\"float\"" >>> " type=\"int\"/>", base_reg++); >>> info->num += 2; >>> - /* >>> - * Predicate registers aren't so big they are worth splitting up >>> - * but we do need to define a type to hold the array of quad >>> - * references. >>> - */ >>> - g_string_append_printf(s, >>> - "", >>> - cpu->sve_max_vq); >>> + >>> for (i = 0; i < 16; i++) { >>> g_string_append_printf(s, >>> ">> - " regnum=\"%d\" group=\"vector\"" >>> - " type=\"vqp\"/>", >>> + " regnum=\"%d\" type=\"svep\"/>", >>> i, cpu->sve_max_vq * 16, base_reg++); >>> info->num++; >>> } >>> g_string_append_printf(s, >>> ">> " regnum=\"%d\" group=\"vector\"" >>> - " type=\"vqp\"/>", >>> + " type=\"svep\"/>", >>> cpu->sve_max_vq * 16, base_reg++); >>> g_string_append_printf(s, >>> ">> - " regnum=\"%d\" group=\"vector\"" >>> - " type=\"uint32\"/>", >>> + " regnum=\"%d\" type=\"int\"/>", >>> base_reg++); >>> info->num += 2; >>> g_string_append_printf(s, ""); >>> diff --git a/target/arm/helper.c b/target/arm/helper.c >>> index d077dd9ef5..d434044f07 100644 >>> --- a/target/arm/helper.c >>> +++ b/target/arm/helper.c >>> @@ -276,7 +276,7 @@ static int arm_gdb_get_svereg(CPUARMState *env, GByteArray *buf, int reg) >>> * while the ZCR works in Vector Quads (VQ) which is 128bit chunks. >>> */ >>> int vq = sve_zcr_len_for_el(env, arm_current_el(env)) + 1; >>> - return gdb_get_reg32(buf, vq * 2); >>> + return gdb_get_reg64(buf, vq * 2); >>> } >>> default: >>> /* gdbstub asked for something out our range */ >>> diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py >>> index 972cf73c31..b9ef169c1a 100644 >>> --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py >>> +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py >>> @@ -40,6 +40,17 @@ class TestBreakpoint(gdb.Breakpoint): >>> except gdb.error: >>> report(False, "checking zregs (out of range)") >>> >>> + # Check the aliased V registers are set and GDB has correctly >>> + # created them for us having recognised and handled SVE. >>> + try: >>> + for i in range(0, 16): >>> + val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i) >>> + val_v = gdb.parse_and_eval("$v0.b.u[%d]" % i) >>> + report(int(val_z) == int(val_v), >>> + "v0.b.u[%d] == z0.b.u[%d]" % (i, i)) >>> + except gdb.error: >>> + report(False, "checking vregs (out of range)") >>> + >>> >>> def run_test(): >>> "Run through the tests one by one" >>> > >