From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.1609.1634689748931937819 for ; Tue, 19 Oct 2021 17:29:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=isa3q7AQ; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="314860921" X-IronPort-AV: E=Sophos;i="5.87,165,1631602800"; d="scan'208";a="314860921" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 17:29:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,165,1631602800"; d="scan'208";a="494369736" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga008.jf.intel.com with ESMTP; 19 Oct 2021 17:29:07 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 19 Oct 2021 17:29:07 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 19 Oct 2021 17:29:06 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 19 Oct 2021 17:29:06 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 19 Oct 2021 17:29:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOTGoM1GJ9j0Ct6pwwUUU0rjNn0vee6VaYX0xSN4xd22BLndaOeGh4+9jQyAYOvxdfR9mDzQW65Wydi4MhVmRdxSb3WYbS3vXNzNHeAl4NvHQ/GEPkrll89frH9OYNX0SfP0n6QtgGUT1GHmXzZkxVFTam3GxouqJ2sCeoyChh01jJVRK37LH56gkjw3WZdM7ecIHR75CEuBOiMXKpG8K70X+/c9fDYaniKW97sWvpy8kB7/k6w3iNLAaLV7laWAZI9PQW+fI53YyttHf/3pWzBuYCiZDK/oen5ri+9wxUNIeP1y5vncBvRWLxIcpbnLZsBVc/u05U0CRFxjgsjmPw== 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=WVhM4EAmpYrMxbduzqEVcDkIlsRqWrxUBc5ltP73/Ag=; b=kKJxc/mpyBLMfPSYCCByeJneeKqylpuTXqVlMuxQK8hPBSAe1BGjmx9LSLav26jlYE7vfH2SeqvTa/qC+JraobmchUE8k8ySXq4jwX/mEo0M+0uajPZ7EyMTozQVKj1QBtsY1MVDVCbnqWI71aEI3MDZTgYTvhomQIHewYYm6AWFyxLdy9pDqP1gkZHmVC36i7mRgME6H2oOGTMLqSfwlh0bMyyyKpllwBQLU2LtTwtzWTsI3sRFWJfX0ZTYhjucIVQsDV9hZ3OvLtUD1KQ5ODb+SajPH1NiszvErGNLTNatIg2Og9cOwSSPsat6UVodXxTEecucqslA9PT/y96OpA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WVhM4EAmpYrMxbduzqEVcDkIlsRqWrxUBc5ltP73/Ag=; b=isa3q7AQlolGyahJLyKD4s+alTVp6E6bENe2ENcpNrACBha3TSM+LHgj+1n6PP6DcTYJ29sIjBYOTP0DXgdqu+9U6QjQEu+1TQ+vUr3rvEMv+MDf2p/YzwqC34EPFWKU1k9Vz9oce6OlcJjyOexih2XCCMfMk0JCnMH0eItwpgg= Received: from BN0PR11MB5696.namprd11.prod.outlook.com (2603:10b6:408:14b::11) by BN0PR11MB5696.namprd11.prod.outlook.com (2603:10b6:408:14b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Wed, 20 Oct 2021 00:29:02 +0000 Received: from BN0PR11MB5696.namprd11.prod.outlook.com ([fe80::317e:de35:e920:7778]) by BN0PR11MB5696.namprd11.prod.outlook.com ([fe80::317e:de35:e920:7778%3]) with mapi id 15.20.4608.018; Wed, 20 Oct 2021 00:29:02 +0000 From: "Ni, Ray" To: "Sheng, W" , "devel@edk2.groups.io" CC: "Kowalewski, Robert" , "Huang, Jenny" , "Chaganty, Rangasai V" , "Albecki, Mateusz" Subject: Re: [PATCH v2] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root Bus Thread-Topic: [PATCH v2] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root Bus Thread-Index: AQHXw/wlkf4DnH6PVUijr865pXirZqvbCrHA Date: Wed, 20 Oct 2021 00:29:02 +0000 Message-ID: References: <20211018084244.15316-1-w.sheng@intel.com> In-Reply-To: <20211018084244.15316-1-w.sheng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 57b497cb-f4d8-43c0-8f03-08d993609dca x-ms-traffictypediagnostic: BN0PR11MB5696: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X1zlGFiJCdqRZh3QK/73XIPoMKZOL+mm0MBIvRFK700V1hfotsef2gb6ikX0hRZXOz3VDxF4vWV+39HSLa5ycrJz5Quyg4KhB+TVN3U44w2p80TXkg92ljsW+N1lFIoiPJWrZzHE7lRsPtmXLmbTVyNX1hgZgNDV7xAQyU2X0xTp4LQDLnQPRxCHa3x3oiSzLYoEGfTmSRWULkO+ePU+T73zWUwjATRv5gjvuZYbyRRi8S+AfCMTz74uLgcrCDv6S7RWihNAkF0RKBAJ52KaN2job5zx6zCMnoxlkfSjRimX4lFsOBSNWebUwxQ0VCPqvaOpTCm60gFDOCwa0Fx+ygIQPEsi9q8as/msY1e1fRWLQYGuG4Tcec8olWdVahGYLD/JOM5Hdr8o0Q2MhFA/Yon8AxS32Pn6cWSPn5Z9dSv9YRwUJpWYzta6HlkGEYO7bUooGFMJ25fEV4sH6iN5iLz8qVrY+FaJs9G2kjUsQZQXpkzmI2cvj8OODLUl1MRRzotmHgyhs1zrFiMWPyxYuwu4s3GRthcrqFzqIw5j5lofL1G0GKUdRANd8sOBKuTrHMJrWuNSvg4yGosTJGQQCVZtFnRAhwQFD3Dr6bkbu2r84SQDn8fHSefHKq8NOETwZw0T+3IaLYslTyxAqLRmgjPVrodKyHLSdvRp2s3U3LLLqbt9+/a3EU39IS0Xz4RXwirNT3KDQwAa+8IG3KCKP9OhTu1O1B55ywvid3GE0MbPgpyFSgl+evtWf8hNw2c58Usesh9Ul4nWR6kV0hF3eJEBzCRUs83EV8GkK6P31Bk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN0PR11MB5696.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(366004)(316002)(38100700002)(83380400001)(38070700005)(55016002)(5660300002)(508600001)(2906002)(26005)(82960400001)(33656002)(4326008)(9686003)(76116006)(110136005)(71200400001)(7696005)(53546011)(966005)(8676002)(64756008)(66476007)(66556008)(66446008)(54906003)(66946007)(86362001)(122000001)(107886003)(6506007)(8936002)(52536014)(186003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Zl1yj3um+QM3wIEwZLyX2EZ2bUVGKtVJJ+9LY0xId/vcHwqrBgJa1Ad0gslq?= =?us-ascii?Q?yWB9d702me5zrm2aPzQGy3EL9jdWcTpjo9WNAJkN7KlThEZsY1WhymfIbbDb?= =?us-ascii?Q?boUzj8lI8LasU2eH5LZhZYAuwngWFdHy3/Ndx/QHpL2OQljxZGCohBDYym0l?= =?us-ascii?Q?lf9jPL3WHx8E36prLUtbd4UlAynAOMYKxUw/7VrMgBmAHKMsy5+uO2Uu1NKO?= =?us-ascii?Q?25TdtXhuy3PFxd3M4CUtXXL5UXY9ZvCRtyyMrDwXCDCxaKCM5POUSOxJVHR3?= =?us-ascii?Q?hXqDMjYkNEk1kVBRtucxHnDIsOOAxYWKWH+U8YiKc7yrZhwQ921cXpx/JX6W?= =?us-ascii?Q?dbG8dbDWkBzMd3arjtFWhu8zek6QQLCPPAdi1CI7vPu4wGmAK+RKJfa415vT?= =?us-ascii?Q?1ZDBAawJDmPfFwXD9a3DQ9He7KJztIsLmP9nSQsuYaa3FXr6ZBoQmUdW194U?= =?us-ascii?Q?Z0pE4NQeY6eGvW7HbTw3feLOnFB7X8dAF19ydc11Dbhp+8OdDklh76rakCzt?= =?us-ascii?Q?UK8gauOjhbLS9itBSK48gZFZ6nXf7EYXLEZiDYe7FyL3fXfhVQExTPauwmJ0?= =?us-ascii?Q?gjodiXLJnm6z1hAYlmS44Fh8NK9mpt0APgH/eNZCY2iyv+0PG9CTBboS15pt?= =?us-ascii?Q?vdRpC8IhFRwlV9PAd5ibuXOPukuea/BkrvgNwxaxDNQMmtRvFLeKtOEthJSQ?= =?us-ascii?Q?yuopv1Y3Bv+ubXTTXod2BEA1lWMzDATCirpNsKe9G8kCrL31ElLuMH4prCQs?= =?us-ascii?Q?Xo6SStVRmNWuxOisLTRP3xIbx/MOMri395RwaD6LMNZ8I8Or3yqG1mdLNegb?= =?us-ascii?Q?exTc9VcXqxFH4FG1d6nMqqAjXLslwra5jCAGuqXDVo7bSnHCyl9e3ugC+H9M?= =?us-ascii?Q?AE3RNEgEdaQY3OLhni0uqXrDGTn0vYpUTteltIX/sA1nxBUphu9FmxLh+QlI?= =?us-ascii?Q?gnYdJ9CqHBKYkDuJHiXxI4V50ZpkDlfmy9CNDNIjnLhQSeKT9rEEJg74CERb?= =?us-ascii?Q?aPfoFH0GxhPTqjAlv0nF77595dqyIWisiBm/0LXZUX6fESHjlJUx9yN2mjV7?= =?us-ascii?Q?HBn4oIEWZrzfs6sZLPjkR+u82TPCQeQ9y8ANdijO+qco87KC9uHeSsJ9ZbyH?= =?us-ascii?Q?KcNQDvrQWknm44TMw5iKKkwKuf7pWqx34BI2WkchNKoMm5FP28yQcffvTvTE?= =?us-ascii?Q?L0fRMpy6qHpxI8q3b99hLg82EjuEOSW5I3RZC18WEr8cqVZqIjOqkuOO1btb?= =?us-ascii?Q?YYEDp5zxVVklWPyliQVQMTLbBkaHRSYVzt3BsYCnFyuivCLt5aKV2JnIikY6?= =?us-ascii?Q?Jexsc5bc2f2C4DUnmnWfX5R3?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN0PR11MB5696.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57b497cb-f4d8-43c0-8f03-08d993609dca X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2021 00:29:02.1742 (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: F4/bD1d6iUKS70YhvOwJSyj9QNET4D4pO0QwWTXWFaUAhLLLxa0cKfnZacmmpxfCKY3Res78Ag7Xr9rG07CwCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR11MB5696 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 Can you rely on the PciRootBridgeIo protocol instances instead of this libr= ary? It will make the driver usable in platforms that don't produce the PciHostB= ridgeLib. Thanks, Rya > -----Original Message----- > From: Sheng, W > Sent: Monday, October 18, 2021 4:43 PM > To: devel@edk2.groups.io > Cc: Kowalewski, Robert ; Huang, Jenny ; Ni, Ray ; > Chaganty, Rangasai V ; Albecki, Mateusz > Subject: [PATCH v2] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root B= us >=20 > Some system may has multi PCI root bus. It needs to use function > PciHostBridgeGetRootBridges () to get the root bus count. Then, > scan each root bus to get all devices. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3695 >=20 > Signed-off-by: Robert Kowalewski > Signed-off-by: Sheng Wei > Cc: Jenny Huang > Cc: Ray Ni > Cc: Rangasai V Chaganty > Cc: Robert Kowalewski > Cc: Albecki Mateusz > --- > .../Feature/VTd/IntelVTdDxe/DmaProtection.h | 1 + > .../Feature/VTd/IntelVTdDxe/DmarAcpiTable.c | 17 +++++++++++= +++--- > .../Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf | 1 + > 3 files changed, 16 insertions(+), 3 deletions(-) >=20 > diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaPro= tection.h > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.h > index a24fbc37..97061de5 100644 > --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection= .h > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection= .h > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAc= piTable.c > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c > index 2d9b4374..e717aeb2 100644 > --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable= .c > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable= .c > @@ -682,6 +682,9 @@ ProcessDhrd ( > UINT8 SecondaryBusNumber; > EFI_STATUS Status; > VTD_SOURCE_ID SourceId; > + PCI_ROOT_BRIDGE *RootBridges; > + UINTN RootBridgeCount; > + UINTN Index; >=20 > mVtdUnitInformation[VtdIndex].VtdUnitBaseAddress =3D (UINTN)DmarDrhd->= RegisterBaseAddress; > DEBUG ((DEBUG_INFO," VTD (%d) BaseAddress - 0x%016lx\n", VtdIndex, D= marDrhd->RegisterBaseAddress)); > @@ -692,9 +695,17 @@ ProcessDhrd ( > mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag =3D TRUE; > DEBUG ((DEBUG_INFO," ProcessDhrd: with INCLUDE ALL\n")); >=20 > - Status =3D ScanPciBus((VOID *)VtdIndex, DmarDrhd->SegmentNumber, 0, = ScanBusCallbackRegisterPciDevice); > - if (EFI_ERROR (Status)) { > - return Status; > + RootBridges =3D PciHostBridgeGetRootBridges (&RootBridgeCount); > + if ((RootBridges =3D=3D NULL) || (RootBridgeCount =3D=3D 0)) { > + return EFI_UNSUPPORTED; > + } > + DEBUG ((DEBUG_INFO,"Find %d root bridges\n", RootBridgeCount)); > + for (Index =3D 0; Index < RootBridgeCount; Index++) { > + DEBUG ((DEBUG_INFO,"Scan root bridges : %d, Segment : %d, Bus : 0x= %02X\n", Index, RootBridges[Index].Segment, > RootBridges[Index].Bus.Base)); > + Status =3D ScanPciBus((VOID *)VtdIndex, (UINT16) RootBridges[Index= ].Segment, (UINT8) RootBridges[Index].Bus.Base, > ScanBusCallbackRegisterPciDevice); > + if (EFI_ERROR (Status)) { > + return Status; > + } > } > } else { > mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag =3D FALSE= ; > diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelV= TdDxe.inf > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf > index 220636ad..25ff86f4 100644 > --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.i= nf > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.i= nf > @@ -55,6 +55,7 @@ > PerformanceLib > PrintLib > ReportStatusCodeLib > + PciHostBridgeLib >=20 > [Guids] > gEfiEventExitBootServicesGuid ## CONSUMES ## Event > -- > 2.16.2.windows.1