From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=DKMkc2D/; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by groups.io with SMTP; Thu, 12 Sep 2019 09:50:40 -0700 Received: by mail-wr1-f66.google.com with SMTP id d17so16438127wrq.13 for ; Thu, 12 Sep 2019 09:50:39 -0700 (PDT) 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=Xi5t8WN+I1fFmi9XynekFRJskWSvM8UikHpfJtVFHAk=; b=DKMkc2D/d4BmbC6EFa21WJr/k5leEBNkV0Ut/GKVKpU2AGzF2DOn/e+ylIpQW//FNy zk/SkdARl/BhtxYgPFngdzDxMGkC9yskwNnU+cksaw6yX0IB963kA0mc6SSAZ+zaU0Eg jNRFf8x8qaVsuxACWyqtXLpXkF4loXOzrxzrjuzJ5NugXI8JDz4/MPMBfuQLJnUYY1Tl 3PItxmCxnE5XhWfZfofjtlWGDgtcjnSUjzDsZixHijpy1nnj/NsP5Gy2tfxlLE1TJWWo dc652yTidCBVaJPEYa3pMgYzvmeDA0G75y0kfywob6aWWSHuCVPVs/4pq29BQIBE/5ct vMpQ== 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=Xi5t8WN+I1fFmi9XynekFRJskWSvM8UikHpfJtVFHAk=; b=GTLX4TuljnM/QN/TcMvKl8lNb2dfYhY7pLDj/d4DRm0lSQirwP7H4hxQD38gBXnWZa k22YS8+53XaypfFoGvdLdKpwNFsw06zDWDeDfI7FXcVJ/oCDkx8xZcVNFt0e6+PPZ0tT dR6N+DqUNLqWMbVU/wmybF2Q6Cn5QcFLkqqmpc0aNqqAF3zjyIDDGqVVCQelMOmTtWjX VHas4NNCxXaBnKfkHl2rhhws/7V1yYkw3G0T/gDbBCd55wE4Xd7RBd0Goq9Bf6rn6W7O QmsfzIhfOEkEEYTA9k7qsiKIksBXRp15bHsDgMWRZzIidWQNj2nP0Wt4SbVcYtlRTMc7 O20Q== X-Gm-Message-State: APjAAAWlQlADykuVYcFw0mKHPVKmHWcx+qNSmyJepSv8vtH3p1lActMR NedLNTCH1YUzHC/3g1gbo9LTt0UXWmAaDkADU0A4Zg== X-Google-Smtp-Source: APXvYqyujQbi0T0Ru6feCQiRbTkT4+DPsgxgdkoXWO/ror880IFJNsl483wsGuWB21HvMo+K+gwtz8nt9lmjR9mrSmI= X-Received: by 2002:a5d:66cb:: with SMTP id k11mr3745365wrw.174.1568307038399; Thu, 12 Sep 2019 09:50:38 -0700 (PDT) MIME-Version: 1.0 References: <20190911162354.22107-1-ard.biesheuvel@linaro.org> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 12 Sep 2019 17:50:16 +0100 Message-ID: Subject: Re: [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds To: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Cc: edk2-devel-groups-io , Leif Lindholm , Laszlo Ersek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 furt= her, > > 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 di= rectly to > > + # one of the supported values, in place of any of the convenience ma= cros, 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_DRIV= ER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APP= LICATION] > > 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 # QE= MU assigns 0 - 0x8000000 for a BootROM > > -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize # Th= e size in bytes of the FLASH Device > > +Size =3D $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # Th= e 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/ArmVirtQemuK= ernel.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 # QE= MU assigns 0 - 0x8000000 for a BootROM > > -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize # Th= e size in bytes of the FLASH Device > > +Size =3D $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # Th= e 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 K= B > > +!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 > If you can make it work, patches welcome :-) > > 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 :( > Thanks for spotting that. > > @@ -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 > > > >