From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web09.10180.1583401174479608294 for ; Thu, 05 Mar 2020 01:39:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P9ryecz0; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583401173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nm2jfh9C3Y8GWRQWOWabh7zHtBf6C0106o59LumryYQ=; b=P9ryecz0sXiB3BJzpzkLDQ6VXF7BhdyVlIfIefQhcdRhLiLZmRMXjLnLII/pYJIg/VVPYU MWAdARhdvSC/u2AqY6MySqIc9xuY5+EBENU2GmYipsNsELwBBN4HoW8jq7zGhDdG74MHJB TzIlDO3PtjyfhO5jAi2eFYgQe1lymaY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-OaNBQApgMpOAzpdtfOFA_g-1; Thu, 05 Mar 2020 04:39:31 -0500 X-MC-Unique: OaNBQApgMpOAzpdtfOFA_g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C28F0800D50; Thu, 5 Mar 2020 09:39:30 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-216.ams2.redhat.com [10.36.117.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0050473884; Thu, 5 Mar 2020 09:39:29 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 03/14] OvmfPkg: introduce QemuLoadImageLib library class From: "Laszlo Ersek" To: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20200304095233.21046-1-ard.biesheuvel@linaro.org> <20200304095233.21046-4-ard.biesheuvel@linaro.org> <7dfb1eb8-eb54-d181-914a-912649a5aaa0@redhat.com> Message-ID: Date: Thu, 5 Mar 2020 10:39:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <7dfb1eb8-eb54-d181-914a-912649a5aaa0@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/05/20 10:37, Laszlo Ersek wrote: > On 03/04/20 10:52, Ard Biesheuvel wrote: >> 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 | 84 ++++++++++++++++++++ >> OvmfPkg/OvmfPkg.dec | 5 ++ >> 2 files changed, 89 insertions(+) >> >> diff --git a/OvmfPkg/Include/Library/QemuLoadImageLib.h b/OvmfPkg/Includ= e/Library/QemuLoadImageLib.h >> new file mode 100644 >> index 000000000000..694905a6421b >> --- /dev/null >> +++ b/OvmfPkg/Include/Library/QemuLoadImageLib.h >> @@ -0,0 +1,84 @@ >> +/** @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= from >> + QEMU's fw_cfg. The kernel will be instructed via its command line to = load >> + the initrd from the same Simple FileSystem where the kernel was loade= d from. >> + >> + @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. >> + @retval EFI_ACCESS_DENIED The underlying LoadImage boot service c= all >> + returned EFI_SECURITY_VIOLATION, and th= e image >> + was unloaded again. >> + >> + @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,out] ImageHandle Handle of image to be started. May as= sume a >> + different value on return if the imag= e was >> + reloaded. >> + >> + @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid imag= e handle >> + or the image has already been initial= ized with >> + StartImage >> + @retval EFI_SECURITY_VIOLATION The current platform policy specifies= that the >> + image should not be started. >> + >> + @return Error codes returned by the started i= mage. >> + On success, the function doesn't retu= rn. >> +**/ >> +EFI_STATUS >> +EFIAPI >> +QemuStartKernelImage ( >> + IN OUT EFI_HANDLE *ImageHandle >> + ); >> + >> +/** >> + Unloads an image loaded with QemuLoadKernelImage (). >> + >> + @param ImageHandle Handle that identifies the image to b= e >> + 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 hand= le. >> + >> + @return Exit code from the image=E2=80=99s un= load function. >=20 > (1) The above apostrophe (in the "image=E2=80=99s" expression) is U+2019 = ("RIGHT > SINGLE QUOTATION MARK"). Please replace it with a normal ASCII 0x27 > character (U+0027, "APOSTROPHE") when you push the series. Please also sync the comment in the lib instances too. Laszlo