From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 55E7121199553 for ; Wed, 12 Dec 2018 16:26:44 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2018 16:26:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,346,1539673200"; d="scan'208";a="117908042" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by orsmga002.jf.intel.com with ESMTP; 12 Dec 2018 16:26:42 -0800 Received: from pgsmsx111.gar.corp.intel.com ([169.254.2.232]) by PGSMSX104.gar.corp.intel.com ([169.254.3.117]) with mapi id 14.03.0415.000; Thu, 13 Dec 2018 08:26:41 +0800 From: "Chiu, Chasel" To: Ard Biesheuvel , "Ni, Ruiyu" CC: "Wu, Hao A" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists Thread-Index: AQHUkiyePM9fKj14SkuVJ4bmNRFECKV641EAgADs1DA= Date: Thu, 13 Dec 2018 00:26:40 +0000 Message-ID: <3C3EFB470A303B4AB093197B6777CCEC501F29FC@PGSMSX111.gar.corp.intel.com> References: <20181212151015.117308-1-ruiyu.ni@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjdjM2I2ODQtODg5OS00NjhkLTgzZGQtNDYwNGU4ZmMzNGUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ1l4Z1wvYkRFa29cL2JDU0U5QmRxMDJKRUdieHBhdzBYc2hGSTdFSjdsUmRCMVZDbVNzZU9GYWxiNmdtY0k5MUZcLyJ9 x-ctpclassification: CTP_NT x-originating-ip: [172.30.20.205] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2018 00:26:44 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard = Biesheuvel Sent: Thursday, December 13, 2018 2:17 AM To: Ni, Ruiyu Cc: Wu, Hao A ; edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no PC= I Option ROM exists On Wed, 12 Dec 2018 at 16:08, Ruiyu Ni wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1394 > > When there is no PCI option ROM exists, today's logic still creates=20 > virtual BAR for option ROM using Length =3D 0, Alignment =3D (-1). > It causes the final MEM32 alignment requirement is as big as=20 > 0xFFFFFFFF_FFFFFFFF. > > The patch fixes this issue by only creating virtual BAR for option ROM=20 > when there is PCI option ROM. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Chiu Chasel > Cc: Hao A Wu > Cc: Jian J Wang Tested-by: Ard Biesheuvel > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c=20 > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > index 7255bcfbbc..ee5c77147e 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > @@ -515,10 +515,12 @@ PciHostBridgeResourceAllocator ( > // All devices' Option ROM share the same MEM32 resource. > // > MaxOptionRomSize =3D GetMaxOptionRomSize (RootBridgeDev); > - RootBridgeDev->PciBar[0].BarType =3D PciBarTypeOpRom; > - RootBridgeDev->PciBar[0].Length =3D MaxOptionRomSize; > - RootBridgeDev->PciBar[0].Alignment =3D MaxOptionRomSize - 1; > - GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, PMem3= 2Bridge, Mem64Bridge, PMem64Bridge); > + if (MaxOptionRomSize !=3D 0) { > + RootBridgeDev->PciBar[0].BarType =3D PciBarTypeOpRom; > + RootBridgeDev->PciBar[0].Length =3D MaxOptionRomSize; > + RootBridgeDev->PciBar[0].Alignment =3D MaxOptionRomSize - 1; > + GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, PMe= m32Bridge, Mem64Bridge, PMem64Bridge); > + } > > // > // Create resourcemap by going through all the devices subject=20 > to this root bridge > -- > 2.16.1.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel