From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 44054211944DB for ; Thu, 22 Nov 2018 08:37:26 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id u13-v6so9720733wmc.4 for ; Thu, 22 Nov 2018 08:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QhygHUYAynRHoLyRa8DGJ2IQOdvUuwLNtxfFqTpdaQY=; b=WnZeD1Ny2Fzqq06XhmWNNPFoDCqSakaGFL3D9KWukLyI/5kxXQh12UziFDwfz+2zz+ U2P+hdS/LTbQdR0YOOPGvNF0Qp7Cihx8NqiNnHpJKUul+j1+94N9W2n+EuHSmLprXQQI RRdki68BYfHB4K32d+atm0vK4f5eMu0OO2lfc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QhygHUYAynRHoLyRa8DGJ2IQOdvUuwLNtxfFqTpdaQY=; b=R3XaY4DP25YIOOq9aQH46loQvzh03CfgbPDhHL9Yo48pdfeBsmeWEh1RjBQ0JsWHJZ QpoPen/6CFP0F+RfTtsXD8cB6rEJQl8xX5Fzw7wQAaL/bRfR57QI2sHVust2Vs+c4TJA yIv7Bnwi4Kxby8UYtAv9NkhZNyZ6utXKu5h+LrDgQfs/bC/JcRsoir5JMfRtGvXPy7Bn 0tGeWZHt+yUJ3/n5g5e+njkPh2dKIbQ+W6DfdPvMfZLTuhNpPDZrtiREt2rhwacMUVLD nMSTR7DAHxp7PnXSpD8cwlkAxtJNHJdy/M8gLis/KFj9CbsHUIUTF1rvQThFKoW+JnAD OKnw== X-Gm-Message-State: AGRZ1gI7wWfT99D4DzIWJh+hVbmjZtAWThIMKuHjTrn78WtSMGqlMm1P NRotVkbxbFoMhkrTXVslWHw/nmC9lsZIpg== X-Google-Smtp-Source: AJdET5d/I2edPHuZWrfmqRlCbnbiw05xraYOi3g3hYQVUsbuLPIQu1N1TlVf+Rv9z+KvYcChx9Eyzw== X-Received: by 2002:a1c:5d4f:: with SMTP id r76-v6mr10269469wmb.25.1542904644195; Thu, 22 Nov 2018 08:37:24 -0800 (PST) Received: from [100.94.144.182] (224.14.136.77.rev.sfr.net. [77.136.14.224]) by smtp.gmail.com with ESMTPSA id a1sm28705842wrw.76.2018.11.22.08.37.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 08:37:23 -0800 (PST) Mime-Version: 1.0 (1.0) From: Ard Biesheuvel X-Mailer: iPhone Mail (16A366) In-Reply-To: Date: Thu, 22 Nov 2018 17:37:22 +0100 Cc: Chandni Cherukuri , "edk2-devel@lists.01.org" , Nariman Poushin Message-Id: References: <20181121120145.3148-1-ard.biesheuvel@linaro.org> To: Laszlo Ersek Subject: Re: [PATCH edk2-platforms 0/3] drop GUIDs from NOR flash bank descriptors X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2018 16:37:26 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On 22 Nov 2018, at 17:30, Laszlo Ersek wrote: >=20 >> On 11/22/18 14:08, Ard Biesheuvel wrote: >>> On Thu, 22 Nov 2018 at 12:37, Ard Biesheuvel = wrote: >>>=20 >>> On Thu, 22 Nov 2018 at 12:19, chandni cherukuri >>> wrote: >>>>=20 >>>> On Thu, Nov 22, 2018 at 1:20 PM Ard Biesheuvel >>>> wrote: >>>>>=20 >>>>>> On Thu, 22 Nov 2018 at 05:01, Thomas Abraham = wrote: >>>>>>=20 >>>>>> Hi Ard, >>>>>>=20 >>>>>> On Thu, Nov 22, 2018 at 3:46 AM Ard Biesheuvel >>>>>> wrote: >>>>>>>=20 >>>>>>>> On Wed, 21 Nov 2018 at 14:48, Thomas Abraham wrote: >>>>>>>>=20 >>>>>>>> Hi Ard, >>>>>>>>=20 >>>>>>>> On Wed, Nov 21, 2018 at 5:31 PM Ard Biesheuvel >>>>>>>> wrote: >>>>>>>>>=20 >>>>>>>>> Align edk2-platform with upcoming changes to EDK2 to get rid of pe= r-bank >>>>>>>>> NOR flash GUIDs. >>>>>>>>>=20 >>>>>>>>> Ard Biesheuvel (3): >>>>>>>>> Platform/ARM: replace hardcoded VenHW() device paths referring to= NOR >>>>>>>>> flash >>>>>>>>> Silicon/SynQuacer: drop per-bank NOR flash GUIDs >>>>>>>>> Platform/ARM: drop per-bank NOR flash GUIDs >>>>>>>>>=20 >>>>>>>>> Platform/ARM/JunoPkg/ArmJuno.dec | 2 +- >>>>>>>>> Platform/ARM/JunoPkg/ArmJuno.dsc | 2 +- >>>>>>>>> .../JunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c | 2 -- >>>>>>>>> .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c | 2 -- >>>>>>>>> Platform/ARM/SgiPkg/SgiPlatform.dsc | 2 +- >>>>>>>>> Platform/ARM/VExpressPkg/ArmVExpress-CTA15-A7.dsc | 2 +- >>>>>>>>> Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 2 +- >>>>>>>>> .../NorFlashArmVExpressLib/NorFlashArmVExpress.c | 4 ---- >>>>>>>>> .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 14 +++++++---= ---- >>>>>>>>> .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h | 3 +++ >>>>>>>>> .../NorFlashSynQuacerLib/NorFlashSynQuacer.c | 6 ------ >>>>>>>>> 11 files changed, 15 insertions(+), 26 deletions(-) >>>>>>>>=20 >>>>>>>> Tested this patch series and "[PATCH v2 0/5] ArmPlatformPkg, >>>>>>>> ArmVirtPkg: discover NOR flash banks from DTB" patch series on the >>>>>>>> Juno board. With these patches applied, the boot fails on Juno boar= d >>>>>>>> with the following messages. I have not yet tried to debug the issu= e >>>>>>>> but wanted to let you know this. >>>>>>>>=20 >>>>>>>> [...] >>>>>>>> Loading driver at 0x000F830C000 EntryPoint=3D0x000F831B2AC IScsiDxe= .efi >>>>>>>> add-symbol-file >>>>>>>> /home/thopan01/devel/juno/uefi/uefi/edk2/Build/ArmJuno/DEBUG_GCC5/A= ARCH64/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe/DEBUG/Udp4Dxe.dll >>>>>>>> 0xF8300000 >>>>>>>> Loading driver at 0x000F82FF000 EntryPoint=3D0x000F8306DF0 Udp4Dxe.= efi >>>>>>>> add-symbol-file >>>>>>>> /home/thopan01/devel/juno/uefi/uefi/edk2/Build/ArmJuno/DEBUG_GCC5/A= ARCH64/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe/DEBUG/FdtPlatformD= xe.dll >>>>>>>> 0xF82EE000 >>>>>>>> Loading driver at 0x000F82ED000 EntryPoint=3D0x000F82F76EC FdtPlatf= ormDxe.efi >>>>>>>> Found image: fip in block 5. >>>>>>>> Found image: norkern in block 20. >>>>>>>> Found image: ramdisk.img in block 116. >>>>>>>> Found image: hdlcdclk in block 151. >>>>>>>> Found image: selftest in block 152. >>>>>>>> Found image: board.dtb in block 156. >>>>>>>> Found image: scp_bl1 in block 249. >>>>>>>> Found image: bl1 in block 251. >>>>>>>> Found image: startup.nsh in block 252. >>>>>>>> ASSERT [BootMonFs] >>>>>>>> /home/thopan01/devel/juno/uefi/uefi/edk2/MdePkg/Library/BaseLib/Str= ing.c(173): >>>>>>>> ((UINTN) String & 0x00000001) =3D=3D 0 >>>>>>>>=20 >> ... >>> Could you please share the backtrace and the results of >>>=20 >>> nm -n Build/ArmJuno/DEBUG_GCC5/AARCH64/Platform/ARM/Drivers/BootMonFs/Bo= otMonFs/DEBUG/BootMonFs.dll >>>=20 >>> for the failing case? >>>=20 >>=20 >> It seems like BootMonFsOpenFile() is being called from FdtClientDxe >=20 > I think you mean "FdtPlatformDxe". >=20 Yes. Yay for multitasking :-) >> with a misaligned CHAR16* argument for Filename. >=20 > Yup, that's not an infrequent bug. >=20 > Device paths are packed. Once we introduce a UINT8 field to a device > path node, the rest of the nodes in the same device path will shift by 1 > byte. If there is a CHAR16 array field in one of those "later" device > path nodes, such as "FILEPATH_DEVICE_PATH.PathName", then it might go > from naturally aligned to mis-aligned, or vice versa. Therefore, passing > such CHAR16 fields to string functions in BaseLib, that is, right out of > the containing device path node, is never portable. If it happens to > work, that is by chance only. >=20 > For example: >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1003 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1008 >=20 > I suggest grepping "FdtPlatformDxe" (or, well, rather "BootMonFs"!) for > "PathName", and wherever it is passed to StrLen() -- because > MdePkg/Library/BaseLib/String.c(173) is in StrLen() --, make sure the > pathname is first re-aligned naturally, temporarily. For example, with > AllocateCopyPool(). >=20 > gBS->AllocatePool() guarantees 8-byte alignment per spec. While > AllocatePool() / AllocateCopyPool() from MemoryAllocationLib don't > explicitly guarantee the same "on the tin", I think that's not by > design, but by omission. FWIW, for TianoCore BZs 1003 and 1008 above, we > assumed AllocateCopyPool() would ensure 8-byte alignment as well. >=20 I tracked this down to BdsLib (a remnant of the illustrious ARM bds), which i= s a bit of a mess. I=E2=80=99ll have some patches out shortly.