From patchwork Fri Apr 22 14:47:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 8912421 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7150BF29F for ; Fri, 22 Apr 2016 14:49:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC96920270 for ; Fri, 22 Apr 2016 14:49:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCE872020F for ; Fri, 22 Apr 2016 14:49:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1atcMv-0003Nd-Ue; Fri, 22 Apr 2016 14:47:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1atcMu-0003NQ-7r for xen-devel@lists.xen.org; Fri, 22 Apr 2016 14:47:40 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 47/BD-19343-B893A175; Fri, 22 Apr 2016 14:47:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeJIrShJLcpLzFFi42JxWrohUrfbUir cYN57LoslHxezODB6HN39mymAMYo1My8pvyKBNWPPnP2MBdPEKy7fv8LSwPhbuIuRk0NCwF/i 2J9GNhCbRUBV4lLbJzCbTcBAYsX0q4wgtoiArMSfzk8sIDazgLrEoj8LmUBsYQEzie1XVoLFe QWsJY4u64SyBSVOznwCVa8jsWA3yEwOIFtaYvk/DhBTVEBZ4u6yIJAKIQE1iRsLl7GAhCUEuC X+dttPYOSdhWTOLCRzZiHMWcDIvIpRvTi1qCy1SNdSL6koMz2jJDcxM0fX0MBYLze1uDgxPTU nMalYLzk/dxMjMJTqGRgYdzC+/ul0iFGSg0lJlPezplS4EF9SfkplRmJxRnxRaU5q8SFGGQ4O JQnecxZAOcGi1PTUirTMHGBQw6QlOHiURHhXgKR5iwsSc4sz0yFSpxgVpcR574IkBEASGaV5c G2wSLrEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSRhiCk9mXgnc9FdAi5mAFv+7IAmyuCQRIS XVwDhva+b0S2tPqsRzPZvlEsRuIdbJbqWx8YvegR7ND627Qvcsd3PrWPO0xF1wf+K0x+p+me5 z16yvmOUVJKz/JrKQeY/tGfMV/475qKrvMp+q+4Brbcu+S4+mGy1d/sWZ0Wf5668bnp+9aa3H 0/B4xaw//wQ5WNekbd/nX3pMa11zaUgS95OFn6yVWIozEg21mIuKEwEsC47VnwIAAA== X-Env-Sender: prvs=913a7397f=anthony.perard@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1461336457!28924730!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60787 invoked from network); 22 Apr 2016 14:47:38 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2016 14:47:38 -0000 X-IronPort-AV: E=Sophos;i="5.24,517,1454976000"; d="scan'208";a="349037981" Date: Fri, 22 Apr 2016 15:47:36 +0100 From: Anthony PERARD To: Message-ID: <20160422144736.GD1885@perard.uk.xensource.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-DLP: MIA1 Cc: Xen Devel Subject: [Xen-devel] OVMF broken under Xen (in PCI initialisation) X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Following the switch to MdeModulePkg/Bus/Pci/PciHostBridgeDxe, the pci root bridge does not finish to initialize and breaks under Xen. There are several issue probably due to the use of PcdPciDisableBusEnumeration=TRUE. First one: ASSERT MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c(99): Bridge->Mem.Limit < 0x0000000100000000ULL This patch would fix the first assert: That leads to one last assert: > QemuVideo: Cirrus 5446 detected > InstallProtocolInterface: 09576E91-6D3F-11D2-8E39-00A0C969723B 7B9EF598 > Adding Mode 0 as Cirrus Internal Mode 0: 640x480, 32-bit, 60 Hz > Adding Mode 1 as Cirrus Internal Mode 1: 800x600, 32-bit, 60 Hz > Adding Mode 2 as Cirrus Internal Mode 2: 1024x768, 24-bit, 60 Hz > PixelBlueGreenRedReserved8BitPerColor > ASSERT /local/home/sheep/work/ovmf/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c(1789): ((BOOLEAN)(0==1)) For this one, I've workaround by reverting patch 7b0a1ea (MdeModuelPkg/PciBus: Return AddrTranslationOffset in GetBarAttributes). That issue was introduce while still using the USE_OLD_PCI_HOST. Any idee or pointer on how to fix those issues ? Thanks, diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c index 7fa9019..15ec7a7 100644 --- a/OvmfPkg/PlatformPei/Xen.c +++ b/OvmfPkg/PlatformPei/Xen.c @@ -227,5 +227,11 @@ InitializeXen ( PcdSetBool (PcdPciDisableBusEnumeration, TRUE); + // Values from hvmloader +#define PCI_MEM_END 0xFC000000 +#define HVM_BELOW_4G_MMIO_START 0xF0000000 + PcdSet64 (PcdPciMmio32Base, HVM_BELOW_4G_MMIO_START); + PcdSet64 (PcdPciMmio32Size, PCI_MEM_END - HVM_BELOW_4G_MMIO_START); + return EFI_SUCCESS; } But that not enough, next assert is: ASSERT MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c(807): RootBridge != ((void *) 0) I have worked around this one with the following patch. That would correspond to how the former implementation in OvmfPkg was initializing the struct. Maybe a better way would be to fill ResAllocated under Xen, somehow. Under Xen, the ResAllocNode status is not allocated, so no Descriptor are created. diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c index cda9b49..eda92b6 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c @@ -1509,15 +1509,13 @@ RootBridgeIoConfiguration ( ResAllocNode = &RootBridge->ResAllocNode[Index]; - if (ResAllocNode->Status != ResAllocated) { - continue; - } - Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3; + if (ResAllocNode->Status != ResAllocated) { Descriptor->AddrRangeMin = ResAllocNode->Base; Descriptor->AddrRangeMax = ResAllocNode->Base + ResAllocNode->Length - 1; Descriptor->AddrLen = ResAllocNode->Length; + } switch (ResAllocNode->Type) {