From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (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 B6CA381C5E for ; Wed, 14 Dec 2016 07:13:46 -0800 (PST) Received: by mail-it0-x241.google.com with SMTP id b123so288110itb.2 for ; Wed, 14 Dec 2016 07:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=APfaQED6i36rJ8TP26Bko1yjbCeUXRiS0GL7NfFNDuc=; b=tJzexD6OuvZaSARavjy7ZuhXg9w5Ho78pKsgb5dL/N9YGB6IdGjBgap/7auYiQxlcs n/TvsCQ0HKBqnMkbcBlWJ+cpSx+2jBDeUcIZJKosvE0bXIu6XMkwk2jNNqpfLZZ5racn M0n22TNKiur/ZbLFyJjCgmOitXtqVV6Zmj2Xn2jK0xesLYhSoUO3NrEr5bs/m6rwJScj Ya8KXq4R7Ql70rrCuHpsp4RwPQLivqop5Xyi7SKtgRkeRgpPNV+ZOz5MgY2yoII5p5XH na5x2tqnV+7Ue7m3Fz98Q8MVjFZ3A+e+RWR8kcPYGlHxzDRt/Xx8oD38JGEIftomA0y5 LFmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=APfaQED6i36rJ8TP26Bko1yjbCeUXRiS0GL7NfFNDuc=; b=cRoSHFmyjArwLYXcIT+KWMHm07h4TDdv4H9CnETZyXHlZTLevE7ZLs9CsFwaSnG3gk HqLpT1nmykiOrsfbOeTAYG2zKlkOzbIXRUuYR39hBUSMFFvy8LQmms/Kwc8O7bFmUMCD uBzLNCKQiMSqpjZGfChzUTIZxTkgMZlx8K3Y3NChmx7AgMS6JX9oT/PNQbilir/z/QWx lEtoUGryVBOuD3F7XZZk2RAQMbqvyBbaba9vLSDjishCJRySEYl+9Y1DxhJOzTdq/tig 0k78lT57G6c5FV+jsKkR4RwjTgnGMXN8RdSJWYE+JS6S2+lVOdPqHGfGoiOA4HWjvoqo v2UQ== X-Gm-Message-State: AKaTC01hqyAA+M/vO37RPVrLcnjR3dXRPo4UqQh8QXjKUhuY8XdIs8moTC9BA0X7UoDcyonQpRZ7minyKv6gFw== X-Received: by 10.28.111.70 with SMTP id k67mr7848168wmc.32.1481728425667; Wed, 14 Dec 2016 07:13:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.183.2 with HTTP; Wed, 14 Dec 2016 07:13:45 -0800 (PST) In-Reply-To: References: From: Michael Zimmermann Date: Wed, 14 Dec 2016 16:13:45 +0100 Message-ID: To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" Subject: Re: correct way to reserve memory from PrePi? 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: Wed, 14 Dec 2016 15:13:46 -0000 Content-Type: text/plain; charset=UTF-8 As far as I know the proper way is to create resource descriptors using BuildResourceDescriptorHob and then allocate reserved areas using BuildMemoryAllocationHob. This way I don't have any overlapping descriptors - I just allocated some memory very early. I ran many tests and it looks like all calls to BuildMemoryAllocationHob get ignored if my dram hobs look like this: 0x00000000 - 0x40000000 If I split this range into two Hob's like this everything seems to work just fine: 0x00000000 - 0x20000000 0x20000000 - 0x20000000 I took a look at other platforms like Juno and they add big dram Hob's (2GB and 6GB) too so why is this a problem? Thanks Michael On Wed, Dec 14, 2016 at 11:21 AM, Ard Biesheuvel wrote: > On 14 December 2016 at 10:02, Michael Zimmermann > wrote: >> I tried both BuildResourceDescriptorHob and BuildMemoryAllocationHob >> but apparently they don't have any effect. >> When I look at the output of the shell's memmap command there aren't >> any reserved/unavailable pages. >> >> Furthermore, when using AllocatePages with one of the physical >> addresses which I've reserved it succeeds which means that it's not >> just a problem of how the memmap command works. >> >> Am I doing something wrong or is this a bug? >> > > I think you need to ensure that they don't overlap existing resource > descriptors: if you declare a region as reserved, you should not > declare it as memory first