From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (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 7E8BB1A1E3A for ; Mon, 24 Oct 2016 05:21:48 -0700 (PDT) Received: by mail-qk0-x22f.google.com with SMTP id o68so234743047qkf.3 for ; Mon, 24 Oct 2016 05:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qKMfPhy9z3+0wj3DmNhOBPElpvkrtgG8l7Q55XsJ5Jo=; b=bzsO34tENf8GA4Tg/n2/EQetmRTGqKU3ze6XyRP2JYpDe+C/ITUYCupr+PAJTLRc9o qBTPRnB4CxGD4Itd7sPz2DkPhEKVOJfEfYNLys4LRDJwdKK91woiwYnQpbz/hGsV29LG B267Gux+KWFbNh2ARkFgKugWsSUukL4Hxau60= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qKMfPhy9z3+0wj3DmNhOBPElpvkrtgG8l7Q55XsJ5Jo=; b=IP4JW6PBcdo4InNUEKCbKUbZ8MQnKDJBXnLOEZWG/mrTHcYzRGoWgVFIGNnzikW1ab ecOmo8+RYMn2g9t7lrW4Vi8V7NBLJvjQ/sLj0geDKkUfYrFP/fIbxwVD+WJnmJ15gBYw 7DUx8UCDYN5J/LmVa1RWm29gSq8RNDsTVm5LSXH4x55kl6Idqtq2OZf36YutH3zyxEF1 WGIH3a/KW2pXj/iHbBUlEHeu2hWuofsWFveazygI9DA3TgL7qRXyPG+oQgIw6u51bu/m vPvGY2GVKtH7jrieoHGUsHXvDLyOkVRVRh9WG6lHJJThR61MZ8HEVvPOx4ZiC6qw69bZ YN0Q== X-Gm-Message-State: ABUngvfLWr8WnU5blKq/NyP1zVgPJ9cvWcLCstqNYMY4O85h/Q428z8NLOswUEvy6Sjw3j/8CnDarV8mI8gG4+o1 X-Received: by 10.107.28.148 with SMTP id c142mr11787583ioc.45.1477311707277; Mon, 24 Oct 2016 05:21:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.5.139 with HTTP; Mon, 24 Oct 2016 05:21:46 -0700 (PDT) In-Reply-To: References: <1477299443-9324-1-git-send-email-ard.biesheuvel@linaro.org> <1477299443-9324-2-git-send-email-ard.biesheuvel@linaro.org> From: Ard Biesheuvel Date: Mon, 24 Oct 2016 13:21:46 +0100 Message-ID: To: Ryan Harkin Cc: edk2-devel-01 , Leif Lindholm , Laszlo Ersek , Heyi Guo Subject: Re: [PATCH 2/2] ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 12:21:48 -0000 Content-Type: text/plain; charset=UTF-8 On 24 October 2016 at 13:05, Ryan Harkin wrote: > On 24 October 2016 at 09:57, Ard Biesheuvel wrote: >> The global variable mSystemMemoryEnd is initialized by PrePi only if >> it has not been initialized by ArmPlatformPeiBootAction(). This allows >> platforms executing under, e.g., ARM Trusted Firmware to dynamically >> reserve a window at the top of memory that will be used by the secure >> firmware. >> >> However, PrePi is a SEC module, and writing to a global variable >> violates the SEC constraints, since SEC and PEI may execute from NOR >> flash. >> >> So instead, initialize mSystemMemoryEnd statically. This will ensure >> it holds the correct value for all implementations where the value >> is not overridden, but still allows it to be overridden during the >> call to ArmPlatformPeiBootAction(). >> >> Note that this patch also fixes a latent bug on 32-bit platforms where >> a value of mSystemMemoryEnd exceeding 4 GB would be truncated to 32-bits >> rather than limited to (4 GB - 1) >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel > > I tested this successfully on FVP Foundation & AEMv8 models, Juno > R0/1/2 and TC2. > > Tested-by: Ryan Harkin > Many thanks!