public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Nong, Foster" <foster.nong@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 1/2] MdeModulePkg: Fixed extra 1 SR-IOV reserved bus
Date: Fri, 14 Oct 2022 03:03:10 +0000	[thread overview]
Message-ID: <MWHPR11MB16314C0E564291AFA63EF3C78C249@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221012023656.1565-1-foster.nong@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Foster Nong
> Sent: Wednesday, October 12, 2022 10:37 AM
> To: devel@edk2.groups.io
> Cc: Nong, Foster <foster.nong@intel.com>
> Subject: [edk2-devel] [PATCH v2 1/2] MdeModulePkg: Fixed extra 1 SR-IOV reserved bus
> 
> Below code will calculate the reserved bus number for the each PF.
> 
> Based on the VF routing ID algorithm, PFRid and LastVF in below code
> already sure that "All VFs and PFs must have distinct Routing IDs".
> PF will be assigned Routing ID based on secBusNumber, ReservedBusNum
> will add into SubBusNumber directly. So the SR-IOV device will be
> assigned bus range as SecBusNumber ~ (SubBusNumber=(SecBusNumber +
> ReservedBusNum)).
> Thus "+1" in below code will cause extra 1 bus, and introduce a bus hole.
> 
>  PFRid  = EFI_PCI_RID (Bus, Device, Func);
>  LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
>  PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) -
>  Bus + 1);
> 
> In SR-IOV spec, there is a note in section 2.1.2:
> Note: Bus Numbers are a constrained resource. Devices are strongly
> encouraged to avoid leaving “holes” in their Bus Number usage to avoid
> wasting Bus Numbers
> 
> So the issue can be fixed with below code change.
>   PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) -
>   Bus);
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4069
> 
> Signed-off-by: Foster Nong <foster.nong@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> index eb250f6f7b..bc20da1f38 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> @@ -2425,7 +2425,7 @@ CreatePciIoDevice (
>          //
> 
>          // Calculate ReservedBusNum for this PF
> 
>          //
> 
> -        PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);
> 
> +        PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus);
> 
>        }
> 
> 
> 
>        DEBUG ((
> 
> --
> 2.37.1.windows.1
> 
> 
> 
> 
> 


      parent reply	other threads:[~2022-10-14  3:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  2:36 [PATCH v2 1/2] MdeModulePkg: Fixed extra 1 SR-IOV reserved bus Foster Nong
2022-10-12  2:36 ` [PATCH v2 2/2] Fix bug on SRIOV ReservedBusNum when ARI enable Foster Nong
2022-10-14  3:03   ` [edk2-devel] " Ni, Ray
2022-10-14  6:26   ` Ni, Ray
2022-10-14  3:03 ` Ni, Ray [this message]

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=MWHPR11MB16314C0E564291AFA63EF3C78C249@MWHPR11MB1631.namprd11.prod.outlook.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