From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.47]) by mx.groups.io with SMTP id smtpd.web10.12797.1684400998959097100 for ; Thu, 18 May 2023 02:09:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=xQsZ+1oq; spf=pass (domain: arm.com, ip: 40.107.6.47, 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=ms8rYsbdoin2HCDXX0IUw4Xcq0Y6cxNR85E7Lq/0f5I=; b=xQsZ+1oq1NAJB2RzDPizSrxonMI7tsgyrWm7xpv5uCdvA1ayIyl2h2tMGzL+ic1Ppi6x1kYiNl97gwImoFruAHEzNRN5wI4viBs5JU+MHU6Mn7otrwJ+Enl+V2SjRLGOGAAt82XgnY/dOpKm8zas469ZYz7sHrV80BFJImy8eKg= Received: from DUZPR01CA0103.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::15) by DU2PR08MB10232.eurprd08.prod.outlook.com (2603:10a6:10:49b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Thu, 18 May 2023 09:09:55 +0000 Received: from DBAEUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:4bb:cafe::51) by DUZPR01CA0103.outlook.office365.com (2603:10a6:10:4bb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Thu, 18 May 2023 09:09:55 +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.6411.19 via Frontend Transport; Thu, 18 May 2023 09:09:55 +0000 Received: ("Tessian outbound e13c2446394c:v136"); Thu, 18 May 2023 09:09:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9f4360e4f4eab0c3 X-CR-MTA-TID: 64aa7808 Received: from af8be12ef294.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AB63DFF8-D297-46EA-97B6-EA12E62E2F5E.1; Thu, 18 May 2023 09:09:44 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id af8be12ef294.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 18 May 2023 09:09:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5ia5+ulThGLCCbjaqoyjEgnyiXOLg63M6ZIq/7N0SwXUBaVISoti3rBqTpzBIFYbscmJ8UBZiJjXBf/qFP30Me4F/l3mVHCFJzS9RpbvamUNW8+WS9jbQsj6rjTUtDEs+2Dm9RxLU2zRWWRzAYhft/o1Trpn16Ttz9+jl4KBg5Z5fv18ON7BgyY0ZplrElqcVlHEkHorC/pnXMcvxU6ke/DOC9MLV12208l0kc/4cKLArjLEPgvQ9NaQDFOTmYTC51VrYFKu4a1kAQX74OExaFOJ8J1rUxIkgmuAitCzDwVrkiTnYtzQModk1SNgOlpGetVSs+jYGCcJ7KhvDfa7w== 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=ms8rYsbdoin2HCDXX0IUw4Xcq0Y6cxNR85E7Lq/0f5I=; b=Oh0DpC9RbW6cpk0xDe5lI4JJRUhppHQpostfFhJSgIvaOEI1BRSK8nLb+rkaBopRBdsnD/B+f8VkdDAvh85zZ+I6CZMP4Vpf/tzmqpQRCgwy43XLZD/KpnBWdhP9CM+jgxKiThLUKAkapxhS9AbMcMmkTfsoAyLAc6aLCj6YYmZ7KdWTmvGQ4JKDx9QOiUacQqdItwuI8/B55HAs0mKY22NWOPlclLu4DszuqzdnpFSZjcA6U0EeSPU0DXc5bc2vSbkFzhIg9Awu/WgWym21ynrehpuwOajnpjc9TER/f61dUAXsXuniyyQXDHWB7ayWvaiYZqKI8Nt+N12lq8lw0w== 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=ms8rYsbdoin2HCDXX0IUw4Xcq0Y6cxNR85E7Lq/0f5I=; b=xQsZ+1oq1NAJB2RzDPizSrxonMI7tsgyrWm7xpv5uCdvA1ayIyl2h2tMGzL+ic1Ppi6x1kYiNl97gwImoFruAHEzNRN5wI4viBs5JU+MHU6Mn7otrwJ+Enl+V2SjRLGOGAAt82XgnY/dOpKm8zas469ZYz7sHrV80BFJImy8eKg= Received: from DB7PR05CA0057.eurprd05.prod.outlook.com (2603:10a6:10:2e::34) by DB5PR08MB10254.eurprd08.prod.outlook.com (2603:10a6:10:488::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.34; Thu, 18 May 2023 09:09:41 +0000 Received: from DBAEUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2e:cafe::bd) by DB7PR05CA0057.outlook.office365.com (2603:10a6:10:2e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Thu, 18 May 2023 09:09:41 +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 DBAEUR03FT018.mail.protection.outlook.com (100.127.142.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.18 via Frontend Transport; Thu, 18 May 2023 09:09:41 +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; Thu, 18 May 2023 09:09:38 +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; Thu, 18 May 2023 09:09:38 +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; Thu, 18 May 2023 09:09:37 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [PATCH v1 4/6] ArmVirtPkg: Dispatch variable service if variable emulation is enabled Date: Thu, 18 May 2023 10:09:33 +0100 Message-ID: <20230518090935.10984-5-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230518090935.10984-1-sami.mujawar@arm.com> References: <20230518090935.10984-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT018:EE_|DB5PR08MB10254:EE_|DBAEUR03FT062:EE_|DU2PR08MB10232:EE_ X-MS-Office365-Filtering-Correlation-Id: 0190a589-543d-470a-6fbe-08db577fa5b6 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: PibCjzNfvfKScJE9eMUnH5umh/IAuKBM/ThIu6GdxBmPbx/7GIq8su/qWOldMfJBfNcTKi8Zxkx4IHoDD6qshNQ+l70rL/7F/2Ap9w5bYVBNKyp8rwTCXuy1CIOcRsOdcHtqRpysny6k/CFeQew8QhhH/4ip6mvRH/0D4T/7Uic5IJ8YjDt1yQQxMwMeccMyn+Yts9QozlfOyhXgltXwNazftuXHBpD5TsCacZ7VyJ0scGh5R4ZN60+PsbEVtnvG7YEPkvy02qoKiTV9mNwrWvjFFb+o8a5NCZKMFyztJdsBP8MmnypbnnQ+JsVztdj5pDIklR2WjUeixmyGIZ4Y9Q5eRIitRwDhMl0ARBB+wVRK2/I3SxBl14CbjqRo76NtgpYupzxP3sDARQNFAuZBydPjvn3QOP+jn7+0bb7nQPyVl0F1o+HgbdOv7/XxtI5lnwKO0s7T0SM3Vjyxc4xCxtKXf4LZpepAhLXR8igLXY+S97rKTfeXyhskiUuhhEEL8YFUjhjxd3AHkLnY97Lht5UWMsSbZEHiZfvUXFpio3qN3z9uasfOCAupik0hgUP17i8DnpiUlf0JsxaxvgM2kN+uYzWrCNtRlxbFRLcoao8CWxn/F9OChEhyVQTZDVWF6rqzgiEmmWZ8ENTWdG15P4Y2rUlSlX/ehYej32K9LLwxHihy+PaK/K18s5BnQ70mGWQ2dvcTfiFHmRv1SPxpac7x4bobRcITp6kwB/hVAB2hN2c+oE2nuIHB6rMpMqT1 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)(376002)(346002)(39860400002)(396003)(136003)(451199021)(36840700001)(46966006)(4326008)(6916009)(70586007)(40480700001)(26005)(6666004)(1076003)(44832011)(54906003)(316002)(70206006)(478600001)(7696005)(5660300002)(41300700001)(86362001)(82310400005)(336012)(36860700001)(2906002)(8936002)(8676002)(47076005)(2616005)(83380400001)(356005)(36756003)(81166007)(426003)(82740400003)(186003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10254 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a7b57b29-704b-4024-f03c-08db577f9d33 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vh0VTAYx792kzPxY6uKGEftbjV2G3D5EUOObElqcnZzsUgwwZuTyXjr7PW8yV2SWChVK1CAT7fnmBEmtGNzXIVZeeZXNVmfSVd+S/XRKTyt35STUfg0RrvnNZ7MPRoKQY7L/0fGgzQmtGvFqa+td21nHz0BCUYvrYUzbkcbNNH9fU+KtsCNYNAtHediQFIOz3/ZBTbqUe6SND53rGCqDCTuULSROejePkCEF+KlN1Fo3FbEUA9Q/y/Vn7JQaXJaZ2xy18btlDsNn7oLufpmBJxrdAZ3gV6kMVExjLZdFjPd4hOMXjTVDK5U/JmPjJsJITURfimvusYvNIPsLDx1sKwQDRVCIzsX6k/ZhVMhWCfFCUVmlk9oXNAWywbUurMgJb3+yRNE1lbzgy3gvjHSR9rlajGdsSYe21p9dzFHVLcK74y5KzW1Ez7lR7pFQD6SamWwwC3wINaG3Gid/+b7VXemTYMLBTyEhEmB1sdwot+hyZ98/Gv8cXtXapcj97lIZdA/OVUo2go2tvvzJ0PRvAVos4O58UzzgjbAvrP0t5uKqqQ1sVx/Qlbn8SxvpElcf8xkR7B/84JIrUci+ZCiJkFNC0otucNWXB4wQJiuEqhrWY6LYVAe3rBl+GyFauuLaaef9P7VsbA03l8hAFuFNM4qLRPr1MKWdkcOZvQ5R4SfH2S8Z0nOovkRVnAN4EA7gOMU8ByG7Nd6ym3qaHTPXIhEj6wsfTWybshy3kW+14hPJuac1E5e+mFBk+KL2oNEn 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)(39860400002)(396003)(136003)(376002)(346002)(451199021)(40470700004)(36840700001)(46966006)(36756003)(6916009)(70206006)(4326008)(478600001)(70586007)(316002)(54906003)(7696005)(336012)(6666004)(40480700001)(82310400005)(44832011)(8936002)(8676002)(5660300002)(2906002)(81166007)(82740400003)(41300700001)(186003)(26005)(426003)(36860700001)(2616005)(47076005)(83380400001)(1076003)(86362001)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 09:09:55.4467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0190a589-543d-470a-6fbe-08db577fa5b6 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: DU2PR08MB10232 Content-Type: text/plain The VariableRuntimeDxe links with NvVarStoreFormattedLib which is required to establish the dependency on OvmfPkg\VirtNorFlashDxe. The VirtNorFlashDxe installs the gEdkiiNvVarStoreFormattedGuid to indicate it has finished initialising the flash variable storage and that the variable service can be dispatched. However, the kvmtool guest firmware dynamically detects if CFI flash is absent and sets PcdEmuVariableNvModeEnable to TRUE indicating emulated runtime variable must be used. Therefore, in this scenario install the gEdkiiNvVarStoreFormattedGuid so that the variable service can be dispatched. Also link the NorFlashKvmtoolLib as a NULL library so that it can discover if the CFI flash is absent and setup the PCD PcdEmuVariableNvModeEnable. This is required in case the NorFlashDxe is not yet dispatched. Signed-off-by: Sami Mujawar --- ArmVirtPkg/ArmVirtKvmTool.dsc | 5 ++++- ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c | 13 ++++++++++++- ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf | 4 +++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index 25920ab4ae3cce20fdbe8e9ff7e25b8696d2c851..4541d03d23e0d98915b3d3ada688c48d979b75d2 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -311,7 +311,10 @@ [Components.common] # # Platform Driver # - ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf + ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf { + + NULL|ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf + } OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf diff --git a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c index 3f5027fac4d65c4ae3f370c5349c6f410aae5b43..bf6fc1f1f070f32e3ce351f57da955c5cc849409 100644 --- a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c +++ b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c @@ -4,7 +4,7 @@ - It decides if the firmware should expose ACPI or Device Tree-based hardware description to the operating system. - Copyright (c) 2018 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2018 - 2023, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -75,6 +75,17 @@ KvmtoolPlatformDxeEntryPoint ( { EFI_STATUS Status; + if (PcdGetBool (PcdEmuVariableNvModeEnable)) { + // The driver implementing the variable service can now be dispatched. + Status = gBS->InstallProtocolInterface ( + &gImageHandle, + &gEdkiiNvVarStoreFormattedGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + ASSERT_EFI_ERROR (Status); + } + Status = PlatformHasAcpiDt (ImageHandle); ASSERT_EFI_ERROR (Status); diff --git a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf index c5bf798c3b2b7bf1f77e0c5ada9000f536123d6a..b0583d52058805aaeece31d7e3776ac498f101ad 100644 --- a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf +++ b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf @@ -3,7 +3,7 @@ # - It decides if the firmware should expose ACPI or Device Tree-based # hardware description to the operating system. # -# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved. +# Copyright (c) 2018 - 2023, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -33,10 +33,12 @@ [LibraryClasses] UefiDriverEntryPoint [Guids] + gEdkiiNvVarStoreFormattedGuid ## SOMETIMES_PRODUCES ## PROTOCOL gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL [Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi [Depex] -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'