From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9DD1A74003A for ; Fri, 22 Sep 2023 14:40:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=oYtj+HHY2GpfZTXT0qKFCBGMyRSRhpuge2mSrLZEyJ8=; c=relaxed/simple; d=groups.io; h=Received-SPF:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:NoDisclaimer:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1695393630; v=1; b=d6P+i1yKu6LHGY9BPm3czyOzrI9KzFbpCUKMWMa7g8iq0t8J5+bUk2zWUqPYl6NzjR5bHqUI YmkU6jzlzaCNTB2oKG6SoIvGsO/H2Dej1jrfOmr13qh4gVeX5lVa3RhiMpyW2k/5xU6f9jFCidl 01kW5pBlyggR1RoxrW1eALdQ= X-Received: by 127.0.0.2 with SMTP id kor0YY7687511xHIXrE0LI9H; Fri, 22 Sep 2023 07:40:30 -0700 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.49]) by mx.groups.io with SMTP id smtpd.web11.23480.1695393629345081454 for ; Fri, 22 Sep 2023 07:40:29 -0700 X-Received: from DU7PR01CA0039.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::12) by DU0PR08MB7488.eurprd08.prod.outlook.com (2603:10a6:10:358::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Fri, 22 Sep 2023 14:40:21 +0000 X-Received: from DBAEUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:50e:cafe::86) by DU7PR01CA0039.outlook.office365.com (2603:10a6:10:50e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.32 via Frontend Transport; Fri, 22 Sep 2023 14:40:21 +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 X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT039.mail.protection.outlook.com (100.127.142.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.14 via Frontend Transport; Fri, 22 Sep 2023 14:40:20 +0000 X-Received: ("Tessian outbound 5c548696a0e7:v175"); Fri, 22 Sep 2023 14:40:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 993cd0e863fcb73e X-CR-MTA-TID: 64aa7808 X-Received: from 9cf3adcd5299.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E8719FD5-CCB1-45E7-8471-DA76E8A4F880.1; Fri, 22 Sep 2023 14:35:28 +0000 X-Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9cf3adcd5299.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Sep 2023 14:35:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1Xk9PFRSk56oXkwOyXHsu4a9vsgBT1OMivKm0odHrLv4egjPC4SExVVKDEU7N3J4/HdqfYwnspx+6fzNGCvJSLp9d3WOntYHBdnpDFR+sTjC06wdDem/N0jUIJCjd9xM2ngV9B2zCG9/YZQBbcep5JlbRMHc0X1+FLr5KJ0GzMngkoVIJOpVfE//4tUCyYehrCbu7yK6ePBoZdRfvKg/nZX1gjVTWxDu0SI+Yv+cb7Lc2skmFrD5BD/6Xlcd4QQgj0MuH3kpouySlhODosjnivDkQQkgmXvQknzCkZwfyxNP06/e6121oUpIVP4vC7GD0jr1vWPb68rrgT1N3Ko6w== 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=IMF9l3QNP4iLHqaCLnTLewn5Tnq1mHmEU0CzVenJ9rk=; b=YWv6eg3Q2M/wuV7ptwg/WdfE2Gi9wLkONB1yRdb6C68oR7f1WpRyxyyK01Vb+DvQ7TehoTH1Ig1LCcjmzw+oQ2YbSqZLtuTA/NyER+sgXTf23y638ImIGuzieMs4/1BwCK2sdOcP95salmGKqThpUlt+9tPbA+8hMuEBDiOHsuue50xiT+9S/SOt//Tdb1ccHeMsWCs6G+KBVlikjOLFV9YhEo/3+Jst4ojn7Qrl9B2rERz0HdGhm731oTBRxHTiHfHgv5i5M4AXU+bplskQu9Q2OtnhO5SA6UhU8AzBWXkfyAC8wpE/pL/lsRvQHD2jkSHDPCzPcDbuZQpjicYGow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DB8PR06CA0040.eurprd06.prod.outlook.com (2603:10a6:10:120::14) by DBBPR08MB6313.eurprd08.prod.outlook.com (2603:10a6:10:202::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Fri, 22 Sep 2023 14:35:26 +0000 X-Received: from DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::24) by DB8PR06CA0040.outlook.office365.com (2603:10a6:10:120::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.29 via Frontend Transport; Fri, 22 Sep 2023 14:35:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT063.mail.protection.outlook.com (100.127.142.255) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.12 via Frontend Transport; Fri, 22 Sep 2023 14:35:26 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 22 Sep 2023 14:35:24 +0000 X-Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Fri, 22 Sep 2023 14:35:23 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , Subject: [edk2-devel] [PATCH v3 12/13] ArmPkg/ArmLib: Add ArmHasTrbe () helper function Date: Fri, 22 Sep 2023 15:35:15 +0100 Message-ID: <20230922143516.4764-13-sami.mujawar@arm.com> In-Reply-To: <20230922143516.4764-1-sami.mujawar@arm.com> References: <20230922143516.4764-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT063:EE_|DBBPR08MB6313:EE_|DBAEUR03FT039:EE_|DU0PR08MB7488:EE_ X-MS-Office365-Filtering-Correlation-Id: 28aa7618-618f-4f92-43c5-08dbbb79d905 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: gAeQCF5WjQbiHtSNyLOhIGVQXoPBwQgzRLMCmT01UzE3L9yU9s/g0XRf7TdyjRIIQq9F2SVT2KbePTwxqLJJuZFPnr7Un5PIJFYMvVECc/2p6wMIIXMIFyqHCCYYX3pRKSjk0e+6jIv5Lsy3oMLsXvE/jP0UWoZsyk6E6U3vpOu0CQEyztIx12vgpbauFSYvnGYVggZ/0endiiaA6nMfyq6JlNvENfqFapkK9B6lkCpbrXxZ3+vAi8Irg/3bOY1Vdqwg5hkwv/yBbi4uHSDAsHtfYATYlvDe4ULmtRlx6lDK/VS0H5Jm5KjdJS90424xE6kJ3XIbx6LeW1mzZQrrJUdjD/ITBekEqDoIjc9G91PNBGPGkRmU9p5crSfll/XYPkCX1Bx3wYfUtmDYqD4EWArwgJE2M0sd+0pv5YwKnXMmoT8kIZYCU/Y4rk8K89mi8/8+7rzhGO3asz50ofAxmQ/EiDNQtAw+RVnM/nupZdX43hylH9VnRtlfIeygxSN4fXKEViDBvVaFmEtjdRf5Jzov0EhR8pNJC7xVckf92CEn/E6df1fw51yEX9Ww7/pp1SNviN0D+70QMd4algtjZh+7uBF9ex9V4Q//JMB/znITR8mQ9PMDnV0LjIbP6zIijpScvQJJRhmKdSt4P84cL1xf9qD6hZAoDcEceISrnMUWOaFpM4X5k5QTe0hNkGZYAZSpLNIz/Jp8CuB6bwBPvQyClsmOZw/B2uyPjGcq6nNhGD9bhcrJumZdTAxKrceIruMyutUeyLwXlMuCC8aZ5Jzf/1qYM5IZCw3Uk0fQvhM= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199024)(1800799009)(186009)(230921699003)(82310400011)(36840700001)(46966006)(40470700004)(83380400001)(82740400003)(7696005)(356005)(40480700001)(5660300002)(44832011)(4326008)(2906002)(316002)(36756003)(8936002)(54906003)(6916009)(8676002)(41300700001)(966005)(6666004)(336012)(478600001)(426003)(47076005)(2616005)(70206006)(81166007)(86362001)(19627235002)(70586007)(40460700003)(1076003)(26005)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6313 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f0330e8c-6413-4afc-28bd-08dbbb792969 X-Microsoft-Antispam-Message-Info: 8LfHwnsXNZ1H0DExXANGIMeTLoUA9nWUgsm8wB+x4/iuwGsJegRsX/nIgYr37Tx+r7CHrWrHoBi5yYK88jqWVvsDqjU6w1wK+dmaOPWCMLoikSZK7V+zyL1iBrUont3ui2qfQQx0IrLtQM7yf1d1fWfksin11L9OrZ1fZRmXzvu+LMgkn4fSY5iPO5yO9vl5z0Xds6vPpKEdp3Qfc1UDp62cnMLLK2zIbEPUQbXP9nL1BJx2HARh7PHgRwpPvVmlWWCo7Z+W7mHTba1H8MA1WMhOJOrOC/Ne52IMDqNJROqlXJp7MGC41d2NRHwc87E86Arz21KxFyQq9sNt8eOrt7Fd+nUA47TE3qK6ebEqyd9Fe7poxhYv3bKBoJSUEMic/SMKhK0wQJX7fjMn3Tms1hr27Q4wWzId9z9kUbwzrc+mrvKp4yqTsEx1cFzYJOjBbLNhCIa4VW3r+y1jhOwMsLqm6Q7iAtDpOuVt74lueFkIStKCVWLPz2GldHSpIsCrMNe3LDGa1CifJa1zsCWU8J6g7dkImV2pU9Nh2JA0x6JWxLCrCeqeOWnJB5CJmeKume9AbqnqC0/92TkFy1xEl7V08sEYwMJZKke8aNlO92hDU74Wqn/0t0DSAwZL34cflgtVE7vgXh3uUB1ZcCL7Y9co9GqVRgNfnP3X5DWOa2r/T0LmecVjp1iVHOPFnxawc7u0sikQxHtW+cT3SJJq+W2Be5EQ0JeOyKQd1uT8M1RD4dHrg1VcB+xCRYcjP6kFy2lRmbEXqeGE4VOT3fvzHQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2023 14:40:20.9494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28aa7618-618f-4f92-43c5-08dbbb79d905 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: DBAEUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7488 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: DBTQYSoN2afwVFlZ62wPoTr1x7686176AA= Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=d6P+i1yK; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Create a helper function to query whether ID_AA64MFR1_EL1 indicates presence of the Trace Buffer Extension (TRBE). This feature is only visible in AARCH64 state. Signed-off-by: Sami Mujawar Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Pierre Gondois --- Notes: v3: - New patch in this series that introduces a helper [SAMI] function for platforms to query if TRBE feature is supported. Ref: https://edk2.groups.io/g/devel/message/108986 ArmPkg/Include/Chipset/AArch64.h | 3 +++ ArmPkg/Include/Library/ArmLib.h | 13 +++++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 15 +++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h index 2e87917049f9c50af9bf674a5ca32d1ae6f072c3..d8711ad7112f1f983d22d98bdf8ff8607bf2ff98 100644 --- a/ArmPkg/Include/Chipset/AArch64.h +++ b/ArmPkg/Include/Chipset/AArch64.h @@ -31,6 +31,9 @@ #define AARCH64_PFR0_FP (0xF << 16) #define AARCH64_PFR0_GIC (0xF << 24) +// ID_AA64DFR0 - AArch64 Debug Feature Register 0 definitions +#define AARCH64_DFR0_TRBE (0xFULL << 44) + // SCR - Secure Configuration Register definitions #define SCR_NS (1 << 0) #define SCR_IRQ (1 << 1) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index 0169dbc1092cddae684362c07c8d5fe3d8809b91..c2d738c06e27a3599b79c7bd83c72f8a696b4aef 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -780,6 +780,19 @@ EFIAPI ArmHasVhe ( VOID ); + +/** + Checks whether the CPU implements the Trace Buffer Extension. + + @retval TRUE FEAT_TRBE is implemented. + @retval FALSE FEAT_TRBE is not mplemented. +**/ +BOOLEAN +EFIAPI +ArmHasTrbe ( + VOID + ); + #endif // MDE_CPU_AARCH64 #ifdef MDE_CPU_ARM diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c index da5755106e623da92be8455af7159e66e5c48661..3a46f360ef512ed68f9ec80fc486551ff7440009 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -119,3 +119,18 @@ ArmHasVhe ( { return ((ArmReadIdAA64Mmfr1 () & AARCH64_MMFR1_VH) != 0); } + +/** + Checks whether the CPU implements the Trace Buffer Extension. + + @retval TRUE FEAT_TRBE is implemented. + @retval FALSE FEAT_TRBE is not mplemented. +**/ +BOOLEAN +EFIAPI +ArmHasTrbe ( + VOID + ) +{ + return ((ArmReadIdAA64Dfr0 () & AARCH64_DFR0_TRBE) != 0); +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109005): https://edk2.groups.io/g/devel/message/109005 Mute This Topic: https://groups.io/mt/101522351/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-