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:05:39 -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 3138979704 for ; Thu, 12 Sep 2019 17:05:38 +0000 (UTC) Received: by mail-wr1-f69.google.com with SMTP id s5so12220662wrv.23 for ; Thu, 12 Sep 2019 10:05:38 -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=zvuXAyMOyQQwTGSfOx3gy8+ZrWQsJimwgNXmQ/csNfw=; b=HQGMBP+2uxLbCN4vvY+CLGHYF/tHa9Rp4WGKw9O2gggDpNRfJ431MuvGa4ZbSSPosF PMIJ07FuUp6zGAppNUXvU0rf2kG6uMdBwmzR8HqSxp+w4FN1ZYCtG47CPKxIxA7sbj+O 0aOkbKoUEvhAM4fcNGHSYWuaXzDg6PTUfr4qhvc0dW0y6H+aBbjaeMC4hUwWEnWdcqMi Zyw8WoPC10WJgriBZvjsLgFOH6hcT14Ta998eJlFnGRf9A0wPesIi+8+An2SYxfME3Z/ TxfeAbOzIvHX27NbSjypL7UPnO85Qrqn2w0mujThmFGtTW64sT4MDiei9u/KcsYX9XG5 0xhA== X-Gm-Message-State: APjAAAXehMQ3sIAzLkK5YQmf2nvkNSUrpo8ACCOWQAMd2gE0GbsqCOH4 ZMVwzT/EEs41ThsWPpt97bJ9TNPdql7fSFkOnQTr0+MaYGMTbu1F+53r2VFhYwtAVQEAqDy7hsY /Bmf5HBiZOVIUYA== X-Received: by 2002:a05:600c:24d2:: with SMTP id 18mr870461wmu.146.1568307936803; Thu, 12 Sep 2019 10:05:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqijOHJ266w+N0ONp6o8lAtpjt1hs9ZPZqj0mf+1GsilI2p+tWFC0giKL3fbh5qzsxIb8oNA== X-Received: by 2002:a05:600c:24d2:: with SMTP id 18mr870441wmu.146.1568307936533; Thu, 12 Sep 2019 10:05:36 -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 a6sm16655160wrr.85.2019.09.12.10.05.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Sep 2019 10:05:35 -0700 (PDT) Subject: Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds To: Ard Biesheuvel Cc: edk2-devel-groups-io , Leif Lindholm , Laszlo Ersek References: <20190911162354.22107-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: <5141ec32-a51d-3ec6-79ef-ceec43b32c84@redhat.com> Date: Thu, 12 Sep 2019 19:05:35 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/12/19 6:50 PM, Ard Biesheuvel wrote: > On Thu, 12 Sep 2019 at 16:20, Philippe Mathieu-Daud=C3=A9 wrote: >> >> Hi Ard, >> >> On 9/11/19 6:23 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 >>> --- >>> v2: implement suggestions by Laszlo on 1) how to parameterize this fu= rther, >>> and b) to avoid adding another .inc file >>> update kernel header field, as pointed out by Philippe >>> >>> ArmVirtPkg/ArmVirt.dsc.inc | 28 ++++++++++++++++++++ >>> ArmVirtPkg/ArmVirtQemu.fdf | 14 +++++++--- >>> ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++++++++++--- >>> ArmVirtPkg/ArmVirtXen.fdf | 14 +++++++--- >>> 4 files changed, 66 insertions(+), 9 deletions(-) >>> >>> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc >>> index a4ae25d982a2..d6b58e5c018b 100644 >>> --- a/ArmVirtPkg/ArmVirt.dsc.inc >>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc >>> @@ -10,6 +10,34 @@ >>> [Defines] >>> DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000004F >>> >>> + # >>> + # Flash size selection. Setting FD_SIZE_IN_KB on the command line = directly to >>> + # one of the supported values, in place of any of the convenience = macros, is >>> + # permitted. >>> + # >>> +!if $(TARGET) =3D=3D NOOPT >>> + DEFINE FD_SIZE_3MB =3D TRUE >>> +!endif >>> + >>> +!ifdef $(FD_SIZE_2MB) >>> + DEFINE FD_SIZE_IN_KB =3D 2048 >>> +!else >>> +!ifdef $(FD_SIZE_3MB) >>> + DEFINE FD_SIZE_IN_KB =3D 3072 >>> +!else >>> + DEFINE FD_SIZE_IN_KB =3D 2048 >>> +!endif >>> +!endif >>> + >>> +!if $(FD_SIZE_IN_KB) =3D=3D 2048 >>> + DEFINE FD_SIZE =3D 0x200000 >>> + DEFINE FD_NUM_BLOCKS =3D 0x200 >>> +!endif >>> +!if $(FD_SIZE_IN_KB) =3D=3D 3072 >>> + DEFINE FD_SIZE =3D 0x300000 >>> + DEFINE FD_NUM_BLOCKS =3D 0x300 >>> +!endif >>> + >>> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DR= IVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI= _APPLICATION] >>> GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000 >>> >>> diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf >>> index c2169cb7964b..d3950c8be05e 100644 >>> --- a/ArmVirtPkg/ArmVirtQemu.fdf >>> +++ b/ArmVirtPkg/ArmVirtQemu.fdf >>> @@ -20,14 +20,22 @@ >>> # >>> ####################################################################= ############ >>> >>> +[Defines] >>> +!if $(FD_SIZE_IN_KB) =3D=3D 2048 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x1ff000 >>> +!endif >>> +!if $(FD_SIZE_IN_KB) =3D=3D 3072 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x2ff000 >>> +!endif >>> + >>> [FD.QEMU_EFI] >>> BaseAddress =3D 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # = QEMU assigns 0 - 0x8000000 for a BootROM >>> -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize # = The size in bytes of the FLASH Device >>> +Size =3D $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # = The size in bytes of the FLASH Device >>> ErasePolarity =3D 1 >>> >>> # This one is tricky, it must be: BlockSize * NumBlocks =3D Size >>> BlockSize =3D 0x00001000 >>> -NumBlocks =3D 0x200 >>> +NumBlocks =3D $(FD_NUM_BLOCKS) >>> >>> ####################################################################= ############ >>> # >>> @@ -59,7 +67,7 @@ DATA =3D { >>> !endif >>> } >>> >>> -0x00001000|0x001ff000 >>> +0x00001000|$(FVMAIN_COMPACT_SIZE) >>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize >>> FV =3D FVMAIN_COMPACT >>> >>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQem= uKernel.fdf >>> index f675b6d65ee1..46ec967e1cc0 100644 >>> --- a/ArmVirtPkg/ArmVirtQemuKernel.fdf >>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf >>> @@ -20,14 +20,22 @@ >>> # >>> ####################################################################= ############ >>> >>> +[Defines] >>> +!if $(FD_SIZE_IN_KB) =3D=3D 2048 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x1f8000 >>> +!endif >>> +!if $(FD_SIZE_IN_KB) =3D=3D 3072 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x2f8000 >>> +!endif >>> + >>> [FD.QEMU_EFI] >>> BaseAddress =3D 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # = QEMU assigns 0 - 0x8000000 for a BootROM >>> -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize # = The size in bytes of the FLASH Device >>> +Size =3D $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # = The size in bytes of the FLASH Device >>> ErasePolarity =3D 1 >>> >>> # This one is tricky, it must be: BlockSize * NumBlocks =3D Size >>> BlockSize =3D 0x00001000 >>> -NumBlocks =3D 0x200 >>> +NumBlocks =3D $(FD_NUM_BLOCKS) >>> >>> ####################################################################= ############ >>> # >>> @@ -56,7 +64,12 @@ DATA =3D { >>> 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_KB) =3D=3D 2048 >>> 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB >>> +!endif >>> +!if $(FD_SIZE_IN_KB) =3D=3D 3072 >>> + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB >>> +!endif >> >> Ah, I was thinking of some inplace endian swapping >> >=20 > If you can make it work, patches welcome :-) I was thinking of this: 0xf6, 0x1f, 0x00, 0xea, # b 0x8000 0x18, 0x28, 0x6f, 0x01, # magic 0x00, 0x00, 0x00, 0x00, # start ((($(FD_SIZE)) & 0x000000ff) << 24), # image size ((($(FD_SIZE)) & 0x0000ff00) << 8), ((($(FD_SIZE)) & 0x00ff0000) >> 8), ((($(FD_SIZE)) & 0xff000000) >> 24), 0x01, 0x02, 0x03, 0x04 # endiannness flag But now that I look at it, I realize it is uglier to review than your if/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 >>> @@ -81,7 +94,7 @@ DATA =3D { >> >> You forgot Aarch32: >> >> 0x00, 0x00, 0x20, 0x00, # image size: 2 MB >> >> 0x01, 0x02, 0x03, 0x04 # endiannness flag >> >> >>> !endif >>> } >>> >>> -0x00008000|0x001f8000 >>> +0x00008000|$(FVMAIN_COMPACT_SIZE) >>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize >>> FV =3D FVMAIN_COMPACT >>> >>> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf >>> index 79f681cde028..2bbb64abde6b 100644 >>> --- a/ArmVirtPkg/ArmVirtXen.fdf >>> +++ b/ArmVirtPkg/ArmVirtXen.fdf >> >> Same 'image size' changes apply to this file too :( >> >=20 > Thanks for spotting that. >=20 >>> @@ -20,14 +20,22 @@ >>> # >>> ####################################################################= ############ >>> >>> +[Defines] >>> +!if $(FD_SIZE_IN_KB) =3D=3D 2048 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x1fe000 >>> +!endif >>> +!if $(FD_SIZE_IN_KB) =3D=3D 3072 >>> + DEFINE FVMAIN_COMPACT_SIZE =3D 0x2fe000 >>> +!endif >>> + >>> [FD.XEN_EFI] >>> BaseAddress =3D 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress >>> -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize >>> +Size =3D $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize >>> ErasePolarity =3D 1 >>> >>> # This one is tricky, it must be: BlockSize * NumBlocks =3D Size >>> BlockSize =3D 0x00001000 >>> -NumBlocks =3D 0x200 >>> +NumBlocks =3D $(FD_NUM_BLOCKS) >>> >>> ####################################################################= ############ >>> # >>> @@ -81,7 +89,7 @@ DATA =3D { >>> !endif >>> } >>> >>> -0x00002000|0x001fe000 >>> +0x00002000|$(FVMAIN_COMPACT_SIZE) >>> gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize >>> FV =3D FVMAIN_COMPACT >>> >>>