From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150045.outbound.protection.outlook.com [40.107.15.45]) by sourceware.org (Postfix) with ESMTPS id 6F2AC3858D28 for ; Tue, 20 Sep 2022 08:09:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F2AC3858D28 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=MzOwzAglSm/O20JrXYTSyox50Ex3v6DWOW0Yq9p7VZ3/VlJacIzwy5rERZeNoF4bQCtdBR19kWYZxYpmvsvs386EsvtVlx/wsZWNU63xndrfCLuaiFqctvYLzDo4JyL5Xdov58kmMTyKrdzvf11szREP0bM/QO5zQt9Qm+KYF0T4+z659l3IgqUm8WLiMizitG3VuyarW/DeZ6pTyXUVwq6ashJPMkUc/UtbDUQVpuW7laPVCUOKRlMhHU/mBQS4AgXuPHaIu/Eq1tTiuU9ciTSHNc0imc9XmS8tPnzXUqH1ZyphxiFhbZS1uyYVH14gbZVpUpXROAUrPhebkPNK4g== ARC-Message-Signature: i=2; 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=Ym6dpusVL7v4SaEOn4CTlAu1XJwsD7BQjEP+TYyER0E=; b=ODHz9w8r+LiVDWwytr6oRz8fKGNajBXBMB6v9HGbrkBSZWxf3VlCc2nn0aFt8Z/CMRSh3iv3ns/zOkd0S8vyLlPzGzpN70scCAzDAzKIn3lM5PpSL6oVu1O07p9MXVAouSjgFEHpssCW+yGiy0xky+SGrRK9L2Gu+ZMw54iHBKR5CvuoO4G2UHHRsKDuGFezyUpccwUAHXZLTxXCt5XmcnXq2bolui6u1LmgaHXbeRP49BkEKGtvKWgJcpeEvuTFlHow4Pw7KWjbYO2w/bqamkRPwTSy0qNW05DyPf1ZBUZQEtKOmDpI1c9/cukqRU7joyIpcmQHCsvvinBy8DdCyg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DB6PR0802CA0025.eurprd08.prod.outlook.com (2603:10a6:4:a3::11) by AS8PR08MB6631.eurprd08.prod.outlook.com (2603:10a6:20b:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Tue, 20 Sep 2022 08:08:58 +0000 Received: from DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a3:cafe::9d) by DB6PR0802CA0025.outlook.office365.com (2603:10a6:4:a3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21 via Frontend Transport; Tue, 20 Sep 2022 08:08:58 +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 DBAEUR03FT029.mail.protection.outlook.com (100.127.142.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.12 via Frontend Transport; Tue, 20 Sep 2022 08:08:58 +0000 Received: ("Tessian outbound 8ec96648b960:v124"); Tue, 20 Sep 2022 08:08:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f7d2a389f406f33e X-CR-MTA-TID: 64aa7808 Received: from cfbfaa750ef3.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E0D97277-EFBC-445D-B595-5B78800AD406.1; Tue, 20 Sep 2022 08:08:51 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cfbfaa750ef3.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 20 Sep 2022 08:08:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c6nOovSF7i8o4wea1L3NiYDHHgecxItgPO+qoawSnG3UV6DsPrR2jtI+FG5BXz84pO4re3BC9k2ZRPOd0GiVhvOSAcTt8J2Qp6beFhY0eUOHc/Rxs50G1lh4jNjL4hg/hPfigkgroYO2PJRpL3Nmyvm9lhTBIAC1upQHdJgdfwj1fFe8L5PrQ6XJt0iPlJLyVBix4LKjEjON90Z5msSdradK05sjNVM5HG5FLfnFCfRDWL6SAPVDuLVQFfNUIV/Mf+j05j/9VjJc/1MHyZ6UCuJiFjiBk1lt8gjiPv2I41CuELlMFCPvR/D++g+3/OGRLe8TBqhsAeFElzglr3c7Gw== 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=Ym6dpusVL7v4SaEOn4CTlAu1XJwsD7BQjEP+TYyER0E=; b=CpUX6DJAzutaZM2oiYnmgk96DP0iMte5radTFDP0yb9vWBdgDA5CQLiHwr0eaM/vSd9D8RHGWAzDSDkte9BQ5uq8na/cR/hZFmFG5r4kH7td2phX125zqlPVhqwX5KqMNUUg5TW1kTVHw+O5yJgWGlEfjOC21ekkXyHtNNwNqE+5+qyaBzlmRXvX4Kep0uyKDsrXhedJZO3WFi00+kl/QhsYgaUlfdwMZ0Z39EAyDRm+QRO2LrkpnL0eLGYGvSNXFBWxsL/BjWGD4V6ziuO8zN0HC5oYw3hDV4gAq1OOvVUKyft/FUjAJKOiY7WVfqTHsCBgcaav2MMZMk0v3eA9Fw== 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 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 DU0PR08MB8375.eurprd08.prod.outlook.com (2603:10a6:10:408::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.18; Tue, 20 Sep 2022 08:08:49 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094%5]) with mapi id 15.20.5632.021; Tue, 20 Sep 2022 08:08:48 +0000 Message-ID: <7f22611a-ba26-866d-f3ec-1a1fd0b253bc@arm.com> Date: Tue, 20 Sep 2022 09:08:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Content-Language: en-US To: Thiago Jung Bauermann , gdb-patches@sourceware.org References: <20220908064151.3959930-1-thiago.bauermann@linaro.org> <20220908064151.3959930-5-thiago.bauermann@linaro.org> From: Luis Machado In-Reply-To: <20220908064151.3959930-5-thiago.bauermann@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0129.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::21) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DU0PR08MB8375:EE_|DBAEUR03FT029:EE_|AS8PR08MB6631:EE_ X-MS-Office365-Filtering-Correlation-Id: fb034576-794d-431c-66cd-08da9adf5e99 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: eR3tXUaggkMK99h51A9UH1oMLjHC6R60/5F3PCrteOhV/5nEsMi8SUg8rpzZgWCaKGlYl89LKqYT0F7vYPerVEEtzCoCRdskv2ALu13JosLN/R+734KwdduapJwunFb2sSIoRxjJGMdUeIinvwjUt1ph5XmqsHJ7bnYlwfBL2WIVzP/ls7AMP16A1D87QlkJJMWNKH+6qsCukat+pFAIPJ80HEDTPq2fWAOkVPjI1mveCDrDozsiCfrwAvSHHCRGx9HHzazofqqa8XHw4ALd/LjfkarVQmfediQm0gtnLeAaQXhpw6qti8y2U7OYE23UV1YOL1VSwk0fmUJjwPhALc9louq1Fa2zQRVry7oJtE7CJuh2cPg6gwHRHUSMmc6ep/aQOz3Y0tTBMaklVcHS8DK28Utkczzc714c5dp5FiO9F1TgpZ/fhH5VE7ybUKCiZY50HCHmMvn41xDveFjFclAuk4Xe0M+LsiulluvUukGc9mO1d9I3mH7fa6cb4cCVlwiUCuS5u5pg7/DUSPqxqqZZGg3MKX0/mOFlsdVmZET97CeAT+m6UgY4fj9LLQ42KW57clTjwf+jznmUiFW/PKbg1DCmfbu43FSeojBy1VzjXFypGSDYQebWD6rEXmPvKZrmDZW90IAZIl+HpWWhGxHd5Zs9GqJBjFFhgP0RWvu9tyqn3CVF58ab4o9yhIcCT5A+LP0lCE3lNnyJGvAE9Yjh8SWa2x0yOWBh1vON+Xf3hV23pH3QtAroLI+7leqr9Pxg1ip5KDpykoiHzFC17hCNNr9nG6wZ5QgPj0HbxlE= 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:(13230022)(4636009)(39860400002)(376002)(346002)(366004)(136003)(396003)(451199015)(8676002)(31686004)(44832011)(36756003)(478600001)(66556008)(186003)(6486002)(66946007)(53546011)(6506007)(31696002)(86362001)(26005)(66476007)(41300700001)(8936002)(83380400001)(38100700002)(5660300002)(6512007)(316002)(2906002)(2616005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8375 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: DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 91142114-9379-449b-96d8-08da9adf58e8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1jCdTGD9dLNKu9UdxV0pybgMgh9gZxDttst+yvn2UzYTOe1NLkS5k8ErQEHlbAlS44ZzenNXBQvPg0G1Mtdga/DSoOXlNOQ0AKfWrEDp/t7tDa3ADzvXe7Lfu2yssW+ub7w745CHUSavhJribbgAq6BABu6L2rAeZYSyg2UWhyFLdj4e1y1Dj8iVY2Vm6Xf04QB+l4BypD/mW59LoGT0Tm1Oy9EwLrZqnAI5bN+ayyKGt9js2t7+k/0AkdK89NpT2GVgf/mlRBxXv0UH62vGd4a0kE2/tvBeDBmywbIa15alJpIGedyUtEvS0eJizJmPNLE3Mt7v3/lZaPMY34ryn4jDGH4jts2pXWOcGgRUmxtHN255CQqrPS3N73DQar11yP7M5f4BxPwr8as5bvz+657N26gdvo0pZsUwu9Qx4mRQP7QnazDAbCKp/7WJ1A/o7o7HkXySxwPNDocyErm2eqDq67C8rCJjVwJCSt1cFKICYDKzZokU+R2rVaud9V7NMxlfQBwVI3VVtYDsb2djR9bpiS9cKeX7w2mLgMpvxVX+OmJNbnAuS8eiIuVsS1TfyIY+kfYxqE0dZ7yJvGyzMQgufEQ1l11Ft7mIf0U/DlwEjzCxpH6bBlhax9GgHpJxsCI1cU91rBGAXrB9M74z4INbi32ULWexZaS/HyiOP6LGmR57pP9o97kD5D5nCsg9xyRD0mmDOFupEo643TLdD6wLJQ9g9AZFzfWosNLKpwOx6wiGwU93oVGaTpV44GXui/gxvwYJ4Wgv/Vbv1/7jNoMVLEf+263Tb3lomQoQPuOu/3/EB6k4u6GBSeaVjo5u 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:(13230022)(4636009)(136003)(396003)(346002)(376002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(82740400003)(81166007)(356005)(31696002)(36756003)(86362001)(31686004)(83380400001)(36860700001)(186003)(82310400005)(6506007)(6512007)(2906002)(40480700001)(40460700003)(47076005)(2616005)(478600001)(336012)(41300700001)(26005)(53546011)(6486002)(44832011)(5660300002)(8936002)(316002)(8676002)(70206006)(70586007)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2022 08:08:58.1686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb034576-794d-431c-66cd-08da9adf5e99 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: DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6631 X-Spam-Status: No, score=-13.5 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2022 08:09:12 -0000 On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote: > It will be used in a subsequent commit. There's no functional change. > --- > gdbserver/linux-aarch64-low.cc | 45 ++++++++++++++++++++++------------ > 1 file changed, 29 insertions(+), 16 deletions(-) > > diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc > index 576925838f49..9b57be73818e 100644 > --- a/gdbserver/linux-aarch64-low.cc > +++ b/gdbserver/linux-aarch64-low.cc > @@ -652,6 +652,28 @@ aarch64_target::low_delete_process (arch_process_info *info) > xfree (info); > } > > +/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ > +#define AARCH64_HWCAP_PACA (1 << 30) > + > +static gdb::optional > +aarch64_get_arch_features (const thread_info *thread) > +{ > + struct aarch64_features features; > + int vq = aarch64_sve_get_vq (thread->id.lwp ()); > + > + if (vq < 0) > + return {}; If we can't identify SVE properly, should we carry on and disable SVE support but enable all the other features we can find? > + > + features.vq = vq; > + /* A-profile PAC is 64-bit only. */ > + features.pauth = linux_get_hwcap (thread, 8) & AARCH64_HWCAP_PACA; > + /* A-profile MTE is 64-bit only. */ > + features.mte = linux_get_hwcap2 (thread, 8) & HWCAP2_MTE; > + features.tls = true; > + > + return features; > +} > + > void > aarch64_target::low_new_thread (lwp_info *lwp) > { > @@ -804,9 +826,6 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) > } > } > > -/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ > -#define AARCH64_HWCAP_PACA (1 << 30) > - > /* Implementation of linux target ops method "low_arch_setup". */ > > void > @@ -822,24 +841,18 @@ aarch64_target::low_arch_setup () > > if (is_elf64) > { > - struct aarch64_features features; > - int vq = aarch64_sve_get_vq (tid); > + gdb::optional features > + = aarch64_get_arch_features (current_thread); > > - /* If ptrace fails we can't determine vq, but the low_arch_setup method > - always succeeds so all we can do here is assert that vq is valid. */ > - gdb_assert (vq >= 0); > - features.vq = vq; > - /* A-profile PAC is 64-bit only. */ > - features.pauth = linux_get_hwcap (current_thread, 8) & AARCH64_HWCAP_PACA; > - /* A-profile MTE is 64-bit only. */ > - features.mte = linux_get_hwcap2 (current_thread, 8) & HWCAP2_MTE; > - features.tls = true; > + /* If ptrace fails we can't determine vq, but low_arch_setup always > + succeeds so all we can do here is assert that features is valid. */ > + gdb_assert (features.has_value ()); > > - current_process ()->tdesc = aarch64_linux_read_description (features); > + current_process ()->tdesc = aarch64_linux_read_description (*features); > > /* Adjust the register sets we should use for this particular set of > features. */ > - aarch64_adjust_register_sets (features); > + aarch64_adjust_register_sets (*features); > } > else > current_process ()->tdesc = aarch32_linux_read_description ();