From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.60]) by mx.groups.io with SMTP id smtpd.web11.83522.1682438808995796268 for ; Tue, 25 Apr 2023 09:06:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=Hpk0X2Ta; spf=pass (domain: arm.com, ip: 40.107.22.60, mailfrom: sami.mujawar@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=cA9ZGbgHr2nqbmhR6QxfnNixcBufCHRmpV7d8GJ+anE=; b=Hpk0X2TaMt/Fil7PTOmOg0iPmTSAQI8x+Awcvs913o+hLZt8FdIfSh5v8vrb56O8gEjkaEWZdzoL7iHrt4fBgFMaVtislzlPmP/VlTiQRVPqCoVUXTpxoa0h8ko6guaeAm7gIdVxzCKEs2lf6yW+9xMt/CWuDDQxYMMaV9rIEWE= Received: from AS8PR07CA0012.eurprd07.prod.outlook.com (2603:10a6:20b:451::12) by GV2PR08MB10384.eurprd08.prod.outlook.com (2603:10a6:150:b2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Tue, 25 Apr 2023 16:06:42 +0000 Received: from AM7EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:451:cafe::f0) by AS8PR07CA0012.outlook.office365.com (2603:10a6:20b:451::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.20 via Frontend Transport; Tue, 25 Apr 2023 16:06:42 +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 AM7EUR03FT058.mail.protection.outlook.com (100.127.140.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.21 via Frontend Transport; Tue, 25 Apr 2023 16:06:42 +0000 Received: ("Tessian outbound e13c2446394c:v136"); Tue, 25 Apr 2023 16:06:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1093fe20b0a86a97 X-CR-MTA-TID: 64aa7808 Received: from 95cc29501919.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5FCC725C-A080-4E2E-8B67-3C86A7A29F63.1; Tue, 25 Apr 2023 16:04:37 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 95cc29501919.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Apr 2023 16:04:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MqJc5j3QXxZVST6X4DdIUbPPNcMXDGEQ6kxDJrTvPoxdLgMYnfvLkHizxw6AAQBfiYhNQy2RZQStkCdFlfbsG/2BQo0PfOr8ISu3HpNEpSbYOpvd202+tfTOWeK9KtHW2k6CAILzzVsdOv+n3vOnc3odatOtfFRhHCG0ZYmc6aZv+n9faN0gQ4K/fSUKfT6et8/KP0APdZfkhEIQ2bCodolsAgGEXjnHElwz+5j6/l3ozb9VMmD3CIj+LTMx+FXmXMJeEeW9OdBwi2ORlZ/GsvPXt6mbB5bCeYm2d6vOwH5msjR9y6lOZ2ndEyikhzf9kR96RWkfqdCkmz/iAhxc/A== 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=cA9ZGbgHr2nqbmhR6QxfnNixcBufCHRmpV7d8GJ+anE=; b=LaVGMxwaxzX6CTm2KrRNf+u+2S8FXpWEuwDw7ptlX5A8n2EfcRBstDoaE8fqz40REO181hizzpx05TpwJ+YVNInW88dJygf14hfdBI0V8PuOuzrWQ9JEKbq5ZUdihHWlEBtu0M3Qx5RGrYnNmiaAvWc88aP7gKIah6Gv4cRfGiqtjezyovc+KMpD5yAgSt1F+yUHKJyuDxbk54h5JSg2HvQsKbcq81/TCsBqb5TO3hoyVVUIS8rB/u+z16Bm4tDEdkI7duc0pUYBtvf55wNjY1C8ZZEaEfxsiIgDujbgpoZuhnJ09wxLb72ew6iCU4G+Gvb7ZIvwzIEnyvKyE0uFUw== 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 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=cA9ZGbgHr2nqbmhR6QxfnNixcBufCHRmpV7d8GJ+anE=; b=Hpk0X2TaMt/Fil7PTOmOg0iPmTSAQI8x+Awcvs913o+hLZt8FdIfSh5v8vrb56O8gEjkaEWZdzoL7iHrt4fBgFMaVtislzlPmP/VlTiQRVPqCoVUXTpxoa0h8ko6guaeAm7gIdVxzCKEs2lf6yW+9xMt/CWuDDQxYMMaV9rIEWE= Received: from DB6PR0601CA0033.eurprd06.prod.outlook.com (2603:10a6:4:17::19) by PA4PR08MB6208.eurprd08.prod.outlook.com (2603:10a6:102:e5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.32; Tue, 25 Apr 2023 16:04:33 +0000 Received: from DBAEUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::83) by DB6PR0601CA0033.outlook.office365.com (2603:10a6:4:17::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34 via Frontend Transport; Tue, 25 Apr 2023 16:04:33 +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 Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT052.mail.protection.outlook.com (100.127.142.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.20 via Frontend Transport; Tue, 25 Apr 2023 16:04:33 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 25 Apr 2023 16:04:32 +0000 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.23 via Frontend Transport; Tue, 25 Apr 2023 16:04:31 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [RFC PATCH v1 02/30] ArmPkg: Add helper function to detect RME Date: Tue, 25 Apr 2023 17:04:00 +0100 Message-ID: <20230425160428.27980-3-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230425160428.27980-1-sami.mujawar@arm.com> References: <20230425160428.27980-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT052:EE_|PA4PR08MB6208:EE_|AM7EUR03FT058:EE_|GV2PR08MB10384:EE_ X-MS-Office365-Filtering-Correlation-Id: f2d7ddd5-5f8b-4b0e-b04b-08db45a70f95 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: JWRfR/WrWmdNhpop52W9EmrYByRMgErp89tsNGzxDRX+Mmz/MFBr4gDBqAc1ho8/TAaG6i0oag29OlSsKUSNfLHEC4aJngYR7xlQunN7fA2KZC87nJ8liLqahTnWJ6b5n/NIKzJvKBkx43a9fgjedB/3qV+WKu+58lBJBNl8INkQ9Bh6frY63FX5+4t5pLL4ku/nQyqIkdfRSQE2g5eZaZMSpFRK3jatW1DZ7qG4R2d2eJq5jJM0spcV9tD/1R3XSHSPti1AXhcRtoXKfscSzujUcDGaPGYPVSIVR8lxUFFkyOdKMN4f94iV//CUYl4n5a/HGusr9kJ4OdsJI24KlIqfYFbMhRiMogI1qVxARHS2AlwcvzdZ7T/NcZFZ8ttOERzLnTNCDOrPORypnnWr2YzykPMtMx9XInshQ9dW1l8TPwJnnsDXylO42G4RJz1HbOXtUjX33TWMZ6FtYikYXv7Lj0Cq+BerXTlPkUx+iQnmKd2AyOcM6z6xS7mfp73BdSGZRkPyRAvbNKGlINDKoCvJxbZTwhA5+MRHGFjW4gU6lGU8imqHDQ93xzAfY8tPxNcnHKg8c84w02gt/cupGAW7ygxnShOhy/dRah6PzbMxQNvKu/PC7rZPvdkcib4Z6w3d2BlUtjO7LQzozJAN78Sf6KjRvSPI5/nm7UPrFxcu+5jfSIfnsagzbZOcJIbCC3dAx40RmevLVLE/riHl7enJSft7QC0FQuvYEgwB3wk= 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:(13230028)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199021)(36840700001)(46966006)(2906002)(70206006)(70586007)(6916009)(4326008)(316002)(44832011)(5660300002)(8936002)(8676002)(41300700001)(82310400005)(36756003)(86362001)(40480700001)(356005)(186003)(26005)(1076003)(81166007)(19627235002)(478600001)(36860700001)(6666004)(7696005)(34070700002)(83380400001)(2616005)(47076005)(336012)(426003)(54906003)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6208 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 121cd97a-787e-4735-4877-08db45a6c28b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1m/scB6F8AXy+qbzM0lCHDpdW8sVgbg7w5SdZ2zJWsjoAjX8qaSMA6rkKZjjBoFGkThpTgvX1LVYYoUdzVqSWu9I2Qi2RRC3OEaZ05o2LCXcQ0mwIzv8X3HG2mAbSDW7rpO60qO9qnQPA0qZdDazVS8MTBqWhJn40flvSoIR6WO48exZJj/kuce89lHywieXPNgz5M+0ybd8TLADyrPFhjaYRZV44KdnQ49prBHfUUxg6MIihCMa3Saw7CjieJMnZE8MqE4BCq3StZNSiW4C94iKRIploLilup1rGMDDuG3oOVmJiAim8jSyttzTP354q90wBN9CAVqhlGUrE2CtbYyF+eNb0+Y/1Rz4Kwtj3LjxSDxC39Y/m4vECA0zOkDUdoXAiDbLjjJKi+tVXzNyreC9Q2hUJcXrLDXLsdYeGoa3FJY2BkStP+clWQQ6QKr9wJtKZBzRdh06IBtGM04xWmeyJXakisrbOzvv7YPgjS+izjiCXlfC9kz8MfdyaEPuq9NNUDwRuNzFxDvrrmttu1UQdolR9YcZp0fNAwgPtehIao8ePcH9d4cP0g7z9ueHEXHX2HCS5/x6JpCn/wgLaz7cqbbUrhQ/bpoWqLGX8Hc2ljFh51IC7kszOg2rj3BQVznSm2Mi1gqeIkw4DgcJnoD2rDqDZl70jluw6ydROv8bABbadmr36nSK1pluv9l9BbMr5yZ1xoWf136Muxr91DSvV313FAHFWXvXd4h9E44= 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:(13230028)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(36756003)(8676002)(8936002)(54906003)(19627235002)(40460700003)(34070700002)(478600001)(70586007)(6916009)(4326008)(70206006)(40480700001)(81166007)(44832011)(316002)(41300700001)(82740400003)(2906002)(5660300002)(2616005)(86362001)(36860700001)(186003)(336012)(426003)(26005)(1076003)(7696005)(6666004)(83380400001)(47076005)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 16:06:42.5755 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2d7ddd5-5f8b-4b0e-b04b-08db45a70f95 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: AM7EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB10384 Content-Type: text/plain Add helper function to check if the Realm Management Extension (RME) is implemented by the hardware. Signed-off-by: Sami Mujawar --- ArmPkg/Include/Chipset/AArch64.h | 3 ++- ArmPkg/Include/Library/ArmLib.h | 15 ++++++++++++++- ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h index bfd2859f51310993a42057a4c68604d492d8d7a8..47ef4d85656f1da32e3b924b18cf21ee83be8206 100644 --- a/ArmPkg/Include/Chipset/AArch64.h +++ b/ArmPkg/Include/Chipset/AArch64.h @@ -1,7 +1,7 @@ /** @file Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2011 - 2023, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -27,6 +27,7 @@ // ID_AA64PFR0 - AArch64 Processor Feature Register 0 definitions #define AARCH64_PFR0_FP (0xF << 16) #define AARCH64_PFR0_GIC (0xF << 24) +#define AARCH64_PFR0_RME (0xFULL << 52) // SCR - Secure Configuration Register definitions #define SCR_NS (1 << 0) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index fb1ae57b35221b2e96bc6c671398c526a6813fa7..27a6070feaa68ad03f256bcd7c2be751fdaea6b0 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -1,7 +1,7 @@ /** @file Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.
+ Copyright (c) 2011 - 2023, Arm Limited. All rights reserved.
Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -783,6 +783,19 @@ ArmHasSecurityExtensions ( VOID ); +#else + +/** Checks if RME is implemented. + + @retval TRUE RME is implemented. + @retval FALSE RME is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasRme ( + VOID + ); + #endif // MDE_CPU_ARM #endif // ARM_LIB_H_ diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c index 7ab28e3e05fe77333b8f315f3754164c4cd30a39..0f36b090effeb9f3eec21177105704a001102fc6 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -1,7 +1,7 @@ /** @file Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ Portions copyright (c) 2011 - 2023, Arm Limited. All rights reserved.
Copyright (c) 2021, NUVIA Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -104,3 +104,17 @@ ArmHasCcidx ( Mmfr2 = ArmReadIdAA64Mmfr2 (); return (((Mmfr2 >> 20) & 0xF) == 1) ? TRUE : FALSE; } + +/** Checks if RME is implemented. + + @retval TRUE RME is implemented. + @retval FALSE RME is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasRme ( + VOID + ) +{ + return ((ArmReadIdAA64Pfr0 () & AARCH64_PFR0_RME) != 0); +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'