From nobody Mon Feb 9 23:18:18 2026 Delivered-To: importer@patchew.org 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+55142+1787277+3901457@groups.io; helo=web01.groups.io; 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+55142+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583134188; cv=none; d=zohomail.com; s=zohoarc; b=ddMxGtCENQC48Ei2IhnMtPaz+ikJDp0WYhcdcKuRXaxRtWrS8VtI0JQl0uvBVp8NLK5CFHkYD2Rel6zeAYYEauFPG/1ul9r9VMoy8KiQh2t7ySSPutDH1h6zAtQZOqTLriTimN6h7ku/mNo5mrihAHy+o+5ff8dvwlXRYi0dL9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583134188; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=LNTRHPE7ly3Lt1rXmHt+NryrzpHrVkADJIKvtU+TEhA=; b=M9Te7xJI0ezswHRzLRR4fEV9ekFL2TpWXsFzVAzzuDZDJA7bTYezVln1piEx43/gicdtywBc4JdpxkCt8ZYqOhTl6eQ00IhqVDbB9tS3feZTyKG2pgFqAu3Oi+ivS8Le+xP6RSik61p8QmQOcOA7DFMJc8t9tZGpp2FW3DD7/NQ= ARC-Authentication-Results: i=1; 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+55142+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583134188763232.57320966234988; Sun, 1 Mar 2020 23:29:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fmj2YY1788612xsBpyPEPmVs; Sun, 01 Mar 2020 23:29:47 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web11.11031.1583134186868986570 for ; Sun, 01 Mar 2020 23:29:47 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id v2so11048135wrp.12 for ; Sun, 01 Mar 2020 23:29:46 -0800 (PST) X-Gm-Message-State: 4Q8vSIyk9Z0lQnhL9O8uN3DHx1787277AA= X-Google-Smtp-Source: APXvYqz+qJ7SJNr/6UNGOvPdHODq6f/gZkL9jMlz/aCMxdy+s0P9d1ciGHKJwklt1bitMO2mMmcTuQ== X-Received: by 2002:adf:de0d:: with SMTP id b13mr20794268wrm.297.1583134184813; Sun, 01 Mar 2020 23:29:44 -0800 (PST) X-Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id z131sm6347153wmg.25.2020.03.01.23.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 23:29:44 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: lersek@redhat.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH 03/13] OvmfPkg: introduce QemuLoadImageLib library class Date: Mon, 2 Mar 2020 08:29:26 +0100 Message-Id: <20200302072936.29221-4-ard.biesheuvel@linaro.org> In-Reply-To: <20200302072936.29221-1-ard.biesheuvel@linaro.org> References: <20200302072936.29221-1-ard.biesheuvel@linaro.org> 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,ard.biesheuvel@linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583134187; bh=9sZ4DPcxJhrMT2KBcKCdjfBjmSjsE/EY/7uvMZTJqqA=; h=Cc:Date:From:Reply-To:Subject:To; b=vGT0FwmHB9gR8AU1PZqRvCyeC+zTkWHr04V7Cm46xhGskf4wzSZ7kMyXlekij8/a7xI 9nRfiPUf4wEw4qqF5yUSAF79cgcjAkFiBUaq2PxdXlrwu/egV4VL7+PEDKJxi9CvmJZ7P 5Y2SMbx++1aM03d2LXa36V/Nkzq1I2v9TU0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce the QemuLoadImageLib library class that we will instantiate to load the kernel image passed via the QEMU command line using the standard LoadImage boot service. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2566 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/Library/QemuLoadImageLib.h | 78 ++++++++++++++++++++ OvmfPkg/OvmfPkg.dec | 5 ++ 2 files changed, 83 insertions(+) diff --git a/OvmfPkg/Include/Library/QemuLoadImageLib.h b/OvmfPkg/Include/L= ibrary/QemuLoadImageLib.h new file mode 100644 index 000000000000..304853096593 --- /dev/null +++ b/OvmfPkg/Include/Library/QemuLoadImageLib.h @@ -0,0 +1,78 @@ +/** @file + Load a kernel image and command line passed to QEMU via + the command line + + Copyright (C) 2020, Arm, Limited. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef QEMU_LOAD_IMAGE_LIB_H__ +#define QEMU_LOAD_IMAGE_LIB_H__ + +#include +#include + +#include + +/** + Download the kernel, the initial ramdisk, and the kernel command line fr= om + QEMU's fw_cfg. The kernel will be instructed via its command line to load + the initrd from the same Simple FileSystem. + + @param[out] ImageHandle The image handle that was allocated for + loading the image + + @retval EFI_SUCCESS The image was loaded successfully. + @retval EFI_NOT_FOUND Kernel image was not found. + @retval EFI_OUT_OF_RESOURCES Memory allocation failed. + @retval EFI_PROTOCOL_ERROR Unterminated kernel command line. + + @return Error codes from any of the underlying + functions. +**/ +EFI_STATUS +EFIAPI +QemuLoadKernelImage ( + OUT EFI_HANDLE *ImageHandle + ); + +/** + Transfer control to a kernel image loaded with QemuLoadKernelImage () + + @param[in] ImageHandle Handle of image to be started. + + @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image h= andle + or the image has already been initialize= d with + StartImage + @retval EFI_SECURITY_VIOLATION The current platform policy specifies th= at the + image should not be started. + + @return Error codes returned by the started imag= e. + On success, the function doesn't return. +**/ +EFI_STATUS +EFIAPI +QemuStartKernelImage ( + IN EFI_HANDLE ImageHandle + ); + +/** + Unloads an image loaded with QemuLoadKernelImage (). + + @param ImageHandle Handle that identifies the image to be + unloaded. + + @retval EFI_SUCCESS The image has been unloaded. + @retval EFI_UNSUPPORTED The image has been started, and does not + support unload. + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. + +**/ +EFI_STATUS +EFIAPI +QemuUnloadKernelImage ( + IN EFI_HANDLE ImageHandle + ); + +#endif diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index d88778600517..26f977bad795 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -58,6 +58,11 @@ [LibraryClasses] # QemuBootOrderLib|Include/Library/QemuBootOrderLib.h =20 + ## @libraryclass Load a kernel image and command line passed to QEMU v= ia + # the command line + # + QemuLoadImageLib|Include/Library/QemuLoadImageLib.h + ## @libraryclass Serialize (and deserialize) variables # SerializeVariablesLib|Include/Library/SerializeVariablesLib.h --=20 2.17.1 -=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 (#55142): https://edk2.groups.io/g/devel/message/55142 Mute This Topic: https://groups.io/mt/71669015/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-