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.web09.167.1631794863351462318 for ; Thu, 16 Sep 2021 05:21:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FAbN6fuE; 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=1631794862; 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: in-reply-to:in-reply-to:references:references; bh=doAvjSL55Uj+1P944gzixJnde4tqZPCC7j2k5/AdYCQ=; b=FAbN6fuEYWaB7FmKZOM8zF1dzOVtd1Jl8HXxNlOgpzQGVtncXl/Wrw04OlnmwEC9LKMHmm Imyvkg/XcNpGtjr7qDNynnbuogxa4hgcYbCjmlUNYCUWAr558Vd5KB2FOo0kHJX8YJbBZd fG9GgmprgwhNoF6ZJ4rxSNO9oA6A738= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-Rfe7mz0oMRK4ek0_GAmlYg-1; Thu, 16 Sep 2021 08:21:01 -0400 X-MC-Unique: Rfe7mz0oMRK4ek0_GAmlYg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9E7F824FA7; Thu, 16 Sep 2021 12:20:59 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AB583AC0; Thu, 16 Sep 2021 12:20:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A948E18009D6; Thu, 16 Sep 2021 14:20:27 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Gerd Hoffmann , Jiewen Yao , Julien Grall , Stefan Berger , Leif Lindholm , Ard Biesheuvel , Andrew Fish , Michael D Kinney , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Anthony Perard , Jiewen Yao Subject: [PATCH v4 12/20] OvmfPkg/Microvm: PlatformPei/MemDetect tweaks Date: Thu, 16 Sep 2021 14:20:19 +0200 Message-Id: <20210916122027.2352393-13-kraxel@redhat.com> In-Reply-To: <20210916122027.2352393-1-kraxel@redhat.com> References: <20210916122027.2352393-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Set mHostBridgeDevId to MICROVM_PSEUDO_DEVICE_ID using a compile time switch. Skip host bridge setup on microvm. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599 Signed-off-by: Gerd Hoffmann Acked-by: Jiewen Yao --- OvmfPkg/Microvm/MicrovmX64.dsc | 3 +++ OvmfPkg/PlatformPei/MemDetect.c | 5 +++++ OvmfPkg/PlatformPei/Platform.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 019b50de7d8f..a000c195d866 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -73,6 +73,9 @@ [Defines] !endif [BuildOptions] + GCC:*_*_*_CC_FLAGS = -DPLATFORM_IS_MICROVM + INTEL:*_*_*_CC_FLAGS = /D PLATFORM_IS_MICROVM + MSFT:*_*_*_CC_FLAGS = /D PLATFORM_IS_MICROVM GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 2c2c4641ec8a..8125644bc91a 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -15,6 +15,7 @@ Module Name: // #include #include +#include #include #include #include @@ -135,6 +136,10 @@ QemuUc32BaseInitialization ( UINT32 LowerMemorySize; UINT32 Uc32Size; + if (mHostBridgeDevId == MICROVM_PSEUDO_DEVICE_ID) { + return; + } + if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) { // // On q35, the 32-bit area that we'll mark as UC, through variable MTRRs, diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index d3a20122a2ea..ed93d11c8ac6 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -714,7 +715,11 @@ InitializePlatform ( // // Query Host Bridge DID // +#ifdef PLATFORM_IS_MICROVM + mHostBridgeDevId = MICROVM_PSEUDO_DEVICE_ID; +#else mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID); +#endif MaxCpuCountInitialization (); -- 2.31.1