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:29:34 -0700 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E2D530BA37D; Mon, 15 Apr 2019 13:29:32 +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 93409608C0; Mon, 15 Apr 2019 13:29:26 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 24/31] OvmfPkg/XenPlatformPei: Ignore missing PCI Host Bridge on Xen PVH 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-25-anthony.perard@citrix.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 15 Apr 2019 15:29:25 +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-25-anthony.perard@citrix.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 15 Apr 2019 13:29:32 +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: > When the device ID of the host bridge is unknown, check if we are > running as a PVH guest as there is no PCI bus in that case. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Anthony PERARD > --- > > Notes: > v2: > - Use new XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID macro > > OvmfPkg/Include/OvmfPlatforms.h | 6 ++++++ > OvmfPkg/XenPlatformPei/Platform.c | 7 +++++++ > 2 files changed, 13 insertions(+) > > diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatforms.h > index cc67f40a88..1ce71e18ec 100644 > --- a/OvmfPkg/Include/OvmfPlatforms.h > +++ b/OvmfPkg/Include/OvmfPlatforms.h > @@ -43,4 +43,10 @@ > // > #define ACPI_TIMER_OFFSET 0x8 > > +// > +// When running OVMF on a Xen PVH guest there is no PCI, > +// so -1 is return for the Host Bridge Device ID. > +// > +#define XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID 0xFFFF > + > #endif We split the i440fx and Q35 host bridge device IDs to separate files, under "OvmfPkg/Include/IndustryStandard/", in commit cb2e300766ae ("OvmfPkg: split Include/OvmfPlatforms.h", 2015-05-13). (1) I'd prefer if we could introduce the above macro similarly -- and include that header only in XenPlatformPei (plus wherever else it is necessary). Thanks! Laszlo > diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c > index 5e6d553ad5..d91cd98bf4 100644 > --- a/OvmfPkg/XenPlatformPei/Platform.c > +++ b/OvmfPkg/XenPlatformPei/Platform.c > @@ -278,6 +278,13 @@ MiscInitialization ( > AcpiEnBit = ICH9_ACPI_CNTL_ACPI_EN; > break; > default: > + if (XenPvhDetected ()) { > + // > + // There is no PCI bus in this case > + // > + PcdSet16S (PcdOvmfHostBridgePciDevId, XEN_PVH_PCI_HOST_BRIDGE_DEVICE_ID); > + return; > + } > DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", > __FUNCTION__, mHostBridgeDevId)); > ASSERT (FALSE); >