From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2071.outbound.protection.outlook.com [40.107.7.71]) by sourceware.org (Postfix) with ESMTPS id 9ACB13858035 for ; Wed, 30 Aug 2023 12:56:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9ACB13858035 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GmRfcbBxzg7p4QUTBuEYBbMU9goTLDZtH0ZE6Pqt4Uk=; b=f+Yj+RW5yWVJDFrBHcamyo+UxTc6kI+rSXfZi+dJeeQU2OuJ+BqszAOK+pxoplpwxSWcaYEtiui4UiPyH4PAyDNZzT8kXcC//BZ0xsK5Q4UZIAknNLnvQ2IpAuogaFH55jILfvkNqKrtT4+t63dADky792C7WWguzeBA/S9LCBs= Received: from DU2PR04CA0078.eurprd04.prod.outlook.com (2603:10a6:10:232::23) by DB9PR08MB6570.eurprd08.prod.outlook.com (2603:10a6:10:251::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.20; Wed, 30 Aug 2023 12:56:13 +0000 Received: from DBAEUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::6d) by DU2PR04CA0078.outlook.office365.com (2603:10a6:10:232::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34 via Frontend Transport; Wed, 30 Aug 2023 12:56:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT062.mail.protection.outlook.com (100.127.142.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.20 via Frontend Transport; Wed, 30 Aug 2023 12:56:13 +0000 Received: ("Tessian outbound 30c9f5e988c5:v175"); Wed, 30 Aug 2023 12:56:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 78c96fc562de09ff X-CR-MTA-TID: 64aa7808 Received: from 94fed494375b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 301BEEBF-A323-4414-85AB-52285DBDB226.1; Wed, 30 Aug 2023 12:56:06 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 94fed494375b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Aug 2023 12:56:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OH65YpZrayylD+ZntrPsg1YDN9ALEvQ7N7a3Y6e2R1rx+ZzZ3nb0HbnMZKw7IRiz/7XsXKVFP/El0aEi/yjhYCmh2yhhnu/FlK+Dy7UisjuFeViATvKcwHQk9Frv2uJ4rcZckOKH6zzbZ6o6VM8geMAQjK8MSCqXnlXPqFfyPs+yZeY+acrpXayj0rLFggvhUEE1//Ol48c6Q/spFgtWSGAtrqAY/01K+2NtA2JLHW1rhwg2jQeQPr1OsQIFXfUJu2WUbrTCnI+aOXaWHzVKUcNie81Y+6G+yoCMGJCt7iZFw3KEYaTFsK8n2MGaytteVNiGEWJHh+5ZpIEN+HxGFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GmRfcbBxzg7p4QUTBuEYBbMU9goTLDZtH0ZE6Pqt4Uk=; b=A1U2Zr5jBRB8LjIdSRthBAqAGxLZ80bMnXzwaCxlSbidJY/j7ue45O17xTy1JVxeK+kmEuHj8Ru2cowDHK4C7Q8U7hj62ow5TTJmSkjqGq8KJ65yloPIOM9od411VTZYAwbPSqHt/Ty95YcMl8+f+OTT85QR6MpvhDv20wQrU8dS3MTrdtkRNEU6KIh1lBhr+TjNINEmJ6m8106uQtbHi9RYjJJQeNuoIvv4alD3QlJSz3ZSAnL32ntV3YSE3ctlwB2cZQzB0hm8d4zz3n0yjx4CIoIPwIEKUcuqkI15jfkLao/V0b0eTblPGr6z3DS7pQ80wtkt1Z9XEphNQ9yuxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GmRfcbBxzg7p4QUTBuEYBbMU9goTLDZtH0ZE6Pqt4Uk=; b=f+Yj+RW5yWVJDFrBHcamyo+UxTc6kI+rSXfZi+dJeeQU2OuJ+BqszAOK+pxoplpwxSWcaYEtiui4UiPyH4PAyDNZzT8kXcC//BZ0xsK5Q4UZIAknNLnvQ2IpAuogaFH55jILfvkNqKrtT4+t63dADky792C7WWguzeBA/S9LCBs= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AS8PR08MB7943.eurprd08.prod.outlook.com (2603:10a6:20b:53b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.36; Wed, 30 Aug 2023 12:56:04 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2%6]) with mapi id 15.20.6699.034; Wed, 30 Aug 2023 12:56:04 +0000 Message-ID: Date: Wed, 30 Aug 2023 13:56:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 4/6] [gdb/aarch64] sme2: Core file support for ZT register set Content-Language: en-US To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org References: <20230822112144.1513268-1-luis.machado@arm.com> <20230822112144.1513268-5-luis.machado@arm.com> <87bketl1oo.fsf@linaro.org> From: Luis Machado In-Reply-To: <87bketl1oo.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0437.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a9::10) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS8PR08MB7943:EE_|DBAEUR03FT062:EE_|DB9PR08MB6570:EE_ X-MS-Office365-Filtering-Correlation-Id: 1450d9f6-e460-4102-9d01-08dba9587da5 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: q+8D3lnolJzSJzTR515NcbiG/v2Xmk+DdoAkFBdBlpDNWHgGkUHa2TlD3i0VYIgjBrX2iLpikfVo969gjD37oySW05nzXOKHB+dIr5Ex2/2ITFoRMa1DVD5d3zIp05Gw99dpzPh2qcs2C9LKvCyT5fQ7aTZ/3/B1cesPR2ruR2mfo1eVDkJsVNYlv2GJRLaxJt0rvQYasbPM003McTTcbFxRyr+ox98fO2dQaty/2wneJYZuzEfEldtJyvimUf2EMehlZPrN4SNxLIvQsbF/mjjiIAd10Naf3vkNGIJyAoYgHHaMbvrQwctp1x+lH9yFq9Y8RzYFVGJC8h8a0mNM0jXSlwfS35p/R5iVpP8dSHj99UmaXGc3h3rizEosAp98GsrbNvUgzc7Ghu901UBexaZCsIF5PthVAjlyOtxRRLK3quAkDS1ypm3lCl6VuXHzIQ5j8SJk6xNQMdhMQLZBgG2ITbldbhN5577tadCIsRP+2xC73IeERAt07NntzcExLbUYbjxu82VS8Ca8v+NREh+M2Ls8mhjSgMDb1xYy7HTVMX9XcdOUnEt7/Mis4FJAvBOQxanSLO9NfkqYfewSFvwUi/3eMpuBA+KKUbVOwdnVoVAFWHmmSyJdNdVoRanBlTVBJ0dTPfJ3q+sFfv38OQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(346002)(136003)(376002)(366004)(39860400002)(1800799009)(186009)(451199024)(8936002)(53546011)(478600001)(31686004)(6506007)(66556008)(66946007)(66476007)(6486002)(6916009)(316002)(38100700002)(41300700001)(6512007)(8676002)(5660300002)(44832011)(36756003)(83380400001)(2906002)(31696002)(2616005)(86362001)(26005)(4326008)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7943 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8742799a-ad12-4019-5b6c-08dba9587825 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zwkTK82bhbh/6iETX9O0SQysiNrc9/OD3GocdZGD51FMnFYbxX5eG5ZtewC//ypAVrg3IVWoakcuPpz0m0f0HtejWlzAdBnNflKmlJsHAH45VbNgxL5ws4XuPnAzspfs0Yuo/QGz5PYVMfnftrAsoU0WEAXoMF6oS6YOSJC6pBhoUSscnVKY75XOGZ0Z9W31eLbImsemSumeYZtJBPdIIvzq4ChwePq2YpWnRRtTBe8I2QiMf1nPCD9d9VXR28sM+6gPKQp+/AoRFAsVvcAhLvk9rrnEywl2ZS9euOnLigXRw23j/ALjTP5ttI4L2mgGZcDhJucjyTofcdvG9nATV2vQpwGkK0nzfQxBu2g+nty2uXzjphIfanIH9vygYTtbKkic8AXsrN2I96l1Bi2UHUjTKAJzL4OsRr69JkFLAyWf52HCXcW61jxxm8Xlm91EPwng7+BozKVHMOpVusCvOUvddfBLllEbYJeVU+6Jvr+diy6vQk0Q2s2WjYfIoa+M6OonrblS8cEvJw/H3BZC+nCwBcIjjJIIaoq8fQJpgpy19vxC+fuOwmW40KcObba82tEnrZP2diImwQCNnESNK9sXdztCvNrrgIZQfXyz94l4tmLqTjKlifsImvfTBU0vzhwpLLJmwljIF/WAJxB0K0sHUPCcuDZaR3mqvFDORJWW7WHYffKNtuxh/DWC89maeEnNqi6jpsxYBDkhCrvolYzgxfjdzBkM4gRWgh22aIByoplfnuf3g0VG3ZC2oCD+MEyE03aXh2SwgQ/1yfYyow== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(39860400002)(136003)(376002)(396003)(82310400011)(451199024)(1800799009)(186009)(46966006)(36840700001)(40470700004)(82740400003)(6486002)(6512007)(6506007)(53546011)(83380400001)(478600001)(2906002)(26005)(336012)(41300700001)(316002)(44832011)(8676002)(70206006)(8936002)(5660300002)(6862004)(70586007)(4326008)(40460700003)(36756003)(40480700001)(36860700001)(2616005)(47076005)(356005)(31696002)(86362001)(81166007)(31686004)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2023 12:56:13.3122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1450d9f6-e460-4102-9d01-08dba9587da5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6570 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 8/27/23 02:21, Thiago Jung Bauermann wrote: > > Luis Machado writes: > >> This patch adds support for ZT register dumps/reads for core files. The >> ZT register is available when the SME2 feature is advertised as available >> by the Linux Kernel. >> >> Unlike the enablement for SME1 and the ZA register, support for SME2 is rather >> simple given the fixed size of the ZT0 register. >> >> Validated on the Fast Models. >> --- >> gdb/aarch64-linux-tdep.c | 81 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 81 insertions(+) >> >> diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c >> index 8b0b4d32971..a4d1fb87cbf 100644 >> --- a/gdb/aarch64-linux-tdep.c >> +++ b/gdb/aarch64-linux-tdep.c >> @@ -1374,6 +1374,50 @@ aarch64_linux_collect_za_regset (const struct regset *regset, >> size - SVE_HEADER_SIZE); >> } >> >> +/* Supply register REGNUM from BUF to REGCACHE, using the register map >> + in REGSET. If REGNUM is -1, do this for all registers in REGSET. >> + If BUF is NULL, set the registers to "unavailable" status. */ >> + >> +static void >> +aarch64_linux_supply_zt_regset (const struct regset *regset, >> + struct regcache *regcache, >> + int regnum, const void *buf, size_t size) >> +{ >> + /* Read the ZT register note from a core file into the register buffer. */ >> + >> + /* Handle an empty buffer. */ >> + if (buf == nullptr) >> + return regcache->supply_regset (regset, regnum, nullptr, size); >> + >> + aarch64_gdbarch_tdep *tdep >> + = gdbarch_tdep (regcache->arch ()); > > Is it worth adding here a "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"? > Yes. That makes sense. >> + >> + /* Supply the ZT0 register contents. */ >> + regcache->raw_supply (tdep->sme2_zt0_regnum, buf); >> +} >> + >> +/* Collect register REGNUM from REGCACHE to BUF, using the register >> + map in REGSET. If REGNUM is -1, do this for all registers in >> + REGSET. */ >> + >> +static void >> +aarch64_linux_collect_zt_regset (const struct regset *regset, >> + const struct regcache *regcache, >> + int regnum, void *buf, size_t size) >> +{ >> + /* Read the ZT register contents from the register buffer into the core >> + file section. */ >> + >> + gdb_assert (buf != nullptr); > > Also here, is it worth adding a > "gdb_assert (size >= AARCH64_SME2_ZT0_SIZE)"? > Fixed as well. >> + >> + aarch64_gdbarch_tdep *tdep >> + = gdbarch_tdep (regcache->arch ()); >> + >> + /* Dump the register cache contents for the ZT register to the buffer. */ >> + regcache->collect_regset (regset, tdep->sme2_zt0_regnum, buf, >> + AARCH64_SME2_ZT0_SIZE); >> +} >> + > > Reviewed-by: Thiago Jung Bauermann >