From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mx.groups.io with SMTP id smtpd.web12.563.1630646787884686941 for ; Thu, 02 Sep 2021 22:26:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@newmexicoconsortium-org.20150623.gappssmtp.com header.s=20150623 header.b=YpbELlF3; spf=none, err=SPF record not found (domain: newmexicoconsortium.org, ip: 209.85.216.51, mailfrom: dbautista@newmexicoconsortium.org) Received: by mail-pj1-f51.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso3079922pjh.5 for ; Thu, 02 Sep 2021 22:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newmexicoconsortium-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kqwRBm3aLEgRzOF1Ly40SXxUTtcGPTerkitNipOhwmM=; b=YpbELlF3mh2IpMaZ7iHcCY4VBeXfj9QSP7TpLNebY+u1jpshvS51zISJEwikZxmxrv RNsqrQw5jnCQzrltSyk6RoTdKwX0a5lI9GarSsCqwSjJ7wxW700QRUtap7lGrIym8ZrY fnM7PtG0ZJAfffQJAgklN3lztHbyuEQr6WAjd/fDUULW3Rzk//ntQ+72BXPDmHF73TqC OUc+/Dhyac1x1wwdZrr47WwwHjE2iv1KRhDEEjjs+xFnLoUfPJuGmJGU7TrfvDAhVHzw 93S6NKxqA7xj1qxnypv7VaPvJV4ht0PBGxXhO083DngaEaXuyvmaZXW4QDAEvlrTnNBW HV3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kqwRBm3aLEgRzOF1Ly40SXxUTtcGPTerkitNipOhwmM=; b=g0c8Gb2YtJ9zQoMFlA1FO9pKhBCeEVlL2sekr/e6AC75qaVszOawA9G61eVnAOL1bb Z02F7s8HBMpWfgB0s9kZkwA3ZQE+3QKlmi4bjxBZNtnwMmifKMfpTX7eT4zeAj5M8VrF 0xDLsw815F4dAtasv56JWipau28TN1vmeDWC7brebfLprYWqla2G3NpkiRv6ysLK3jZe cUUkhTb0Rz0EzSHjqo11HGBxeiWayOQ6GqvDXODgeA8qwtDr5MrEql+o8CikouzaNb5I /H/c6lNQtQpCeWQHQwGoxy1jscy9Sawem4gFbxtkvMjX3CTxUDNDP9B4in7aKNwHeQ9s Tdrw== X-Gm-Message-State: AOAM531AfZ68pPVo02GzljHSglX59WtMLW2QtTuChMfpaecEmPkxnVQY gEiUyltZkujdyWeaD0/fD0axmNevZ9jzEA== X-Google-Smtp-Source: ABdhPJyYUWveB2kDqaIJl7w8X3zm5IAAN8hXCK2hQpJCAyHegooNpqQpIBvgInIbBCX5ARgD/4WmwA== X-Received: by 2002:a17:90b:30c1:: with SMTP id hi1mr1905365pjb.187.1630646786396; Thu, 02 Sep 2021 22:26:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-73-48-255-158.hsd1.ca.comcast.net. [73.48.255.158]) by smtp.googlemail.com with ESMTPSA id c24sm4044887pfd.145.2021.09.02.22.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 22:26:26 -0700 (PDT) From: "Devon Bautista" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Devon Bautista Subject: [PATCH v2 1/1] OvmfPkg: Introduce 16MiB flash size for (primarily) Linuxboot Date: Fri, 3 Sep 2021 05:26:20 +0000 Message-Id: <20210903052620.30638-2-dbautista@newmexicoconsortium.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903052620.30638-1-dbautista@newmexicoconsortium.org> References: <20210903052620.30638-1-dbautista@newmexicoconsortium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The largest size flash image currently available for OVMF builds, 4MiB, is too small to insert a Linux kernel and initramfs into the DXEFV, and is thus insufficient for testing Linuxboot builds via OVMF. Introduce the FD_SIZE_16MB build macro (equivalently, FD_SIZE_IN_KB=3D16384), which enlarges the full flash image to 16MiB, the maximum size available for x86. Since QEMU commit 0657c65 (hw/i386/pc: add max combined fw size as machine configuration option), QEMU supports flash sizes up to 16MiB using the "max-fw-size" property. This new 16MiB flash size uses the same non-volatile variable store size and layout as the default 4MiB flash size to ensure compatibility when switching to the larger flash size. Since the 4MiB target was created in commit b24fca0 (OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK), the variable store size increased by 200KiB to 256KiB, which should provide an adequate safety margin. The FVMAIN_COMPACT is significantly enlarged to provide the extra space in the DXEFV (and PEIFV, if needed). For now, the 4MiB target remains the default. In summary: Description Compression type Size [KB] ------------------------- ----------------- ----------------------- Non-volatile data storage open-coded binary 528 -> 528 ( +0) data Variable store 256 -> 256 ( +0) Event log 4 -> 4 ( +0) Working block 4 -> 4 ( +0) Spare area 264 -> 264 ( +0) FVMAIN_COMPACT uncompressed 3360 -> 15648 (+12288) FV FFS file LZMA compressed PEIFV uncompressed 896 -> 896 ( +0) individual PEI uncompressed modules DXEFV uncompressed 12288 -> 12288 ( +0) individual DXE uncompressed modules SECFV uncompressed 208 -> 208 ( +0) SEC driver reset vector code Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Devon Bautista --- OvmfPkg/OvmfPkgIa32.dsc | 4 +++ OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++ OvmfPkg/OvmfPkgX64.dsc | 4 +++ OvmfPkg/OvmfXen.dsc | 4 +++ OvmfPkg/OvmfPkgDefines.fdf.inc | 28 +++++++++++++++----- OvmfPkg/VarStore.fdf.inc | 16 +++++------ 6 files changed, 45 insertions(+), 15 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index d1d92c97bae3..fadad1c1efda 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -67,11 +67,15 @@ [Defines] !else=0D !ifdef $(FD_SIZE_4MB)=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D +!else=0D +!ifdef $(FD_SIZE_16MB)=0D + DEFINE FD_SIZE_IN_KB =3D 16384=0D !else=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D !endif=0D !endif=0D !endif=0D +!endif=0D =0D [BuildOptions]=0D GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index a467ab7090fb..0e8eae845901 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -66,11 +66,15 @@ [Defines] !else=0D !ifdef $(FD_SIZE_4MB)=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D +!else=0D +!ifdef $(FD_SIZE_16MB)=0D + DEFINE FD_SIZE_IN_KB =3D 16384=0D !else=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D !endif=0D !endif=0D !endif=0D +!endif=0D =0D [BuildOptions]=0D GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index e56b83d95e09..36ccb4418f67 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -66,11 +66,15 @@ [Defines] !else=0D !ifdef $(FD_SIZE_4MB)=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D +!else=0D +!ifdef $(FD_SIZE_16MB)=0D + DEFINE FD_SIZE_IN_KB =3D 16384=0D !else=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D !endif=0D !endif=0D !endif=0D +!endif=0D =0D [BuildOptions]=0D GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 1a9c06c164a8..6a7ce481e895 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -56,11 +56,15 @@ [Defines] !else=0D !ifdef $(FD_SIZE_4MB)=0D DEFINE FD_SIZE_IN_KB =3D 4096=0D +!else=0D +!ifdef $(FD_SIZE_16MB)=0D + DEFINE FD_SIZE_IN_KB =3D 16384=0D !else=0D DEFINE FD_SIZE_IN_KB =3D 2048=0D !endif=0D !endif=0D !endif=0D +!endif=0D =0D [BuildOptions]=0D GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D diff --git a/OvmfPkg/OvmfPkgDefines.fdf.inc b/OvmfPkg/OvmfPkgDefines.fdf.inc index 3b5e45253916..301600c4ef84 100644 --- a/OvmfPkg/OvmfPkgDefines.fdf.inc +++ b/OvmfPkg/OvmfPkgDefines.fdf.inc @@ -14,8 +14,8 @@ # A firmware binary built with FD_SIZE_IN_KB=3D1024, and a firmware binary= built=0D # with FD_SIZE_IN_KB=3D2048, use the same variable store layout.=0D #=0D -# Setting FD_SIZE_IN_KB to 4096 results in a different (much larger) varia= ble=0D -# store structure that is incompatible with both of the above-mentioned=0D +# Setting FD_SIZE_IN_KB to 4096 or 16384 results in a different (much larg= er)=0D +# variable store structure that is incompatible with both of the above-men= tioned=0D # firmware binaries.=0D #=0D !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D @@ -23,6 +23,13 @@ DEFINE VARS_BLOCKS =3D 0x20=0D DEFINE VARS_LIVE_SIZE =3D 0xE000=0D DEFINE VARS_SPARE_SIZE =3D 0x10000=0D +!else=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 16384) || ($(FD_SIZE_IN_KB) =3D=3D 4096)=0D +DEFINE VARS_SIZE =3D 0x84000=0D +DEFINE VARS_BLOCKS =3D 0x84=0D +DEFINE VARS_LIVE_SIZE =3D 0x40000=0D +DEFINE VARS_SPARE_SIZE =3D 0x42000=0D +!endif=0D !endif=0D =0D !if $(FD_SIZE_IN_KB) =3D=3D 1024=0D @@ -50,11 +57,6 @@ !endif=0D =0D !if $(FD_SIZE_IN_KB) =3D=3D 4096=0D -DEFINE VARS_SIZE =3D 0x84000=0D -DEFINE VARS_BLOCKS =3D 0x84=0D -DEFINE VARS_LIVE_SIZE =3D 0x40000=0D -DEFINE VARS_SPARE_SIZE =3D 0x42000=0D -=0D DEFINE FW_BASE_ADDRESS =3D 0xFFC00000=0D DEFINE FW_SIZE =3D 0x00400000=0D DEFINE FW_BLOCKS =3D 0x400=0D @@ -66,6 +68,18 @@ DEFINE SECFV_SIZE =3D 0x34000=0D !endif=0D =0D +!if $(FD_SIZE_IN_KB) =3D=3D 16384=0D +DEFINE FW_BASE_ADDRESS =3D 0xFF000000=0D +DEFINE FW_SIZE =3D 0x01000000=0D +DEFINE FW_BLOCKS =3D 0x1000=0D +DEFINE CODE_BASE_ADDRESS =3D 0xFF084000=0D +DEFINE CODE_SIZE =3D 0x00F7C000=0D +DEFINE CODE_BLOCKS =3D 0xF7C=0D +DEFINE FVMAIN_SIZE =3D 0x00F48000=0D +DEFINE SECFV_OFFSET =3D 0x00FCC000=0D +DEFINE SECFV_SIZE =3D 0x34000=0D +!endif=0D +=0D SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress =3D $(FW_BASE_ADDR= ESS)=0D SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize =3D $(FW_SIZE)=0D SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize =3D $(BLOCK_SIZE)= =0D diff --git a/OvmfPkg/VarStore.fdf.inc b/OvmfPkg/VarStore.fdf.inc index a1e524e39329..179ab64d4642 100644 --- a/OvmfPkg/VarStore.fdf.inc +++ b/OvmfPkg/VarStore.fdf.inc @@ -11,7 +11,7 @@ !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D 0x00000000|0x0000e000=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D 0x00000000|0x00040000=0D !endif=0D #NV_VARIABLE_STORE=0D @@ -29,7 +29,7 @@ # FvLength: 0x20000=0D 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D # FvLength: 0x84000=0D 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,=0D !endif=0D @@ -41,7 +41,7 @@ # CheckSum=0D 0x19, 0xF9,=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D # CheckSum=0D 0xAF, 0xB8,=0D !endif=0D @@ -51,7 +51,7 @@ # Blockmap[0]: 0x20 Blocks * 0x1000 Bytes / Block=0D 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D # Blockmap[0]: 0x84 Blocks * 0x1000 Bytes / Block=0D 0x84, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,=0D !endif=0D @@ -70,7 +70,7 @@ # This can speed up the Variable Dispatch a bit.=0D 0xB8, 0xDF, 0x00, 0x00,=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D # Size: 0x40000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariabl= eSize) -=0D # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0x3ffb8=0D # This can speed up the Variable Dispatch a bit.=0D @@ -83,7 +83,7 @@ !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D 0x0000e000|0x00001000=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D 0x00040000|0x00001000=0D !endif=0D #NV_EVENT_LOG=0D @@ -91,7 +91,7 @@ !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D 0x0000f000|0x00001000=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D 0x00041000|0x00001000=0D !endif=0D #NV_FTW_WORKING=0D @@ -109,7 +109,7 @@ !if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D 0x00010000|0x00010000=0D !endif=0D -!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 4096) || ($(FD_SIZE_IN_KB) =3D=3D 16384)=0D 0x00042000|0x00042000=0D !endif=0D #NV_FTW_SPARE=0D --=20 2.33.0