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::141; helo=mail-it1-x141.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x141.google.com (mail-it1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 F14FB211963F6 for ; Fri, 7 Dec 2018 04:48:45 -0800 (PST) Received: by mail-it1-x141.google.com with SMTP id b5so6840787iti.2 for ; Fri, 07 Dec 2018 04:48:45 -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=nBshGtikto/Xxys2Lmsg5/Z+UryDewhsG8cJEP1NXG8=; b=Ni939i0IZ/7S5mvRtfDdOIyky5cRoOB7RLZeTU4XAS2/P30grMKMQYAa9A/4S71BqW mVLwSMFM05b8PzSDcnwSGWmpA+b1cuIZliBrZz5VXJdHgG7guZ+P4rS8b+sWf1S+rt8x B02AdsGqDaWZp7uztOMB3lkWuWQYPUQQq0l4Q= 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=nBshGtikto/Xxys2Lmsg5/Z+UryDewhsG8cJEP1NXG8=; b=iYF85024+xfp8h389WJzth/behQR2lGSbnObFXI77h1iwIQR6Ppgl+uR3zYOpinkOR z6bn5ij/pcpZ085pYe7/D2XgM7fwtH8qCqCTU3FFU2kfrvhf0fMfomRqhrv8y0a2yMkr TmUUtPd+i0L9iVZbG9LsXm4BkJYhirbmHHkQbyNUQXWSErcksKgmySaFzrNKzb/adek8 pIUA/e3V+MZzDAFxfEeHEIq8gi56iHqQnjCl6rcxWi6vJysMWRMF1nhNDFplchd1PJEp VQJB4k7kiNqcW9HD8geg1e8MtqG17gBMGhuNga5XCYhYaNzVZP6at5OSlxQqDFjRezpr i+lQ== X-Gm-Message-State: AA+aEWZOK5Xlb8rBifCRCxOXTrOCbyl+dpbwwv6mBq1M1ECcGjE30j1m abcrFtmVwn6tX61abFZEiKj4UdIEEfjtvRoDxstEfQ== X-Google-Smtp-Source: AFSGD/XjEmfjV/pofMTNsDOaqZFWklY10vwbdT77sPbETUioNPT6ZEL94Z5ob7vY6pSx8gxF3XNdsCVFh718Bw4Goeg= X-Received: by 2002:a05:660c:4b:: with SMTP id p11mr1991379itk.71.1544186925236; Fri, 07 Dec 2018 04:48:45 -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:48:34 +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:48:46 -0000 Content-Type: text/plain; charset="UTF-8" On Fri, 7 Dec 2018 at 13:47, Ard Biesheuvel wrote: > > 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) Whoops, no you are right. That is Base not Base+Size, so indeed, Base should be below MAX_ALLOC_ADDRESS