From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 91EAC21D147CB for ; Tue, 11 Jul 2017 06:08:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 220803345BE; Tue, 11 Jul 2017 13:10:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 220803345BE Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 220803345BE Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-201.phx2.redhat.com [10.3.116.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 531601836C; Tue, 11 Jul 2017 13:10:40 +0000 (UTC) To: Igor Mammedov Cc: edk2-devel-01 , "Dr. David Alan Gilbert" , Gerd Hoffmann , Jordan Justen References: <20170711032231.29280-1-lersek@redhat.com> <20170711032231.29280-2-lersek@redhat.com> <20170711103852.37fb455d@nial.brq.redhat.com> From: Laszlo Ersek Message-ID: <4948cf63-0a3b-589c-edc1-8962439ce74a@redhat.com> Date: Tue, 11 Jul 2017 15:10:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170711103852.37fb455d@nial.brq.redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Jul 2017 13:10:44 +0000 (UTC) Subject: Re: [PATCH 1/1] OvmfPkg/PlatformPei: support >=1TB high RAM, and discontiguous high RAM X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 13:08:58 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 07/11/17 10:38, Igor Mammedov wrote: > On Tue, 11 Jul 2017 05:22:31 +0200 > Laszlo Ersek wrote: > >> In OVMF we currently get the upper (>=4GB) memory size with the >> GetSystemMemorySizeAbove4gb() function. >> >> The GetSystemMemorySizeAbove4gb() function is used in two places: >> >> (1) It is the starting point of the calculations in GetFirstNonAddress(). >> GetFirstNonAddress() in turn >> - determines the placement of the 64-bit PCI MMIO aperture, > that's probably broken in memory hotplug case as > the first usable PCI MMIO address is at fwcfg("etc/reserved-memory-end") No, it's not broken :) I wrote above, "starting point of the calculations". The fw_cfg file "etc/reserved-memory-end" is specifically considered already. (You explained that file to me when I previously worked on this code, in 2016Q1 or so.) It's just a later point in the calculation. > though the file exists only when memory hotplug is enabled > ( to make life of FW writers harder :/ ) No problem, OVMF deals with "etc/reserved-memory-end" being either present or absent. Basically the GetFirstNonAddress() function performs a "cascade of increases" upwards, for determining the highest address plus one (i.e., the first non-address). If you'd like to see the full function (with this patch applied), it starts at: https://github.com/lersek/edk2/blob/highram1tb/OvmfPkg/PlatformPei/MemDetect.c#L292 It is heavily commented. Thanks! Laszlo