public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Ni, Ruiyu" <ruiyu.ni@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists
Date: Thu, 13 Dec 2018 00:26:40 +0000	[thread overview]
Message-ID: <3C3EFB470A303B4AB093197B6777CCEC501F29FC@PGSMSX111.gar.corp.intel.com> (raw)
In-Reply-To: <CAKv+Gu-FBvREmDWxPw7pV36D1nDBOeELLSo8HQ2OCh0b+mioVg@mail.gmail.com>


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

-----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 <ruiyu.ni@intel.com>
Cc: Wu, Hao A <hao.a.wu@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists

On Wed, 12 Dec 2018 at 16:08, Ruiyu Ni <ruiyu.ni@intel.com> wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1394
>
> When there is no PCI option ROM exists, today's logic still creates 
> virtual BAR for option ROM using Length = 0, Alignment = (-1).
> It causes the final MEM32 alignment requirement is as big as 
> 0xFFFFFFFF_FFFFFFFF.
>
> The patch fixes this issue by only creating virtual BAR for option ROM 
> when there is PCI option ROM.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Chiu Chasel <chasel.chiu@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>

Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c 
> 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 = GetMaxOptionRomSize (RootBridgeDev);
> -      RootBridgeDev->PciBar[0].BarType   = PciBarTypeOpRom;
> -      RootBridgeDev->PciBar[0].Length    = MaxOptionRomSize;
> -      RootBridgeDev->PciBar[0].Alignment = MaxOptionRomSize - 1;
> -      GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, PMem32Bridge, Mem64Bridge, PMem64Bridge);
> +      if (MaxOptionRomSize != 0) {
> +        RootBridgeDev->PciBar[0].BarType   = PciBarTypeOpRom;
> +        RootBridgeDev->PciBar[0].Length    = MaxOptionRomSize;
> +        RootBridgeDev->PciBar[0].Alignment = MaxOptionRomSize - 1;
> +        GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, PMem32Bridge, Mem64Bridge, PMem64Bridge);
> +      }
>
>        //
>        // Create resourcemap by going through all the devices subject 
> 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


  reply	other threads:[~2018-12-13  0:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 15:10 [PATCH] MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists Ruiyu Ni
2018-12-12 18:17 ` Ard Biesheuvel
2018-12-13  0:26   ` Chiu, Chasel [this message]
2018-12-13  1:39 ` Wang, Jian J
2018-12-13 12:48 ` Wu, Hao A
2018-12-14 14:16 ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C3EFB470A303B4AB093197B6777CCEC501F29FC@PGSMSX111.gar.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox