From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web11.10594.1583403777797606723 for ; Thu, 05 Mar 2020 02:22:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=hNS7EwWq; spf=pass (domain: linaro.org, ip: 209.85.128.65, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f65.google.com with SMTP id p9so5593819wmc.2 for ; Thu, 05 Mar 2020 02:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9fdlJMbJgn5jxOzpeB3fq9LNmYzN1l3isDzRG6adxss=; b=hNS7EwWq84S7AHtsQxQI4QG8V8TgU2DSsvs6LdxMNYLwWge+zePpDn3UbhN1dyRVzq +UlFTTr7R18N6c/QcoSalzF9WdgDthD2LkRcrHYPkM4A1JsfY7JNJ3G2HixmC5Dwxk8m P9d+fb0+q7WXqcWUGAItf0mez6QOMnvK/tl3ks1qxYCAxj2Ukakd2Ndpgk003C9Iw1SQ obiIzs8MyWJ3XoG0f1NZau7ziL5gNsLYpz90t731qH7V2g4RZW5QxR/lNb4ff09vw/CJ AFhqJTTvSNNiCkGD9mlXZGiIslOXtqM3YBkpgV2yqDJUZ7KjWDlJvx7jbDeAm7aMfphQ zgVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9fdlJMbJgn5jxOzpeB3fq9LNmYzN1l3isDzRG6adxss=; b=C7cSWgGOlDzzxry7GiLnFUxQBUIBB+LC5QPHljIQDr4/+WQ9PsP38D4gwhhMegtq+R Qn0gLIhYk4llDa6vfTr1416KeX0JdfIrJYGHTUEQ7pj+pdts1pGR9GrhXfDIhGGJtKoD kOdTjxYdZ9taEn1nH7qumE3DIUcbnpsRqPpPSI24DVZx0DbUBK0Ac9XhHT6T5GtJ6wgq FqRSvIoPkyy6YxWxkM5gKRSuh7BjZdVlxYLGtv6zoy5Hc9ypnrI1L4JO/rJ7TFvHbkOi iqFTGGyx0aQFpcAC2CI3SY6apaxSiu6hmL6b6cKQlAVXihKOcEgwxXKpNBClKRAxiJcD zaKw== X-Gm-Message-State: ANhLgQ2dvVTCnjOpLGP/9CHM07e+CrywdV1vYYJE0mfr+zHD2btvr3wO GPoqepzapu12pHpWuqVMxYdTdmgGd3sVUskoXhie7A== X-Google-Smtp-Source: ADFU+vsY4X+iKjJnBRX4P7dbhEK0Gd9XaXDty9hxpMc/rFwFJ5K6Ln12RTw1tqyfrZPuuomXelDYhMQNJmugERWesEQ= X-Received: by 2002:a1c:9d43:: with SMTP id g64mr8505065wme.62.1583403776330; Thu, 05 Mar 2020 02:22:56 -0800 (PST) MIME-Version: 1.0 References: <20200304095233.21046-1-ard.biesheuvel@linaro.org> <20200304095233.21046-4-ard.biesheuvel@linaro.org> <7dfb1eb8-eb54-d181-914a-912649a5aaa0@redhat.com> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 5 Mar 2020 11:22:45 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH v2 03/14] OvmfPkg: introduce QemuLoadImageLib library class To: Laszlo Ersek Cc: edk2-devel-groups-io Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 5 Mar 2020 at 10:39, Laszlo Ersek wrote: > > 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/Incl= ude/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 li= ne from > >> + QEMU's fw_cfg. The kernel will be instructed via its command line t= o load > >> + the initrd from the same Simple FileSystem where the kernel was loa= ded from. > >> + > >> + @param[out] ImageHandle The image handle that was allocated f= or > >> + 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= call > >> + returned EFI_SECURITY_VIOLATION, and = the image > >> + was unloaded again. > >> + > >> + @return Error codes from any of the underlyin= g > >> + 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 = assume a > >> + different value on return if the im= age was > >> + reloaded. > >> + > >> + @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid im= age handle > >> + or the image has already been initi= alized with > >> + StartImage > >> + @retval EFI_SECURITY_VIOLATION The current platform policy specifi= es that the > >> + image should not be started. > >> + > >> + @return Error codes returned by the started= image. > >> + On success, the function doesn't re= turn. > >> +**/ > >> +EFI_STATUS > >> +EFIAPI > >> +QemuStartKernelImage ( > >> + IN OUT 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 doe= s not > >> + support unload. > >> + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image ha= ndle. > >> + > >> + @return Exit code from the image=E2=80=99s = unload function. > > > > (1) The above apostrophe (in the "image=E2=80=99s" expression) is U+201= 9 ("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. > OK