From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.8382.1670391144398532957 for ; Tue, 06 Dec 2022 21:32:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pgu6pR1G; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670391143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t10mF55ql2iPYn/5mn3bPHOhM2nLlu+rQ2iPz2/NfvM=; b=Pgu6pR1Gc6F+KcDjSj+Dvamz7v0C/Z1dXYQ2XYcxw3U+WPdoE6zHx0Hp1KBe4btrxazGKE EZvdYZTEgTT4OkPAiBi6+IT/0oyWAKcLuPbc0DVnyBwu019Q22XBppU8vRZKb+JuwdENDN P6TuFBRKfYiMPzLG5HaTZbmhhDoH/Ks= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-508-gZr6VsGlOjqKUF3ztWdKFg-1; Wed, 07 Dec 2022 00:32:22 -0500 X-MC-Unique: gZr6VsGlOjqKUF3ztWdKFg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A38791C051AD; Wed, 7 Dec 2022 05:32:21 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F2042166B26; Wed, 7 Dec 2022 05:32:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2F1241800D41; Wed, 7 Dec 2022 06:32:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , Gerd Hoffmann , Ard Biesheuvel , Jordan Justen , Jiewen Yao , Pawel Polawski Subject: [PATCH 1/1] OvmfPkg/PlatformInitLib: pass through reservations from qemu Date: Wed, 7 Dec 2022 06:32:15 +0100 Message-Id: <20221207053215.2527430-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true qemu uses the etc/e820 fw_cfg file not only for memory, but also for reservations. Handle reservations by adding resource descriptor hobs for them. A typical qemu configuration has a small reservation between lapic and flash: # sudo cat /proc/iomem [ ... ] fee00000-fee00fff : Local APIC feffc000-feffffff : Reserved <= HERE ffc00000-ffffffff : Reserved [ ... ] Signed-off-by: Gerd Hoffmann --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c index b8feae4309de..a7a4e028ad50 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -228,6 +228,22 @@ PlatformScanOrAdd64BitE820Ram ( )); } } + } else if (E820Entry.Type == EfiAcpiAddressRangeReserved) { + if (AddHighHob) { + DEBUG (( + DEBUG_INFO, + "%a: Reserved: Base=0x%Lx Length=0x%Lx\n", + __FUNCTION__, + E820Entry.BaseAddr, + E820Entry.Length + )); + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_RESERVED, + 0, + E820Entry.BaseAddr, + E820Entry.Length + ); + } } } -- 2.38.1