From nobody Wed Jan 15 10:08:19 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105017+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 168440100074264.28668732014114; Thu, 18 May 2023 02:10:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dDERYY1788612x8kBzVBoAVA; Thu, 18 May 2023 02:10:00 -0700 X-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 X-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 X-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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105017+1787277+3901457@groups.io; helo=mail02.groups.io; 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 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 X-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 X-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 X-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 X-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 X-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 X-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 X-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 X-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 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.23 via Frontend Transport; Thu, 18 May 2023 09:09:37 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [edk2-devel] [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> 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 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-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-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 Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: b3IjPKe1uJGBbTr1MPyal6Aux1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684401000; bh=XfBYvpm05uGBCy1kaHti72RVNVbpeUnBsJrcfv7DCqQ=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=FFcg3i6kORibXxAEz5N4biDxoroYZO8v3EBfrDuQDMBUHfuvIzb45UTZKLHXppwAhYz eHIcM6R4adlMkNfKRAMIkPrdBi0shpcFx9xyW2YvHx1YzRM4FIZ4Qn2qW97sBZO3gwpF+ ivQrvMshtEEBgPF6JkMyE20Ud7HpOn3fD50= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684401002009100008 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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..4541d03d23e0d98915b3d3ada68= 8c48d979b75d2 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/ArmVirtPk= g/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c index 3f5027fac4d65c4ae3f370c5349c6f410aae5b43..bf6fc1f1f070f32e3ce351f57da= 955c5cc849409 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. =20 - Copyright (c) 2018 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2018 - 2023, Arm Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -75,6 +75,17 @@ KvmtoolPlatformDxeEntryPoint ( { EFI_STATUS Status; =20 + if (PcdGetBool (PcdEmuVariableNvModeEnable)) { + // The driver implementing the variable service can now be dispatched. + Status =3D gBS->InstallProtocolInterface ( + &gImageHandle, + &gEdkiiNvVarStoreFormattedGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + ASSERT_EFI_ERROR (Status); + } + Status =3D PlatformHasAcpiDt (ImageHandle); ASSERT_EFI_ERROR (Status); =20 diff --git a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf b/ArmVirt= Pkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf index c5bf798c3b2b7bf1f77e0c5ada9000f536123d6a..b0583d52058805aaeece31d7e37= 76ac498f101ad 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 =20 [Guids] + gEdkiiNvVarStoreFormattedGuid ## SOMETIMES_PRODUCES ## PROTOCOL gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL =20 [Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi =20 [Depex] --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105017): https://edk2.groups.io/g/devel/message/105017 Mute This Topic: https://groups.io/mt/98987540/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-