From patchwork Tue Aug 13 11:31:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11091973 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 1DFAC1823 for ; Tue, 13 Aug 2019 11:59:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ED3E285F9 for ; Tue, 13 Aug 2019 11:59:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0336E28628; Tue, 13 Aug 2019 11:59:27 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 92101285F9 for ; Tue, 13 Aug 2019 11:59:27 +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 1hxVR3-0000sU-Ow; Tue, 13 Aug 2019 11:57:53 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVR2-0000sI-PT for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 11:57:52 +0000 X-Inumbo-ID: 937c3e18-bdc1-11e9-8980-bc764e045a96 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 937c3e18-bdc1-11e9-8980-bc764e045a96; Tue, 13 Aug 2019 11:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565697472; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7l12ElqY2vgvbH4tbufHnMr8dyi9K16XNq6wO/NFnWo=; b=c3kYi+kEBBoHDAEWZRdh5CO/uufRH6yDqTT18JlauUEZg+ukbJMITupO pB2FG8aGG5687nGVppft+yFasrUTElhsdfj1dBo+zazvhUdnDNsFxu2MC 21lmE1bxDGFyZT+Clt4yxlI5X+cOlxko8eM9uDHnwZ71jjm0mSNkzcZxy E=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: tshFiBo75oKp6/rg1WM7Wix4AFcyxcizAtrq2i/DwpcajnSO3hYWKq3U1m+BYFL6B/zh9Euxry S3HNTDs9qjr+8vulASqOjH+pdaGVLJAEcwChjKfxWs7K46k4MLlg04ue6ObnLnTtlZidvEqMjJ KlmocxMGZ+bJPH7FN8QGvamY9fhbYsp22L9iMS/lHOv2P6oxVuzR2w+ur/xrkK/lQVV9+nj9iF hO4S9nysxmFP6Y1UN4lJ40i6mPKN4xfvgVTyje9zxZmXEji4dCtca9DE4pBfwRApLAtcwShXU2 mSI= X-SBRS: 2.7 X-MesageID: 4198435 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,381,1559534400"; d="scan'208";a="4198435" From: Anthony PERARD To: Date: Tue, 13 Aug 2019 12:31:08 +0100 Message-ID: <20190813113119.14804-25-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190813113119.14804-1-anthony.perard@citrix.com> References: <20190813113119.14804-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 24/35] 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 the VGA 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 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD Acked-by: Laszlo Ersek --- Notes: v3: - fix commit message OvmfPkg/XenPlatformPei/Xen.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c index c4506def9a..c41fecdc48 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); + LapicBase = PcdGet32 (PcdCpuLocalApicBaseAddress); LapicEnd = LapicBase + SIZE_1MB; AddIoMemoryRangeHob (LapicBase, LapicEnd); @@ -312,6 +318,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);