From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 15 Apr 2019 06:21:45 -0700 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4042930ADBB6; Mon, 15 Apr 2019 13:21:37 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-136.rdu2.redhat.com [10.10.121.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 254145C1B4; Mon, 15 Apr 2019 13:21:33 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 23/31] OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux To: devel@edk2.groups.io, anthony.perard@citrix.com Cc: Jordan Justen , Ard Biesheuvel , Julien Grall , xen-devel@lists.xenproject.org References: <20190409110844.14746-1-anthony.perard@citrix.com> <20190409110844.14746-24-anthony.perard@citrix.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 15 Apr 2019 15:21:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190409110844.14746-24-anthony.perard@citrix.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 15 Apr 2019 13:21:42 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 04/09/19 13:08, Anthony PERARD wrote: > Linux panic if this region isn't reserved. Please expand "this" (just copy from the subject). with that, Acked-by: Laszlo Ersek Thanks Laszlo > > When Linux is booted on EFI system, it expects the memory at 0xa0000 to > _not_ be conventional memory. Otherwise a variable isn't initialised > properly and Linux panic when a virtual console/terminal is asked to be > created. > > See for more detail: > https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg02139.html > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Anthony PERARD > --- > OvmfPkg/XenPlatformPei/Xen.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c > index 7b503f2c4e..25f12c2f9c 100644 > --- a/OvmfPkg/XenPlatformPei/Xen.c > +++ b/OvmfPkg/XenPlatformPei/Xen.c > @@ -294,6 +294,12 @@ XenPublishRamRegions ( > Status = XenGetE820Map (&E820Map, &E820EntriesCount); > ASSERT_EFI_ERROR (Status); > > + AddMemoryBaseSizeHob (0, 0xA0000); > + // > + // Video memory + Legacy BIOS region, to allow Linux to boot. > + // > + AddReservedMemoryBaseSizeHob (0xA0000, BASE_1MB - 0xA0000, TRUE); > + > for (Index = 0; Index < E820EntriesCount; Index++) { > UINT64 Base; > UINT64 End; > @@ -307,6 +313,16 @@ XenPublishRamRegions ( > Base = ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE); > End = (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK; > > + // > + // Ignore the first 1MB, this is handled before the loop. > + // > + if (Base < BASE_1MB) { > + Base = BASE_1MB; > + } > + if (Base >= End) { > + continue; > + } > + > switch (Entry->Type) { > case EfiAcpiAddressRangeMemory: > AddMemoryRangeHob (Base, End); >