From nobody Fri Apr 26 13:25:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+85712+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85712+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1642152700; cv=none; d=zohomail.com; s=zohoarc; b=RJDCuuWKSZmJdk1I1bkrevQSZG+S8MZB6laJMkytKdZeMBku/T1CnS58qJY5Ad0M82p2ag346ZB+uK6XqIE/LVLJcC6HA3px3zh1oRV6Kx71miWQvsKolBBrTZY70Y8Y6dkHHCFpZkDBS0AAsyo/3O9R1sqCF0mA8Y9X8lnVI5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642152700; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=OaV0sD8CsVqCds6YR1jO2Tri22H392MmNl/rea25yI0=; b=MppnhchgLFUIYcTobCQPyDv7Kgnn4H9CWIlDcCWoZpfScfesgMmSl5FhpSd/8TJWhNKf23j6fky1TL7t9maOrzEniptR6OHrx1lKH8PZhdKvq8AWqWITbT6xVy5gWjjYXbMLIScv/9+aYweTj3mmmkaoSRsJbYuEaUNx6jf4w5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85712+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1642152700371982.5347048295954; Fri, 14 Jan 2022 01:31:40 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id w5xrYY1788612xEWtjEiGYzm; Fri, 14 Jan 2022 01:31:39 -0800 X-Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mx.groups.io with SMTP id smtpd.web08.5270.1642152696352512983 for ; Fri, 14 Jan 2022 01:31:38 -0800 X-Received: from kwepemi500003.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JZwwG5jP1z8wN9; Fri, 14 Jan 2022 17:28:46 +0800 (CST) X-Received: from kwepemm600004.china.huawei.com (7.193.23.242) by kwepemi500003.china.huawei.com (7.221.188.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 14 Jan 2022 17:31:31 +0800 X-Received: from kwephisprg16640.huawei.com (10.247.83.252) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 14 Jan 2022 17:31:30 +0800 From: "wenyi,xie via groups.io" To: , , , , CC: , , Subject: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/PciBucDxe:Fix issue when initial SR-IVO Date: Fri, 14 Jan 2022 17:31:25 +0800 Message-ID: <20220114093125.69742-2-xiewenyi2@huawei.com> In-Reply-To: <20220114093125.69742-1-xiewenyi2@huawei.com> References: <20220114093125.69742-1-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.247.83.252] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,xiewenyi2@huawei.com X-Gm-Message-State: X0vyEjeFfNNHldom7h4zKjc1x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1642152699; bh=B+xgTGGEB5CItsHe8eukyYdIlm2f3OPgSGTpjAK62Uc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=C3+96fZgGa58scEetFGxESMG9M0zmQ5UGcmmI7fLcyExKRPIuo6C5LrLPe35877SgVJ M/EyBU7K/dmaIUer7woiSp5dRcq4tGkhPw2P9w1aPluKB9H+x6Kf5OM9WQ7KPNArDd0Lj TQajgVBzOLEEQVs+jefpDR1HAG+0Td7PPUI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1642152701094100004 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reference:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3804 When calculating SR-IOV reserve bus in function CreatePciIoDevice(), there are two points may have problem. LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride; PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1); The first is that if the value of PciIoDevice->InitialVFs is 0, it will cause overflow, it's better to check InitialVFs before used. The second is that if number of bus is not enough for all PF and still allocate bus for VF, it will lead to PCI enumerating failure. Cc: Jian J Wang Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Wenyi Xie --- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 9251388bc268..a4d1db534276 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2402,12 +2402,12 @@ CreatePciIoDevice ( // Calculate LastVF // PFRid =3D EFI_PCI_RID (Bus, Device, Func); - LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * V= FStride; + LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs =3D=3D 0= ? 0 : PciIoDevice->InitialVFs - 1) * VFStride; =20 // // Calculate ReservedBusNum for this PF // - PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastVF)= - Bus + 1); + PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastVF)= - Bus); =20 DEBUG (( DEBUG_INFO, --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85712): https://edk2.groups.io/g/devel/message/85712 Mute This Topic: https://groups.io/mt/88417561/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-