From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.1607.1664506660668034608 for ; Thu, 29 Sep 2022 19:57:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=IgU1MWTC; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664506660; x=1696042660; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=RRKnbKZmwUEYu2kMhj+lY48lqL1V++e0TNy7hLJ7Wl8=; b=IgU1MWTC65YwQaCWIAz0h4WV184vRRByJeo0Pi7PZcrPCtWWGq78ZWcP nAS+lU0+a0wHI7kv6tt6WkGkglKxjJrkWbnh/WQYR5uvoTROqtqy0PL4R raLt50/DqzuRBCcxC9j/CBeh/4V65WZIO2q6l6pLmBrdx1lwjngSEJ09r +cmZf8laI0ipAR2BNV9TgMlwz1+q3iYKMTI1wybJefUzTJpWwplY4REOu Z7Fh0/v+GFwpb74oKFi+G9JTxFoO9tHvx5VrP6NC4mtTTbcuWgFOAKPC0 utUQhhhxavoz9bp3iaMP4RIIUzyRK/TP9UZPxCPaX9h7sqwOJBCWXEm/0 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="303574428" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="303574428" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 19:57:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="867649055" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="867649055" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 29 Sep 2022 19:57:39 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 19:57:39 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 19:57:38 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 29 Sep 2022 19:57:38 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 29 Sep 2022 19:57:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgxV8ZxLDEb3a63kJSiThQ5OvOlf4SKfEkZSnetBraqImz5kD9ZmDf2sA2hBwLN0+FJRJ0Q5lCGhAxCIHLr+oZwXQhvrL4z3t+ZAJHlmjZFs/7HW+MSTraAjAensiKiogLYh5V9KYCMeL/HXV9Eh9UD8q1h7IuSqt0XeptS1H/em3pboxQ6Q+U+RVQ00kVCFYo3y02nMM9HOhblYIkz/g3fIbi4tfOi4GhApcyYfQ0hbhOamnBzKmh0ah7HZkwgg6HKN85Xcq8k+871TeK901gOkGkEE5bP6HOxlXTTglo8srY1ua/TCezDaikajLF7rN0TfxWAtOC7+RWaPI8Doig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HTfOzn+bjt01sZSNLVy0Oq3kfr1TpvJ8TOb1GqeAMYo=; b=ATIHWJw8l6uiOB4MYNYyGYhNidwTY/VIFkp2AOdZMl6yVs6eK/E2rZBuNqqwyaNWUjRAUtU1JI39XvYebBEOaOrC9KxRnVKOdgHptzb/evpVjYLboKRQl5PxLqyPUnLAhI1OytjmSwO/3SdL4eI1bKuRZbWS3exjjvoiL8f9X3UPWwRrlXHhfKx4h0WGOvB+NFdxgvpzFF8rEGTA8xKuXWYMfpC0qCnyXw3tV9nzZ1acFZ0cF3VaLdqeQyFY3XP8vnJGcBydtv9JTwqW76BAj5/JiNlTLBvMXnHH6V4ZjP0pgHMIH57GpM6Fi4vI14XDT7BAS3w4flbSxlBbdZlV/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by SJ0PR11MB4959.namprd11.prod.outlook.com (2603:10b6:a03:2de::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 02:57:37 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::483f:4bb5:a15f:f571]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::483f:4bb5:a15f:f571%11]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 02:57:37 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Nong, Foster" CC: "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg: Handle InitialVFs=0 case for SR-IOV Thread-Topic: [edk2-devel] [PATCH 1/1] MdeModulePkg: Handle InitialVFs=0 case for SR-IOV Thread-Index: AQHY1GMSYyWa+zfdPkWslXbg4Yv4FK33R8eA Date: Fri, 30 Sep 2022 02:57:37 +0000 Message-ID: References: <5f9999143741b8741a2978056390f6f3f728fe31.1664442988.git.foster.nong@intel.com> In-Reply-To: <5f9999143741b8741a2978056390f6f3f728fe31.1664442988.git.foster.nong@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MWHPR11MB1631:EE_|SJ0PR11MB4959:EE_ x-ms-office365-filtering-correlation-id: d5ebd0e2-dc61-40fa-a0bf-08daa28f87f1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ScDHUAChJbLihgZ6VHBod5zIEIX127tMzJ4W4w/9MdpCQNgSThCwTWIS3FnxAd6v1GBlpTj1iGRVrUZwCL5Icok3ukdE8SPVKWOl5bI2Q8juovMlsLFayHIV/Jpl4l4OdFe58xrEpT4Temlij3XmOK2O5JGD9/87CuowZl/bIVs0UrVXEtXobw8ZjbXEQ0Orlc2wUeRpRVth3f8diTIasbElDTYhdlTrJfcYyBdhZGyIxyXMV3c2qYrfgdaJV/mWDdaqVbaYSF3hkL8oL/W7ma3P6cnp77PGu8QB04uN9a0/Jy8RhNcSXcc3BtOO/bwDSe0wR19F5QBTKAa6OYPb/W/xGJFvh5KRXAmueT3UPy7ai5qqFA+Nwcvlxtbx4fNEsDSs6//ENxoWNECo6YszwX9Us1u6N9ZopYqEgDexZjcULxUgr+vttjewbuvAXNODxs2XO6AMAojCg/87XeH7WQf17u3kUQa2tfHLTSSiQwAVNJwEqCTK9VVq3W2A5nkribzolBOWsdlw35tjeQ7Q9MOHOHZraoNPYs3r50nnkd/AM6SnsgbfelJ47y2N6pF4+grPNSLB69t5oGuWr748tDP/8yRCsbUJktbghzm39L24b4RmKmu9O/tHSuRM1TIUqRr6Kyk8bMyb/xqPTVKJCoggODMFfBKeZ+AKQvq9ieYUctnzQH06d9Frx1CjPstllHKfzTwVQ/j98dhjDMxqA74QmeuxM88wWHf/b+K50Tp/fqFrmigen5+B3iLywj4oYynviM0TIsfhEKa3t+OhQ356FoOKjw2rk7NmcASnGgOQ+R6EQWZR7AbL6NDR1YOY4AUGiQrDR6k1+pQx9WfOcg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(376002)(346002)(396003)(366004)(136003)(451199015)(66899015)(316002)(71200400001)(110136005)(64756008)(66446008)(66476007)(66556008)(966005)(76116006)(66946007)(5660300002)(8936002)(52536014)(8676002)(4326008)(6636002)(41300700001)(7696005)(6506007)(478600001)(53546011)(26005)(9686003)(107886003)(82960400001)(38070700005)(83380400001)(2906002)(186003)(38100700002)(33656002)(55016003)(86362001)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wfTG1wwJBU0urCrUSmjSeq1DJdua7mru5dvMINivF7mBuyPQGitmeQm3wjns?= =?us-ascii?Q?QmxV2uILYwmy63Sx+KnWGLceEWvDS7UNCfk/XpDiFEHNd+LH1ZhvVCTTyYsO?= =?us-ascii?Q?RXRoArxIp9/s8W649+MdCbiorw7Hz5V95vVdviKJEepmdws8TohJmOlLbTsB?= =?us-ascii?Q?6ovk9j2LMWJsSzLyIJeDjgexzZTcyFGIIRCcpAkaSr43txDygZI5CaiRTPcI?= =?us-ascii?Q?XwE6amLcYTK1COeOJMG6qDBLUlEHapL4iPoBoBxq7cqEtkDyxt5tWe7/oKeq?= =?us-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uVNKonznLYfSw02M2g/L8gT6Yb1uy?= =?us-ascii?Q?SqodiAvoZpoj7cmRXuA6v6PMkC0AdpBKGMAf9ucdg4p6LheqgZjj1BbQpnLK?= =?us-ascii?Q?8OWPIPQ1R5alPmcCbJHunLuOO1tfzzhSs5ZbM++QMAp3/MQ5I1Re31sYczvM?= =?us-ascii?Q?/4iVnIVs9Td3fvLB9nzLXRN28Q1Li/xYm4d+XEQ2WjGafB8pkr+LZdLR92eF?= =?us-ascii?Q?5O+WQPFHiCmV/qtXFLF3K6NixuoT6yoclNuq4h4j9OKX4J5nz7dprbp8N847?= =?us-ascii?Q?NEGiUCT8jDtAy+5YbdeutZdWBCOz6IxyXOkGBd7TjZA/Tvgx+Ni6vTbjoVpt?= =?us-ascii?Q?OKhxIBRf9hNhdIf/6YR9Hq6boZjh4dUOQzRPmM9uKodECzjio78P6j7991YS?= =?us-ascii?Q?h43JNriGwi7kqWOVCoWCnK+OhjwCU4Wxw/v1jq9i?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5ebd0e2-dc61-40fa-a0bf-08daa28f87f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2022 02:57:37.0972 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fV0JtzGtGyq89qhwuEWs6VcHfkMwX9WzdacSsi5yjc9svQtNZSCxmA6Mjx+CwZF5tugr8OXxiWaunVDKYHOlLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4959 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Foster Non= g > Sent: Thursday, September 29, 2022 5:20 PM > To: devel@edk2.groups.io > Cc: Nong, Foster > Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Handle InitialVFs=3D0 cas= e for SR-IOV >=20 > 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 asso= ciated with the PF. > The minimum value of InitialVFs is 0. >=20 > Below code is used to calculate SR-IOV reserved bus number, > if InitialVFs =3D0, it maybe calculate the wrong bus number in this case. > LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFSt= ride >=20 > we can fix it with below code: > if (PciIoDevice->InitialVFs =3D=3D 0) { > PciIoDevice->ReservedBusNum =3D 0; > } else { > PFRid =3D EFI_PCI_RID (Bus, Device, Func); > LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStr= ide; > // > // Calculate ReservedBusNum for this PF > // > PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bu= s + 1); > // > // Calculate ReservedBusNum for this PF > // > PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - B= us + 1); > } >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D4069 >=20 > Signed-off-by: Foster Nong > --- > .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) >=20 > 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 =3D EFI_PCI_RID (Bus, Device, Func); > - LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) *= VFStride; > + if (PciIoDevice->InitialVFs =3D=3D 0) { > + PciIoDevice->ReservedBusNum =3D 0; > + } else { > + PFRid =3D EFI_PCI_RID (Bus, Device, Func); > + LastVF =3D PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1)= * VFStride; >=20 > - // > - // Calculate ReservedBusNum for this PF > - // > - PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (LastV= F) - Bus + 1); > + // > + // Calculate ReservedBusNum for this PF > + // > + PciIoDevice->ReservedBusNum =3D (UINT16)(EFI_PCI_BUS_OF_RID (Las= tVF) - Bus + 1); > + } >=20 > DEBUG (( > DEBUG_INFO, > -- > 2.37.1.windows.1 >=20 >=20 >=20 >=20 >=20