From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: philmd@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Thu, 12 Sep 2019 10:16:09 -0700 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 049FB7C83B for ; Thu, 12 Sep 2019 17:16:09 +0000 (UTC) Received: by mail-wr1-f69.google.com with SMTP id a4so10950622wrg.8 for ; Thu, 12 Sep 2019 10:16:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ity1+lSz5PTWGLw7t0j35ii7UzyEpF9KhR0LdtQVcK4=; b=ZtEpGNPeCsNCPc/kRAMetyvCh8uqQZ7V2y6ubht7WdXxHbSIQfIc+juFcKusXrHKTZ WAsTbtK4fhXG+X3Ao2st7BdX/bc1j3X+P1uI2IQ6PpbyCi67mwky2LJs+ms0VtPKjtLM h+y1POs9g0dp1aELOp5WsMopPdAUFlKGnAOIQW+wvjpxMTPZRqU0h2D7cGASLaIJ0Ceg hlOIku5IKO/ObLXeUkyuMgzxmEV0LYKa7zNFCTuwyPogm4xijO9xCgdPnzC3gfZ+7fPu hAOECl9ooP3kA8PLVvq4bQTmfDmQqymqHVgTYeq2KcPc3mvyqAdwH7s1TcD/khXdbqW3 4SrQ== X-Gm-Message-State: APjAAAWHyUHarLPfLLIapzsyYdTQJXoKcC3F/amdReIkGC3ooddx6P5N T7RmiTv3vu9kfpERZRd68aHjpOi/4iIJevJHYJiOtiWmbAKjc1bqBMf8xKbC9Q5g3gU4eTAuXgK k8aKXMW2g20+C2A== X-Received: by 2002:a5d:6785:: with SMTP id v5mr12214973wru.9.1568308567729; Thu, 12 Sep 2019 10:16:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+X3Yw3jAhRyTqL+pqYnHTGKZyCDb/XO+7PoVhcc94/RVqvkX3aGNv9Bwwd40rl70ftBc3Xg== X-Received: by 2002:a5d:6785:: with SMTP id v5mr12214954wru.9.1568308567514; Thu, 12 Sep 2019 10:16:07 -0700 (PDT) Received: from [192.168.1.41] (251.red-88-10-102.dynamicip.rima-tde.net. [88.10.102.251]) by smtp.gmail.com with ESMTPSA id g201sm836815wmg.34.2019.09.12.10.16.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Sep 2019 10:16:06 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH v3] ArmVirtPkg: increase FD/FV size for NOOPT builds To: devel@edk2.groups.io, ard.biesheuvel@linaro.org Cc: leif.lindholm@linaro.org, lersek@redhat.com References: <20190912165849.20868-1-ard.biesheuvel@linaro.org> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <3c6a0fd7-3d6c-876e-60fe-e31690388b00@redhat.com> Date: Thu, 12 Sep 2019 19:16:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190912165849.20868-1-ard.biesheuvel@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 9/12/19 6:58 PM, Ard Biesheuvel wrote: > After upgrading the CI system we use for building the ArmVirtPkg > targets, we started seeing failures due to the NOOPT build running > out of space when using the CLANG38 toolchain definition combined > with clang 7. > > We really don't want to increase the FD/FV sizes in general to > accommodate this, so parameterize the relevant quantities and > increase them by 50% for NOOPT builds. > > Signed-off-by: Ard Biesheuvel > --- > v3: - don't rely on fragile ordering of DEFINEs for the target dependent > default value, but instead, use a single FD_SIZE_IN_MB macro whose > default is DEFINEd either to 2 or 3 depend on the build target. That > permits switching back to 2 MB for NOOPT builds if desired while > changing the default to 3 MB > - fix a few image header definitions that I missed for ARM32 + Xen > > v2: implement suggestions by Laszlo on 1) how to parameterize this further, > and b) to avoid adding another .inc file > update kernel header field, as pointed out by Philippe > > > ArmVirtPkg/ArmVirt.dsc.inc | 15 ++++++++++++ > ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++++--- > ArmVirtPkg/ArmVirtQemuKernel.fdf | 24 +++++++++++++++++--- > ArmVirtPkg/ArmVirtXen.fdf | 24 +++++++++++++++++--- > 4 files changed, 68 insertions(+), 9 deletions(-) > > diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc > index a4ae25d982a2..10037c938eb8 100644 > --- a/ArmVirtPkg/ArmVirt.dsc.inc > +++ b/ArmVirtPkg/ArmVirt.dsc.inc > @@ -10,6 +10,21 @@ > [Defines] > DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F > > +!if $(TARGET) != NOOPT > + DEFINE FD_SIZE_IN_MB = 2 > +!else > + DEFINE FD_SIZE_IN_MB = 3 > +!endif > + > +!if $(FD_SIZE_IN_MB) == 2 > + DEFINE FD_SIZE = 0x200000 > + DEFINE FD_NUM_BLOCKS = 0x200 > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + DEFINE FD_SIZE = 0x300000 > + DEFINE FD_NUM_BLOCKS = 0x300 > +!endif > + > [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION] > GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 > > diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf > index c2169cb7964b..2c8936a1ae15 100644 > --- a/ArmVirtPkg/ArmVirtQemu.fdf > +++ b/ArmVirtPkg/ArmVirtQemu.fdf > @@ -20,14 +20,22 @@ > # > ################################################################################ > > +[Defines] > +!if $(FD_SIZE_IN_MB) == 2 > + DEFINE FVMAIN_COMPACT_SIZE = 0x1ff000 > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + DEFINE FVMAIN_COMPACT_SIZE = 0x2ff000 > +!endif > + > [FD.QEMU_EFI] > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device > ErasePolarity = 1 > > # This one is tricky, it must be: BlockSize * NumBlocks = Size > BlockSize = 0x00001000 > -NumBlocks = 0x200 > +NumBlocks = $(FD_NUM_BLOCKS) > > ################################################################################ > # > @@ -59,7 +67,7 @@ DATA = { > !endif > } > > -0x00001000|0x001ff000 > +0x00001000|$(FVMAIN_COMPACT_SIZE) > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize > FV = FVMAIN_COMPACT > > diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf > index f675b6d65ee1..72fc8dd698f8 100644 > --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf > +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf > @@ -20,14 +20,22 @@ > # > ################################################################################ > > +[Defines] > +!if $(FD_SIZE_IN_MB) == 2 > + DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000 > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000 > +!endif > + > [FD.QEMU_EFI] > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device > ErasePolarity = 1 > > # This one is tricky, it must be: BlockSize * NumBlocks = Size > BlockSize = 0x00001000 > -NumBlocks = 0x200 > +NumBlocks = $(FD_NUM_BLOCKS) > > ################################################################################ > # > @@ -56,7 +64,12 @@ DATA = { > 0x01, 0x00, 0x00, 0x10, # code0: adr x1, . > 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000 > 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB > +!if $(FD_SIZE_IN_MB) == 2 > 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB > +!endif > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2 > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3 > @@ -76,12 +89,17 @@ DATA = { > 0xf6, 0x1f, 0x00, 0xea, # b 0x8000 > 0x18, 0x28, 0x6f, 0x01, # magic > 0x00, 0x00, 0x00, 0x00, # start > +!if $(FD_SIZE_IN_MB) == 2 > 0x00, 0x00, 0x20, 0x00, # image size: 2 MB > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + 0x00, 0x00, 0x30, 0x00, # image size: 3 MB > +!endif > 0x01, 0x02, 0x03, 0x04 # endiannness flag > !endif > } > > -0x00008000|0x001f8000 > +0x00008000|$(FVMAIN_COMPACT_SIZE) > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize > FV = FVMAIN_COMPACT > > diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf > index 79f681cde028..38d4cc163524 100644 > --- a/ArmVirtPkg/ArmVirtXen.fdf > +++ b/ArmVirtPkg/ArmVirtXen.fdf > @@ -20,14 +20,22 @@ > # > ################################################################################ > > +[Defines] > +!if $(FD_SIZE_IN_MB) == 2 > + DEFINE FVMAIN_COMPACT_SIZE = 0x1fe000 > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + DEFINE FVMAIN_COMPACT_SIZE = 0x2fe000 > +!endif > + > [FD.XEN_EFI] > BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress > -Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize > +Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize > ErasePolarity = 1 > > # This one is tricky, it must be: BlockSize * NumBlocks = Size > BlockSize = 0x00001000 > -NumBlocks = 0x200 > +NumBlocks = $(FD_NUM_BLOCKS) > > ################################################################################ > # > @@ -56,7 +64,12 @@ DATA = { > 0x01, 0x00, 0x00, 0x10, # code0: adr x1, . > 0xff, 0x07, 0x00, 0x14, # code1: b 0x2000 > 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB > +!if $(FD_SIZE_IN_MB) == 2 > 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB > +!endif > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2 > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3 > @@ -76,12 +89,17 @@ DATA = { > 0xf6, 0x07, 0x00, 0xea, # b 0x2000 > 0x18, 0x28, 0x6f, 0x01, # magic > 0x00, 0x00, 0x00, 0x00, # start > +!if $(FD_SIZE_IN_MB) == 2 > 0x00, 0x00, 0x20, 0x00, # image size: 2 MB > +!endif > +!if $(FD_SIZE_IN_MB) == 3 > + 0x00, 0x00, 0x30, 0x00, # image size: 3 MB > +!endif > 0x01, 0x02, 0x03, 0x04 # endiannness flag > !endif > } > > -0x00002000|0x001fe000 > +0x00002000|$(FVMAIN_COMPACT_SIZE) > gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize > FV = FVMAIN_COMPACT Reviewed-by: Philippe Mathieu-Daude