From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 14D642194D3AE for ; Sat, 13 Oct 2018 14:35:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86C1610F05; Sat, 13 Oct 2018 21:35:35 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-6.rdu2.redhat.com [10.10.120.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94C2212A71; Sat, 13 Oct 2018 21:35:33 +0000 (UTC) To: Sami Mujawar , edk2-devel@lists.01.org Cc: nd@arm.com, Stephanie.Hughes-Fitt@arm.com, Drew Jones , Eric Auger , Ard Biesheuvel References: <20181012144009.48732-1-sami.mujawar@arm.com> <20181012144009.48732-5-sami.mujawar@arm.com> From: Laszlo Ersek Message-ID: <82759606-580e-0f35-3258-b57eb3f2d5d8@redhat.com> Date: Sat, 13 Oct 2018 23:35:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181012144009.48732-5-sami.mujawar@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 13 Oct 2018 21:35:35 +0000 (UTC) Subject: Re: [PATCH v1 4/6] ArmVirtPkg: Save DT base address from X0 in PCD 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: Sat, 13 Oct 2018 21:35:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/12/18 16:40, Sami Mujawar wrote: > Some virtual machine managers provide the base address of the DT > in memory in the X0 register. Save the DT Base address in the > PcdDeviceTreeInitialBaseAddress so that the firmware can use the > PCD to parse the DT and obtain the platform information subsequently. > > This change also requires that the PcdDeviceTreeInitialBaseAddress > be a Dynamic PCD. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Sami Mujawar > --- > The changes can be seen at https://github.com/samimujawar/edk2/commit/57ffa0da043fd73907b24a6833d2797ea3dae564 > > Notes: > v1: > - Enable loading of DT from base address passed in X0. [SAMI] > > ArmVirtPkg/ArmVirtPkg.dec | 12 ++++++++---- > ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 9 +++++++-- > 2 files changed, 15 insertions(+), 6 deletions(-) This patch seems to overlap with a feature that (I think) Ard, Drew and Eric have discussed earlier, for QEMU (floating RAM base). I suggest coordinating as early as possible. Thanks Laszlo > diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec > index 8f656fd2739dd1460891029f53953c765396f8fb..9d4b782a43e505079263ded2347dff2304c2a75c 100644 > --- a/ArmVirtPkg/ArmVirtPkg.dec > +++ b/ArmVirtPkg/ArmVirtPkg.dec > @@ -42,15 +42,19 @@ [Guids.common] > [Protocols] > gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } } > > -[PcdsFixedAtBuild, PcdsPatchableInModule] > +[PcdsFixedAtBuild.common, PcdsDynamic.common, PcdsPatchableInModule.common] > # > # This is the physical address where the device tree is expected to be stored > - # upon first entry into UEFI. This needs to be a FixedAtBuild PCD, so that we > - # can do a first pass over the device tree in the SEC phase to discover the > - # UART base address. > + # upon first entry into UEFI. In some cases this needs to be a FixedAtBuild > + # PCD, so that we can do a first pass over the device tree in the SEC phase > + # to discover the UART base address. In other cases where the base address > + # for the DT is passed in X0 (by an earlier firmware stage or by a virtual > + # machine manager), this needs to be a PcdsDynamic so that the value can be > + # updated. > # > gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0|UINT64|0x00000001 > > +[PcdsFixedAtBuild] > # > # Padding in bytes to add to the device tree allocation, so that the DTB can > # be modified in place (default: 256 bytes) > diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S > index 891cf1fcab400c0842035be6a2fb003bafd63040..b5f8c9dd3c6a2bd2c937ff3891b2f51be65094d4 100644 > --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S > +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S > @@ -1,5 +1,5 @@ > // > -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. > +// Copyright (c) 2011-2018, ARM Limited. All rights reserved. > // Copyright (c) 2015-2016, Linaro Limited. All rights reserved. > // > // This program and the accompanying materials > @@ -143,8 +143,13 @@ ASM_PFX(DiscoverDramFromDt): > // > cbnz x0, 0f > ldr x0, PcdGet64 (PcdDeviceTreeInitialBaseAddress) > + b 1f > > -0:mov x29, x30 // preserve LR > + // Store the device tree base address. > +0:adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress) > + str x0, [x8] > + > +1:mov x29, x30 // preserve LR > mov x28, x0 // preserve DTB pointer > mov x27, x1 // preserve base of image pointer > >