From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::d42; helo=mail-io1-xd42.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 5BF8D21962301 for ; Fri, 7 Dec 2018 04:47:55 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id f14so3150792iol.4 for ; Fri, 07 Dec 2018 04:47:55 -0800 (PST) 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; bh=ZVSzRCz20WHlboiWYhiPFen6Q2Xo76w/7sJQ572v/vU=; b=MnEkqF5799PUYRCUtoHMP1DgSC1Adqt5oa+vzgNWbOAHf4tI2+VTDwkdy8ikX8NMQt NXxxvGWrGkCJ+C5pxao/Jzt2E+t3sjxhUaSJqd+DAjF5In6vjgF7kkcz75nGVZCOXLgT OOO0f/wHCDQY586yce71g+eUWrmLVGlkNmyVM= 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; bh=ZVSzRCz20WHlboiWYhiPFen6Q2Xo76w/7sJQ572v/vU=; b=O2l4d+vu39AYswTxqxdyPWmA9g4zw13iPNtZLXLp+BxKdPyjcohct+UG+8ILOM9o9s B1kAXmQGZ++8ul5aVkv5v6kLHDFu32qh2cDZ/uvu9I8j5gUc2vc0HEJ+A/DsMFcg4KqU pp8m6Pd6twBnMgFn5JqogYGwo1UYWrA0EFk1q/thTQWPRmRweupbcBxwI212VuMmb98v eo27fsYvIUTYX9nIWGARDxS+sSHcqmbKlEiCElB+vOe+H7PQ/+wSBsfooH6Mx16t1j4F /N4XQjJMe8Zty6zLl4lMSqGezLLFnkwlefSe7jRUIwHUzllFbsILhUvCN0hwpWJvIIx2 CYAw== X-Gm-Message-State: AA+aEWY6BG/6HFf2ADa5s0IT8l4YJEs+YD+WenfJ79dtnAcpOresLA3i ZuoCIBt1i51lJJjW1qsH3FCQfdZd6f1KvzPYqFitEA== X-Google-Smtp-Source: AFSGD/WKuvj1nlo4dRfKMzGQrtoV+eJope9ag+zT8fHVS+/Urds4Dc0jdqhRxzj8lask/qImRp33+P/537FIVtZEEFk= X-Received: by 2002:a6b:5d01:: with SMTP id r1mr1415062iob.170.1544186875305; Fri, 07 Dec 2018 04:47:55 -0800 (PST) MIME-Version: 1.0 References: <20181207112304.19765-1-ard.biesheuvel@linaro.org> <20181207112304.19765-6-ard.biesheuvel@linaro.org> In-Reply-To: From: Ard Biesheuvel Date: Fri, 7 Dec 2018 13:47:44 +0100 Message-ID: To: Laszlo Ersek Cc: "edk2-devel@lists.01.org" , "Kinney, Michael D" , "Gao, Liming" , Jian J Wang , "Wu, Hao A" , Leif Lindholm , Auger Eric , Andrew Jones , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Subject: Re: [RFC PATCH 5/7] ArmPlatformPkg/MemoryInitPeim: take MAX_ALLOC_ADDRESS into account 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: Fri, 07 Dec 2018 12:47:56 -0000 Content-Type: text/plain; charset="UTF-8" On Fri, 7 Dec 2018 at 13:46, Laszlo Ersek wrote: > > On 12/07/18 12:23, Ard Biesheuvel wrote: > > Limit the PEI memory region so it will not extend beyond what we can > > address architecturally when running with 4 KB pages. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ard Biesheuvel > > --- > > ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c > > index 389a2e6f1abd..25db87fb2374 100644 > > --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c > > +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c > > @@ -109,8 +109,8 @@ InitializeMemory ( > > > > SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase); > > SystemMemoryTop = SystemMemoryBase + PcdGet64 (PcdSystemMemorySize); > > - if (SystemMemoryTop - 1 > MAX_ADDRESS) { > > - SystemMemoryTop = (UINT64)MAX_ADDRESS + 1; > > + if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) { > > + SystemMemoryTop = (UINT64)MAX_ALLOC_ADDRESS + 1; > > } > > FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress); > > FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); > > > > Shouldn't you also update > > ASSERT (PcdGet64 (PcdSystemMemoryBase) < (UINT64)MAX_ADDRESS); > > just above the context visible here? > No, it's fine for PcdSystemMemoryBase/PcdSystemMemorySize to describe a region we cannot access in its entirety, as long as we don't use the top part (See the next patch as well)