From nobody Mon Sep 16 18:53:14 2024 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+105079+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 1684508174202215.12542001863346; Fri, 19 May 2023 07:56:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oDLyYY1788612xdZdeydqzxY; Fri, 19 May 2023 07:56:13 -0700 X-Received: from EUR03-DBA-obe.outbound.protection.outlook.com (EUR03-DBA-obe.outbound.protection.outlook.com [40.107.104.50]) by mx.groups.io with SMTP id smtpd.web11.28450.1684508172320645981 for ; Fri, 19 May 2023 07:56:13 -0700 X-Received: from AM3PR07CA0074.eurprd07.prod.outlook.com (2603:10a6:207:4::32) by AM8PR08MB5809.eurprd08.prod.outlook.com (2603:10a6:20b:1db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 14:56:03 +0000 X-Received: from AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:4:cafe::1d) by AM3PR07CA0074.outlook.office365.com (2603:10a6:207:4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17 via Frontend Transport; Fri, 19 May 2023 14:56:03 +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+105079+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 AM7EUR03FT040.mail.protection.outlook.com (100.127.140.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 14:56:03 +0000 X-Received: ("Tessian outbound 5154e9d36775:v136"); Fri, 19 May 2023 14:56:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 28b8d818569d64b7 X-CR-MTA-TID: 64aa7808 X-Received: from e3da2062c218.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 09D8B471-0961-4499-BCAB-51B542201FE2.1; Fri, 19 May 2023 14:55:51 +0000 X-Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e3da2062c218.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 May 2023 14:55:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JG6y50KfWQLHctMfOYh8CdF8Hw3/SV20IXDW/oakWgaONwZIaW12QDv7OA+8DcucvPd6O2rBerugWXlJjYjn7Ybulz1uL2Hmai588M/dHoDoy1rDafn6dlGYhmVJyViSQhZgdAKt0n6XJ/Qx9aT1Iz2n+Rpkm3c7CDb/PMlSB1BANy9TrHWrjJqtXaWzzdwgJswXEeYfJjDXUacmkar+l9rJCwn7xbw4KlTzd1PD/xocwUpxkqnPIqPQEr/lsToSrsmw9+WC7aI+Sy5YLVHCGRVZtskEV9rpJaSWcuoGlLqh2Dt+x/F28uDinrzYjiaxTAiQilsYKEav9UOH8yvQtA== 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=BDMDQqrsRx29zEmdgoCngWDslc5TRjg8iQmF147V3f+jbu8DpYy4GI/2do9+466+vdEff6G0cgtdS9FamnzsBvoFI2aHlSqFWjjAM4l0Jx2j+qNWr0K0KAAiDdRCugqateg/R5wPFHlr6tcAUhEOwpc0n8ChvG+fkF9w2QR4Ts9MECQHF2XvvttxL6eOHCTcGcyO28sf6FS1Bt07c3aFkiHygbDuS4kIPe9z9omaVJyu9tf2VJfnrO5lMHCGcrXCI7Wk/QGVi9dgFYAitgo4Yaa8PulweEZTH//BkCuiZbhzHpBK6b747wEDeYhjYZviKZqQozyDzsOjtGcS7iZgng== 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 AS8PR04CA0105.eurprd04.prod.outlook.com (2603:10a6:20b:31e::20) by PA4PR08MB7546.eurprd08.prod.outlook.com (2603:10a6:102:26c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Fri, 19 May 2023 14:55:48 +0000 X-Received: from AM7EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:31e:cafe::1d) by AS8PR04CA0105.outlook.office365.com (2603:10a6:20b:31e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 14:55:47 +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 AM7EUR03FT005.mail.protection.outlook.com (100.127.140.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.7 via Frontend Transport; Fri, 19 May 2023 14:55:47 +0000 X-Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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; Fri, 19 May 2023 14:55:44 +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; Fri, 19 May 2023 14:55:43 +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; Fri, 19 May 2023 14:55:43 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [edk2-devel] [PATCH v2 4/5] ArmVirtPkg: Dispatch variable service if variable emulation is enabled Date: Fri, 19 May 2023 15:55:39 +0100 Message-ID: <20230519145540.46700-5-sami.mujawar@arm.com> In-Reply-To: <20230519145540.46700-1-sami.mujawar@arm.com> References: <20230519145540.46700-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT005:EE_|PA4PR08MB7546:EE_|AM7EUR03FT040:EE_|AM8PR08MB5809:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d9b72ed-3da9-4796-05fe-08db58792a86 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: RoyCWuwWz9LQdXqo1WRwyPzlCNrZG1XzFa2oTZUah8nbjugrXOEcJlUTC+bPhWN+VgM+ePVGi7KsIZJiD9GvwijxMmBVXYxXrtZzZ9XizckAVdTIth4tThP0+OQl4YBUjtf/b0c8y4kXeZifOCy61fFMyZ9/tUPEJPS/bi4yxGNeCqtb0wwfIMX34NLn93MDyUIT9wiTlQ6lVpieKVjMxuBrWtqn+JS1g1dVIVRZqs9AjubPLWnqNaCSUBBG5mSTTbZ6AgmlGJyhBB7FO6vnTTEUnL9XZHAyJ3yOMubPsa2nt3FpGIDIwnUilE9IH4TTe0DYaoJiFYYk87ua4ySUvfZewUyqetB7d1vd2SCDOuQVqSa6Bm8OiKj6EgK3pBIW53BjIJdwPteuRkQr0qGqW0af76jSllnVAZNDRYbkOxWw2CFeVaGapmoJb6BxqJIt4VyfPckoamOyDbHzsPn5nVdhGCTun+WK1O9C+nAYvtsAaDlw1uDMpGoJiChUW0lfu6IhEvjmyIlVfceQU/v/Us7FoU15VIPGui1OjyW/D9Kz96kLWIgstf29qR8nbqUNvd9SxrBiMM3I44wH972aksGqy9gGZxjmLxxMyPDm+3DGRGii7kDP7Qgl8dzDtoADV6Rt/JuIDpyufW4ivfklYfu0iQevBEHVejzLprkYnYm7+ZbSWL8rHpi25KfO7W063bXbxB9Y5IAZqMxo/hat6NVjAfnBYLlF7LSzO+iFum1i2UCpyc5HSkv74u9hiZTzx+VbhtKW29DhubdTTsGuoQ== 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)(39860400002)(376002)(396003)(136003)(346002)(451199021)(36840700001)(40470700004)(46966006)(86362001)(36860700001)(7696005)(83380400001)(82740400003)(81166007)(82310400005)(41300700001)(356005)(40480700001)(6916009)(5660300002)(36756003)(40460700003)(316002)(70586007)(70206006)(8676002)(2906002)(4326008)(336012)(47076005)(426003)(186003)(44832011)(1076003)(26005)(8936002)(2616005)(478600001)(6666004)(54906003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7546 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c353e7b5-4ad5-4981-392e-08db58792179 X-Microsoft-Antispam-Message-Info: 5TWvfKNmmt4gTzyxlVdFfjxJeXVCPNwmF+juRm7GhaFwJ6eBQwROeRr6h+3424aGB/mGHPLJPvBFRTU0FUQ5KZLwkbhjuUHV7AIU73GKEHAUR3c+lOtTKk1TcWJwL1uyoRiGZUaDan/DIVl6hj7x64rG4G9e0qdli4pjuuQ2sWYXHty6XJDTtMvVTU/duhnr+Pw3pjQvrbZDaXTKT2cZdrnD3ezZyNz8DDb4Q+m4iorQcQaJxZ6eBao6C2KgH93tboSO3dcojU8dXZf3t0fbzydK8L2TYmnXc9lpgEp1TFLRh9VTlQyxyVyWhibH/B7+wSAkyGGWUtvxqGi2YoCaUfUajA95sVaRAkQVPUYiyvqFt7duYE8OSdKBLXPwbVDuYhYE1vWmUzZCijOUhyx4B4zPawrq2ACgGiRPcqOR0GaTi0b/hFNKySUdiOxqKLZAOklUqnls8dmDwrSknRAELGMmHgjCxbDLnSXpJsZJx5vwqzMiE6s6HosexqS35olkWEPGU3KDQ1LfNJuX2m3XiH7hIcZa8RRno7qMgjzkf5UKk4JIE4zDoQgGXAQ3FcmVBKQzTYtCr7m4w0wQt0MC4ZnufhsYoSu7VgiSRFYMJ7qbA90Ba8XNP459L0MQ1kZUFykejlgjmj363kYFfaPMmU1FUt2cSPyxgP/4XHMBSp67MQ5RwENJ9/5dYy6bwfHAWjI4tFD/inuq39mfD9B9QAPfb6sDRA/LRsxcmMA+b36TVW7sMMWpHpT9tkVUoyHh X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 14:56:03.0145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d9b72ed-3da9-4796-05fe-08db58792a86 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: AM7EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5809 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: lLc97Ad7TuAxAz30OCYuklY9x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684508173; bh=GBNTG6/YKvOPquWh/5EQ0m9BQLcn35EGNPKNLSwqqD0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=WiQs+e+imyEqjRjlNQRv+drU6sp7MM/IRCPB2Ecyv70vEcCGi3+5GRX4XZBBjahRyKV kciDEHkObGTcXQeVK4xX4IGHNIdIMYcfiCr29YFuM+Jvk/T+NUTWbruWx/G3YDGSZ4KbI XpTuC3OyulM8Z5+qaqAAwrVok9+NKt3Y8pI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684508175754100011 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 (#105079): https://edk2.groups.io/g/devel/message/105079 Mute This Topic: https://groups.io/mt/99013774/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-