From nobody Sun Feb 8 18:11:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65853+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 web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 160167326974254.503554237095955; Fri, 2 Oct 2020 14:14:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bCEaYY1788612xOxMUXs8GSr; Fri, 02 Oct 2020 14:14:27 -0700 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.80]) by mx.groups.io with SMTP id smtpd.web12.5577.1601673266627963602 for ; Fri, 02 Oct 2020 14:14:27 -0700 X-Received: from DB6P193CA0001.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::11) by DB8PR08MB3931.eurprd08.prod.outlook.com (2603:10a6:10:ab::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32; Fri, 2 Oct 2020 21:14:23 +0000 X-Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::f2) by DB6P193CA0001.outlook.office365.com (2603:10a6:6:29::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65853+1787277+3901457@groups.io; helo=web01.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; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:23 +0000 X-Received: ("Tessian outbound 34b830c8a0ef:v64"); Fri, 02 Oct 2020 21:14:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7223e876afb7ab6b X-CR-MTA-TID: 64aa7808 X-Received: from 6f80e1e24439.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A3CF31A0-7F28-4031-B56D-E2F57E023ED3.1; Fri, 02 Oct 2020 21:14:18 +0000 X-Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6f80e1e24439.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 02 Oct 2020 21:14:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVccU4nFmJromY4vb8qjEszCFswgBsqO8n9ECQE+U9bbCewgQYp1LLZIewsREIhncXqSY7jE/2jvH9P7Xk/POpRB5nklrQqY5x5aZzstXfM+da8TYQ3Mw4JZzKOPum5LQ8U0XvCa+202QKG+8CmdHHP55GCgqQvuAhyUyufQ7l1GCRN95CafyROSoraq9XNUJOuBuI1LTiQTJnqk1tdkuTrCPWj3nBYEwjZE3Q3+mwmcUnGaLdd2yzsmc+DiW/iybY7Q0MarnCEMlnwV7Dl/KIGyMDz2J0AO6GILpcYDUkSQ6eS1cTPoA9g2DZz7SexGuXWGS5zj93omuRZdWq62AA== 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-SenderADCheck; bh=10PnDy+pFiQWbub5SuJ17M8AOU7lYBs1dAoH5UIkr3o=; b=SW5sl29s86h49j41TltlrTbg7xCub2BF6bucUjfQ35I3TkpwM43Pt6RQn6ZVYSqGPRfNUrH/JphDeTYRapUKAYCy+/eWL50KJ20EbuzGCn0Hgcwlzd62hkkiJarJo7QLjaEc3I5H6NELjbXjg5xpZGvV9h4WeKvb5z4ERZHtiFtD0z/cYcZt7c8W1w7KlYfkrMwz1fRiLv0gt8x20Pwbe1dyfj1fBvveS2dCl+Gg71k+7qy7AzdlyTKQCBdvnLgV2po3415wj0aVaudWTJWpjTb7LEhYYHKE/m67A7HIiDs7+dPIBImHp/EGYVlPsAOpkcmR6dgYHuO6eSrxZOZNYw== 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 AM6P194CA0057.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::34) by AM6PR08MB4421.eurprd08.prod.outlook.com (2603:10a6:20b:71::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.36; Fri, 2 Oct 2020 21:14:16 +0000 X-Received: from AM5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::38) by AM6P194CA0057.outlook.office365.com (2603:10a6:209:84::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; 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; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT037.mail.protection.outlook.com (10.152.17.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:16 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2044.4; Fri, 2 Oct 2020 21:14:15 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Fri, 2 Oct 2020 21:14:14 +0000 X-Received: from E107187.Arm.com (10.57.53.44) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Fri, 2 Oct 2020 21:14:13 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , Subject: [edk2-devel] [PATCH v5 04/15] ArmVirtPkg: Add kvmtool platform driver Date: Fri, 2 Oct 2020 22:13:58 +0100 Message-ID: <20201002211409.43888-5-sami.mujawar@arm.com> In-Reply-To: <20201002211409.43888-1-sami.mujawar@arm.com> References: <20201002211409.43888-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5a092741-306b-41b5-4061-08d867182308 X-MS-TrafficTypeDiagnostic: AM6PR08MB4421:|DB8PR08MB3931: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: U+sGdW5SBwhwq3z8VyBi8xjsshuJGAG/gkAcYVGknOF35NNaCD91yqHwfF+kvR89MjpjX0RAmtn9mysKeV3eeP/SrG4kA7LDmunwOFvHQW+mP+uNjA9BtiBCHuTu1J2GYpmp54Rpqpd8/zT8yswtyFQIC2p+pOoQ1KZ3kwyRqI6gqE0fKkSBSJi7ewR2exzbUziaqNvOO/iYbq2qHywHZX9VjCoD8YxAG6TY//LRm64eWi+2lnhBa+nvaOX5dccs+29ENMFvWwF6eWhCAABXea5iLBC/aCir4qVPJQHJV+U8xKJpZD2gzYZSM1qL304sQuSUBxNQDY9WY14e+g2+mNBLha2vIJFEa5Gv2Wp7RvOH77iqdctVKCFkLaJEKsd/1JcPO3jyYd7nBg5vhWyu+2bwj5FaehscBgbh3dkFvSCV+9FV56UNWYb0dyOREQ3KnLep556qTZrUKfxtNC4aC0Ykamm6g0/t89Nc42tdsvI= 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:(4636009)(396003)(376002)(136003)(346002)(39860400002)(46966005)(186003)(1076003)(6916009)(2906002)(82740400003)(86362001)(966005)(316002)(36756003)(426003)(2616005)(478600001)(54906003)(44832011)(6666004)(336012)(356005)(81166007)(82310400003)(47076004)(83080400001)(70206006)(83380400001)(7696005)(8676002)(8936002)(26005)(4326008)(70586007)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4421 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 130c1c55-367a-439c-63a1-08d867181ea6 X-Microsoft-Antispam-Message-Info: ceFnBFjySMf/Ir0gxvfqpZ9cJvSMhBjIJL/OFqvvox9V9a1UpAC8CN43wCHlRoQKBVHgH0NMP06kuLFeImwNXAgmRCmD/U1oa9nxANGfZIX3wS2dUW8+vEARBR0uZBPsFiiOEElwDXjY7d1wcHusMtE7sWisJ+rvTVaRVEKvKVPPfN4Tvv4YonyTo2IYGE3dXEDATqvlnBPEsxGh4BDyj0HCs4ja++RXM+CkM3InXBX8qn+EiPx2VwCe8W+/dxwXY3NqQ7X0HSzbjPvYMbP7kTYs2Iw6+17YWjWs08A0iA3R8TWUnmMQO4LKY4Xk70qdj+CewW0FEwtJVKhARnYZBm63cBCh7Z+5Kg7++wX5T6PlMtmyElQbClI44Bv7Rnf4byYTjNJr8d1hDE6ZqfpD9ubP9nGthkCTiKgBZhvhVWXZupX1n7gViuDyyK64cOSV8ExAIgL4jjSSrJIahzfTKd862xohh5Xf0vFa6k02DwQ= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2020 21:14:23.7474 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a092741-306b-41b5-4061-08d867182308 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: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB3931 Precedence: Bulk List-Unsubscribe: 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: stjNE2HnjOoOZeU4gJ3XmTqqx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601673267; bh=Zuprr9krRMu30M+X8MAEVF/LtTel3LAvGfwEEM009zs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vphnhoN/GB7kgrwc0fIYZaZXpoDFwo/4sb8Yn7/YLK/gl5pdiRM3doOvBMx1vd54hhf Sm6hMWc+ZA1Lo8KXIBTm4mTNKXd0XAW9riE4URufchhisPzkcaDeWs501Fyo66pEVq7bS yur1an7fjR8iLpNf24QubF0ZCqfyQsLo7k8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Kvmtool is a virtual machine manager that enables hosting KVM guests. It essentially provides a virtual hardware platform for guest operating systems. Kvmtool hands of a device tree containing the current hardware configuration to the firmware. A standards-based operating system would use ACPI to consume the platform hardware information, while some operating systems may prefer to use Device Tree. The KvmtoolPlatformDxe performs the platform actions like determining if the firmware should expose ACPI or the Device Tree based hardware description to the operating system. Signed-off-by: Sami Mujawar Acked-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- Notes: v5: - Fixed minor ECC reported issues in file header. [Sami] Ref: https://edk2.groups.io/g/devel/message/62159 =20 v4: - Cleaned up include file and LibraryClasses list. [Sami] - Missing MemoryAllocationLib here - either add it [Ard] here, or remove it from LibraryClasses. Ref: https://edk2.groups.io/g/devel/message/61714 =20 v3: - Don't use CpuDeadLoop()s in your drivers. [Ard] - Returned error code instead of dead loop. [Sami] - Installing a protocol on an image handle should not [Ard] ever fail. So just use ASSERT_EFI_ERROR(). - Added assert and returned status code. [Sami] Ref: https://edk2.groups.io/g/devel/topic/74200911#59650 =20 v2: - Updated according to review comments. [Sami] =20 v1: - Add kvmtool platform driver to support loading platform [Sami] specific information. - Keep code to initialise the variable storage PCDs in the [Laszlo] platform-specific FVB driver. - Document code derived from [Laszlo] "ArmVirtPkg/PlatformHasAcpiDtDxe" Ref: https://edk2.groups.io/g/devel/topic/30915278#30757 ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c | 82 ++++++++++++++++= ++++ ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf | 43 ++++++++++ 2 files changed, 125 insertions(+) diff --git a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c b/ArmVirtPk= g/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c new file mode 100644 index 0000000000000000000000000000000000000000..a42b64d1061dcdf8163775f66b6= d2f550e481315 --- /dev/null +++ b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c @@ -0,0 +1,82 @@ +/** @file + + The KvmtoolPlatformDxe performs the platform specific initialization lik= e: + - 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. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +/** Decide if the firmware should expose ACPI tables or Device Tree and + install the appropriate protocol interface. + + Note: This function is derived from "ArmVirtPkg/PlatformHasAcpiDtDxe", + by dropping the word size check, and the fw_cfg check. + + @param [in] ImageHandle Handle for this image. + + @retval EFI_SUCCESS Success. + @retval EFI_OUT_OF_RESOURCES There was not enough memory to install t= he + protocols. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +STATIC +EFI_STATUS +PlatformHasAcpiDt ( + IN EFI_HANDLE ImageHandle + ) +{ + if (!PcdGetBool (PcdForceNoAcpi)) { + // Expose ACPI tables + return gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiPlatformHasAcpiGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + } + + // Expose the Device Tree. + return gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiPlatformHasDeviceTreeGuid, + EFI_NATIVE_INTERFACE, + NULL + ); +} + +/** Entry point for Kvmtool Platform Dxe + + @param [in] ImageHandle Handle for this image. + @param [in] SystemTable Pointer to the EFI system table. + + @retval EFI_SUCCESS Success. + @retval EFI_OUT_OF_RESOURCES There was not enough memory to install t= he + protocols. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +KvmtoolPlatformDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D PlatformHasAcpiDt (ImageHandle); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf b/ArmVirt= Pkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf new file mode 100644 index 0000000000000000000000000000000000000000..1cf25780f8300edab607d0c1dfb= f7255404226df --- /dev/null +++ b/ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf @@ -0,0 +1,43 @@ +## @file +# The KvmtoolPlatformDxe performs the platform specific initialization li= ke: +# - 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. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D KvmtoolPlatformDxe + FILE_GUID =3D 7479CCCD-D721-442A-8C73-A72DBB886669 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D KvmtoolPlatformDxeEntryPoint + +[Sources] + KvmtoolPlatformDxe.c + +[Packages] + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL + gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL + +[Pcd] + gArmVirtTokenSpaceGuid.PcdForceNoAcpi + +[Depex] + TRUE --=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 (#65853): https://edk2.groups.io/g/devel/message/65853 Mute This Topic: https://groups.io/mt/77270939/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-