From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Olivier Martin" Subject: Re: [PATCH v1 06/21] ArmVirtualizationPkg: add padding to FDT allocation Date: Mon, 26 Jan 2015 11:51:39 -0000 Message-ID: <35316.5575107143$1422273220@news.gmane.org> References: <1422025390-8036-1-git-send-email-ard.biesheuvel@linaro.org> <1422025390-8036-7-git-send-email-ard.biesheuvel@linaro.org> <54c6294f.8638e50a.7237.ffffa2f5SMTPIN_ADDED_BROKEN@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-gb List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: 'Ard Biesheuvel' Cc: Ian.Campbell@citrix.com, Stefano Stabellini , edk2-devel@lists.sourceforge.net, Leif Lindholm , xen-devel@lists.xen.org, Roy Franz , Ilias Biris , Anthony PERARD , Laszlo Ersek , Christoffer Dall List-Id: xen-devel@lists.xenproject.org Oops, Monday morning... I actually wanted to check if it was a PCD. And I think it should be a PCD in case we have different build variations that require more or less padding. And it does not explain why this value disappear later on. Maybe a later patch will give me the answer... > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: 26 January 2015 11:48 > To: Olivier Martin > Cc: edk2-devel@lists.sourceforge.net; Laszlo Ersek; Roy Franz; Leif > Lindholm; Stefano Stabellini; Ian.Campbell@citrix.com; Anthony PERARD; > Christoffer Dall; xen-devel@lists.xen.org; Ilias Biris > Subject: Re: [PATCH v1 06/21] ArmVirtualizationPkg: add padding to FDT > allocation > > On 26 January 2015 at 11:47, Olivier Martin > wrote: > > I am a bit lost with this patch. I am looking for the definition of > > FDT_PADDING. I cannot find it in the previous patches and in > subversion. > > It is in the first hunk of *this* patch > > > And it looks like it is going to be removed later on as I cannot find > it > > anymore in the HEAD of your branch > > https://git.linaro.org/people/ard.biesheuvel/uefi- > next.git/shortlog/refs/hea > > ds/linaro-topic-xen. > > > >> -----Original Message----- > >> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > >> Sent: 23 January 2015 15:03 > >> To: edk2-devel@lists.sourceforge.net; lersek@redhat.com; Olivier > >> Martin; roy.franz@linaro.org; leif.lindholm@linaro.org; > >> stefano.stabellini@eu.citrix.com; Ian.Campbell@citrix.com; > >> anthony.perard@citrix.com; christoffer.dall@linaro.org; xen- > >> devel@lists.xen.org; ilias.biris@linaro.org > >> Cc: Ard Biesheuvel > >> Subject: [PATCH v1 06/21] ArmVirtualizationPkg: add padding to FDT > >> allocation > >> > >> Our primary user QEMU/mach-virt presents us with a FDT blob padded > >> to 64 KB with plenty of room to set additional properties. However, > >> in the general case, we should only add properties after making sure > >> there is enough room available. > >> > >> Contributed-under: TianoCore Contribution Agreement 1.0 > >> Signed-off-by: Ard Biesheuvel > >> --- > >> .../Library/PlatformPeiLib/PlatformPeiLib.c | 17 > >> +++++++++++++---- > >> 1 file changed, 13 insertions(+), 4 deletions(-) > >> > >> diff --git > >> > a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPe > >> iLib.c > >> > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPe > >> iLib.c > >> index f2404f89d152..540474608deb 100644 > >> --- > >> > a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPe > >> iLib.c > >> +++ > >> > b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPe > >> iLib.c > >> @@ -24,6 +24,15 @@ > >> #include > >> #include > >> > >> +// > >> +// We may want to apply some changes to the device tree before > passing > >> it > >> +// to the OS: for instance, if we find a PL031 RTC node and attach > our > >> +// runtime driver to it, we should disable it in the device tree by > >> setting > >> +// its status property to "disabled". Add some padding to make sure > >> this is > >> +// possible. > >> +// > >> +#define FDT_PADDING 256 > > > here ^^^ > > > >> + > >> EFI_STATUS > >> EFIAPI > >> PlatformPeim ( > >> @@ -32,7 +41,7 @@ PlatformPeim ( > >> { > >> VOID *Base; > >> VOID *NewBase; > >> - UINTN FdtSize; > >> + UINTN FdtPages; > >> UINTN *FdtHobData; > >> UINT64 *UartHobData; > >> INT32 Node, Prev; > >> @@ -46,10 +55,10 @@ PlatformPeim ( > >> Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); > >> ASSERT (Base != NULL && fdt_check_header (Base) == 0); > >> > >> - FdtSize = fdt_totalsize (Base); > >> - NewBase = AllocatePages (EFI_SIZE_TO_PAGES (FdtSize)); > >> + FdtPages = EFI_SIZE_TO_PAGES (fdt_totalsize (Base) + > FDT_PADDING); > >> + NewBase = AllocatePages (FdtPages); > >> ASSERT (NewBase != NULL); > >> - CopyMem (NewBase, Base, FdtSize); > >> + fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages)); > >> > >> FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData); > >> ASSERT (FdtHobData != NULL); > >> -- > >> 1.8.3.2 > >> > > > > > > > >