Revert "OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line"

This reverts commit efc52d67e1.

Manually fixed conflicts in:
  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c

Note that besides re-exposing the kernel command line as a file in the
synthetic filesystem, we also revert back to AllocatePool instead of
AllocatePages.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Tobin Feldman-Fitzthum <tobin@linux.ibm.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3457
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210628105110.379951-4-dovmurik@linux.ibm.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Dov Murik 2021-06-28 10:51:08 +00:00 committed by mergify[bot]
parent 932449710c
commit 24b0e9d128
1 changed files with 8 additions and 3 deletions

View File

@ -33,6 +33,7 @@
typedef enum { typedef enum {
KernelBlobTypeKernel, KernelBlobTypeKernel,
KernelBlobTypeInitrd, KernelBlobTypeInitrd,
KernelBlobTypeCommandLine,
KernelBlobTypeMax KernelBlobTypeMax
} KERNEL_BLOB_TYPE; } KERNEL_BLOB_TYPE;
@ -59,6 +60,11 @@ STATIC KERNEL_BLOB mKernelBlob[KernelBlobTypeMax] = {
{ {
{ QemuFwCfgItemInitrdSize, QemuFwCfgItemInitrdData, }, { QemuFwCfgItemInitrdSize, QemuFwCfgItemInitrdData, },
} }
}, {
L"cmdline",
{
{ QemuFwCfgItemCommandLineSize, QemuFwCfgItemCommandLineData, },
}
} }
}; };
@ -948,7 +954,7 @@ FetchBlob (
// //
// Read blob. // Read blob.
// //
Blob->Data = AllocatePages (EFI_SIZE_TO_PAGES ((UINTN)Blob->Size)); Blob->Data = AllocatePool (Blob->Size);
if (Blob->Data == NULL) { if (Blob->Data == NULL) {
DEBUG ((DEBUG_ERROR, "%a: failed to allocate %Ld bytes for \"%s\"\n", DEBUG ((DEBUG_ERROR, "%a: failed to allocate %Ld bytes for \"%s\"\n",
__FUNCTION__, (INT64)Blob->Size, Blob->Name)); __FUNCTION__, (INT64)Blob->Size, Blob->Name));
@ -1083,8 +1089,7 @@ FreeBlobs:
while (BlobType > 0) { while (BlobType > 0) {
CurrentBlob = &mKernelBlob[--BlobType]; CurrentBlob = &mKernelBlob[--BlobType];
if (CurrentBlob->Data != NULL) { if (CurrentBlob->Data != NULL) {
FreePages (CurrentBlob->Data, FreePool (CurrentBlob->Data);
EFI_SIZE_TO_PAGES ((UINTN)CurrentBlob->Size));
CurrentBlob->Size = 0; CurrentBlob->Size = 0;
CurrentBlob->Data = NULL; CurrentBlob->Data = NULL;
} }