From patchwork Mon Apr 8 14:24:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 10889627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0CBA139A for ; Mon, 8 Apr 2019 14:29:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A37220748 for ; Mon, 8 Apr 2019 14:29:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E85F286B2; Mon, 8 Apr 2019 14:29:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2CAD420748 for ; Mon, 8 Apr 2019 14:29:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDVG5-0002iY-Lo; Mon, 08 Apr 2019 14:28:25 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hDVG4-0002gP-6F for xen-devel@lists.xenproject.org; Mon, 08 Apr 2019 14:28:24 +0000 X-Inumbo-ID: 900c5504-5a0a-11e9-92d7-bc764e045a96 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 900c5504-5a0a-11e9-92d7-bc764e045a96; Mon, 08 Apr 2019 14:28:22 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,325,1549929600"; d="scan'208";a="83010383" From: Anthony PERARD To: Date: Mon, 8 Apr 2019 15:24:00 +0100 Message-ID: <20190408142408.30419-24-anthony.perard@citrix.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190408142408.30419-1-anthony.perard@citrix.com> References: <20190408142408.30419-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 23/31] OvmfPkg/XenPlatformPei: Reserve VGA memory region, to boot Linux X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , Jordan Justen , Julien Grall , Anthony PERARD , xen-devel@lists.xenproject.org, Laszlo Ersek Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Linux panic if this region isn't reserved. 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);