From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.40]) by mx.groups.io with SMTP id smtpd.web11.83470.1682438718776735899 for ; Tue, 25 Apr 2023 09:05:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=T19xS2lI; spf=pass (domain: arm.com, ip: 40.107.8.40, 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=N31DQKS46PybftiF/nXwWL3GaOdiz7EmAtFRZibjByY=; b=T19xS2lI4U078P9nls/0m2fmwXZYFW946i0jB0mEo/KPRMqXRLxj6cFDRB8er5KyxMhK7IFrz6lPbk3QHMU7yUlOGfBavl4S4EBT2jenh6uo2+4pJctqXBUZZINxuFQdSyDRPo2FIvFjbNUokUIj4C3tuIhtmF/ckVDlUUr1/ac= Received: from AS9P194CA0017.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::33) by DB9PR08MB8291.eurprd08.prod.outlook.com (2603:10a6:10:3dd::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Tue, 25 Apr 2023 16:05:08 +0000 Received: from AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46d:cafe::e1) by AS9P194CA0017.outlook.office365.com (2603:10a6:20b:46d::33) 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:05:07 +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 AM7EUR03FT023.mail.protection.outlook.com (100.127.140.73) 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:05:07 +0000 Received: ("Tessian outbound 5bb4c51d5a1f:v136"); Tue, 25 Apr 2023 16:05:07 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c97d7815684d423a X-CR-MTA-TID: 64aa7808 Received: from edeb0aa806b4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D77C649D-BDC3-4B3F-96BF-E73735CD5403.1; Tue, 25 Apr 2023 16:05:01 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id edeb0aa806b4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Apr 2023 16:05:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeY/s+1xkhmGEhgUeGCMAY5TJBOrMUmTsFmPlJRkH6X7IyNszz24S8KC5hh1eSppl8Xz03M8kyxN92xCFr7MCoTXs9hdIm5RTzVbbuFRQjB2pqxosH3NHTNiic9n/Ejf5Zzml9KmtU41baUZDQ+tLpp4sIrH4J3W7ESGfBHKyftYIEVYc7B2Rwq3IIlNBM2voO8Ch5bRcVExhH8gE6cwJSzlghfYSRj0WKrlp4kjf/N6Ll+w3Q40LFE7S1xTXm3BskpKqGyyRdvaws9QxYpcAz3tpXROX52x+7C2vBf6SLcfj8otdZ6lkcp40sWBZ4eOrjD8ZnBchhxhcooLrioSqw== 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=N31DQKS46PybftiF/nXwWL3GaOdiz7EmAtFRZibjByY=; b=e7pFkR8M54Znat4i7vS/QMH5//FsMvk52c8oMKmbSOe60eer0YH0SrVp7V44Xlh+XL+V5lbPxbbix80KZ2TJK3mkYNH2sz4elei8V4jrQJDp/psM3gB8kS7z5Cygq4GpLM/MjfT46zQcnMr8ggwp3SO6eA2/+JH7mxo+D0IKGaefpkn6EO1+5pF24Q9JBGnmRDAxfNpCLFBmDwWwi/MleVP85+uUZvJyoWcP//OKXdwJQI9SRh+vruHl3WKrQ5npfVSoLyONqqbQd2SObdkdWC+OvK1dwKpQRXEU8rT26D6rwD+UoDh1BtwfZC7SXC4KbB5VuzgTjNDCV80G9RYQiA== 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=N31DQKS46PybftiF/nXwWL3GaOdiz7EmAtFRZibjByY=; b=T19xS2lI4U078P9nls/0m2fmwXZYFW946i0jB0mEo/KPRMqXRLxj6cFDRB8er5KyxMhK7IFrz6lPbk3QHMU7yUlOGfBavl4S4EBT2jenh6uo2+4pJctqXBUZZINxuFQdSyDRPo2FIvFjbNUokUIj4C3tuIhtmF/ckVDlUUr1/ac= Received: from DU2PR04CA0249.eurprd04.prod.outlook.com (2603:10a6:10:28e::14) by GV1PR08MB8237.eurprd08.prod.outlook.com (2603:10a6:150:5d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34; Tue, 25 Apr 2023 16:04:58 +0000 Received: from DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28e:cafe::bc) by DU2PR04CA0249.outlook.office365.com (2603:10a6:10:28e::14) 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:58 +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 DBAEUR03FT055.mail.protection.outlook.com (100.127.142.171) 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:58 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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.23; Tue, 25 Apr 2023 16:04:54 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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:54 +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:53 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [RFC PATCH v1 25/30] ArmVirtPkg: Add ArmCcaDxe for early DXE phase initialisation Date: Tue, 25 Apr 2023 17:04:23 +0100 Message-ID: <20230425160428.27980-26-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: DBAEUR03FT055:EE_|GV1PR08MB8237:EE_|AM7EUR03FT023:EE_|DB9PR08MB8291:EE_ X-MS-Office365-Filtering-Correlation-Id: 0443fc22-94b3-407e-25ce-08db45a6d713 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: IWQIqYXb/GuuUL/PfGtlt3H92ELjddWBS5sWuEyzJYp1ol2rpkJWELCL33MF9fKZhpEbSFEjnzxissNeQc5t+nsmhVSYiVpxo6uyEr6K5BHVgoNu5Tltc9h1XeRfWrBG8E8aT0ifHyyEFW6FRxgukt8X+NjJCHC9LNkx6BgF+slkdOMRJIKLYYm8YZwUVgRGhT39UmEPc1Hd6tapot20KdlrFGNcs5KXcCrlanRvGxsYeRV9tk1Sn9DVrb2Wklv5bTFWx3eGm/cJ4hjQ6qfKSeS+3My2goClcjtgKPu56kFC2Et3WmtP3riRay3AivrJBeCNARJvTmICvrkt46QJwm29FeYXQFnCLogWlWVAiUR6yTnD2/MmmySsMm4OXQJz2SoPhIyJbShDRC6aBwEflK07LsmYOjmof7gVxLDPzQm01zGPFqCUTu74nZUoXTFnMV6zc2ziZ85CvSJBIr3rA7v0bHK1hx5nmXX2+J/KB/4tet6rG59OZor32pTHu1mpt6z2QL+aiE3SODgoCpljdECdb6dl5d6jX7IkJjkYVugmGiXWZ3xvhx2pwl7qJ2AjntkaFGp+7NUbHnaHQMen/d57fpWBfSRgAnIkJEjdeI/+SCkFsTfzMZjzC7iyWXe/FRGeJLuvWBcMoREKrBOg4KM2PB6FKoxjESxOXa2/jDRudxQgY+g1cnhHjSg+KuojLGOrlyiB2dCs7oKkNZ63y3Vr/PjDRktm62ca47EI7sU= 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)(346002)(136003)(376002)(396003)(39860400002)(451199021)(36840700001)(46966006)(36860700001)(336012)(426003)(47076005)(83380400001)(34070700002)(478600001)(7696005)(6666004)(2616005)(1076003)(54906003)(26005)(186003)(5660300002)(44832011)(36756003)(81166007)(356005)(70586007)(70206006)(82740400003)(4326008)(6916009)(82310400005)(41300700001)(86362001)(2906002)(8936002)(40480700001)(316002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8237 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0d6185df-b06c-4a55-89ce-08db45a6d14c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SinidEToBErE9mdn10UQ7qXHcHYzCypSdNoic/gRsO5P50YLu4fYKV2RGoWTD7Mmdzg4Oc/qhaC7WNSMzeD4zX4yWheq7f3kvHyHSdSDws74FhmeNoH/1hXq1g2RPjgiDM8mV1SnWUzQstdxchrSmL6/Ac1ea/0Du5wXGVkJJ5S5FtO3lPEldLuLTT54k36fSh7dN4TA6fcxvO5cRxRV7I7VvkZkzMy3i0njkKpTagdWQKg5UZ6I6k7SLwpTMPuwiqnSEX6uey1bz1TnAINl1Ey22gh7SKjE9auP7N4bDPUwGAQS1xiLdsrFh3R2Kr3LHRgIBuVLWm86BlyZaAhlVmIpYnwMm2hYtHG5nRQtLhegQW1cmvMhPjeSvmvdk9G8qrvy5Q9SMLKGnXIYgxvF1C2FrWUjS9Il+JYr0wUZOWOcEiuYW/SDfssKVuLtOgJkRZ72dYgP37umqJ2vQoSwdgiIr3PdhAf3Cz8NP8Nk3jOQsaisHD+sf7PNn1ekAFxmjgRFedP7FsoU985VFKUpzbLb6G+Ii0WxrDUUhm1EXx6j6WU+XkLgF6Pbxm23wzG2WwgNZ7DudluwRu0gzTbhluS6jD/6lB9EZrLz0VCROPoC7REJyP8U0Rb+CdlNI4QCXDwehJvt8lSfeRTogKZbt3+0RRhzSai+G9H6eTiQ0oN8Qc+Rwr8Ib8pc9koHs8dW556E4EbiN63VC7aeY9fRkzQLuRBWFCAuGjR+Fk2JJfA= 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)(396003)(39860400002)(376002)(136003)(346002)(451199021)(36840700001)(40470700004)(46966006)(1076003)(26005)(40480700001)(426003)(336012)(2616005)(36756003)(34070700002)(83380400001)(36860700001)(47076005)(186003)(40460700003)(82740400003)(81166007)(70206006)(86362001)(70586007)(478600001)(6916009)(8676002)(8936002)(54906003)(44832011)(5660300002)(7696005)(41300700001)(2906002)(82310400005)(4326008)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 16:05:07.7676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0443fc22-94b3-407e-25ce-08db45a6d713 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: AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8291 Content-Type: text/plain Add ArmCcaDxe for early DXE phase initialisation like setting up the monitor call conduit for Realm code The Realm code should use SMC as the conduit for monitor calls. Therefore, set the PcdMonitorConduitHvc to FALSE if the code is running in a Realm. Note: ArmCcaDxe is configured as an APRIORI DXE so that the DXE dispatcher can schedule this to be loaded at the very beginning of the Dxe phase. The DevicePathDxe.inf and Pcd.inf modules have also been included to satisfy the required dependencies. Signed-off-by: Sami Mujawar --- ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.c | 50 ++++++++++++++++++++ ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf | 39 +++++++++++++++ ArmVirtPkg/ArmVirtKvmTool.dsc | 5 +- ArmVirtPkg/ArmVirtKvmTool.fdf | 10 ++++ 4 files changed, 102 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.c b/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.c new file mode 100644 index 0000000000000000000000000000000000000000..36a74f2521d2d92d404c42e86d5d37dd31a1972d --- /dev/null +++ b/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.c @@ -0,0 +1,50 @@ +/** @file + ArmCcaDxe + + Copyright (c) 2022 - 2023, ARM Ltd. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** Entrypoint of Arm CCA Dxe. + + @param [in] ImageHandle Image handle of this driver. + @param [in] SystemTable Pointer to the EFI System Table. + + @retval RETURN_SUCCESS Success. + @retval EFI_NOT_FOUND Required HOB not found. +**/ +EFI_STATUS +EFIAPI +ArmCcaDxe ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + if (!IsRealm ()) { + // Nothing to do here, return SUCCESS. + return EFI_SUCCESS; + } + + // Setup the conduit to be used by Realm code to SMC. + Status = PcdSetBoolS (PcdMonitorConduitHvc, FALSE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "ERROR - Failed to set PcdMonitorConduitHvc\n")); + ASSERT (0); + return Status; + } + + return Status; +} diff --git a/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf b/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf new file mode 100644 index 0000000000000000000000000000000000000000..df110ae54ce54f792fe9cf9420334dd1e6a3fc2c --- /dev/null +++ b/ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf @@ -0,0 +1,39 @@ +## @file +# ArmCcaDxe +# +# Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmCcaDxe + FILE_GUID = 6E474F73-7D50-46A8-9AEB-996B71599FE9 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = ArmCcaDxe + +[Sources] + ArmCcaDxe.c + +[LibraryClasses] + ArmCcaLib + BaseLib + DebugLib + HobLib + PcdLib + UefiDriverEntryPoint + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[Pcd] + gArmTokenSpaceGuid.PcdMonitorConduitHvc + +[Depex] + TRUE diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index 9bc857ea88d00431bf4223f588f908eab7561a19..acf4ede48da2d33d50b5593a857f3815f427707c 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -404,9 +404,10 @@ [Components.common] # SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf -!if $(ARCH) == AARCH64 +[Components.AARCH64] # # ACPI Support # ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf -!endif + + ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf index 8ccbccd71e134e0ea97d49380293687aca43e8b9..68bd0e9d82dc83a337d8127a598018381888d894 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.fdf +++ b/ArmVirtPkg/ArmVirtKvmTool.fdf @@ -117,6 +117,16 @@ [FV.FvMain] READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE +!if $(ARCH) == AARCH64 + APRIORI DXE { + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf + } + + INF ArmVirtPkg/ArmCcaDxe/ArmCcaDxe.inf +!endif + INF MdeModulePkg/Core/Dxe/DxeMain.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'