From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Nong, Foster" <foster.nong@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg: Handle InitialVFs=0 case for SR-IOV
Date: Fri, 30 Sep 2022 02:57:37 +0000 [thread overview]
Message-ID: <MWHPR11MB1631AEB36C590B8D34A1FBB88C569@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <5f9999143741b8741a2978056390f6f3f728fe31.1664442988.git.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: Thursday, September 29, 2022 5:20 PM
> To: devel@edk2.groups.io
> Cc: Nong, Foster <foster.nong@intel.com>
> Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Handle InitialVFs=0 case for SR-IOV
>
> Per the section 3.3.5 SR-IOV spec v1.1, InitialVFs (0ch).
> InitialVFs indicates to SR-PCIM the number of VFs that are initially associated with the PF.
> The minimum value of InitialVFs is 0.
>
> Below code is used to calculate SR-IOV reserved bus number,
> if InitialVFs =0, it maybe calculate the wrong bus number in this case.
> LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride
>
> we can fix it with below code:
> if (PciIoDevice->InitialVFs == 0) {
> PciIoDevice->ReservedBusNum = 0;
> } else {
> PFRid = EFI_PCI_RID (Bus, Device, Func);
> LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
> //
> // Calculate ReservedBusNum for this PF
> //
> PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);
> //
> // Calculate ReservedBusNum for this PF
> //
> PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);
> }
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=4069
>
> Signed-off-by: Foster Nong <foster.nong@intel.com>
> ---
> .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> index 509f828b621d..eb250f6f7b62 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> @@ -2416,13 +2416,17 @@ CreatePciIoDevice (
> //
> // Calculate LastVF
> //
> - PFRid = EFI_PCI_RID (Bus, Device, Func);
> - LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
> + if (PciIoDevice->InitialVFs == 0) {
> + PciIoDevice->ReservedBusNum = 0;
> + } else {
> + PFRid = EFI_PCI_RID (Bus, Device, Func);
> + LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
>
> - //
> - // Calculate ReservedBusNum for this PF
> - //
> - PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);
> + //
> + // Calculate ReservedBusNum for this PF
> + //
> + PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);
> + }
>
> DEBUG ((
> DEBUG_INFO,
> --
> 2.37.1.windows.1
>
>
>
>
>
prev parent reply other threads:[~2022-09-30 2:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1664442988.git.foster.nong@intel.com>
2022-09-29 9:20 ` [PATCH 1/1] MdeModulePkg: Handle InitialVFs=0 case for SR-IOV Foster Nong
2022-09-30 2:57 ` 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=MWHPR11MB1631AEB36C590B8D34A1FBB88C569@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