From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.9547.1650639702289917000 for ; Fri, 22 Apr 2022 08:01:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=Eatmcs9L; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=01116829f8=abner.chang@hpe.com) Received: from pps.filterd (m0134422.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 23MCl28I001889; Fri, 22 Apr 2022 15:01:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=Oz6sQ/3Jk2HsKk5kGVW5VJIwfqYcBv+8Q7bUn3zfHrI=; b=Eatmcs9L/sHap/VuEBewM6Vh+6K/mAUQY/WIPwNiJWNTpO/CDvbE8en1+vZc8qTK7yKc 1+9K/GV6SmqHoE58OS9QovjrSiAvjnUDdR+PqOWipQl88PKWwi1hBUvGfutF+ZeLSKY5 qpyjZnoU3jNPztuRFgnjatcs9Z7tCKJVmn+QEKSAjqFCvyvyLKdgUW5XmIDqYToq+UG5 BM15jTMu+CNhcI8nLa/J8k+NPwuNCGUrNvyY298xM7viMdQUHg7g1M2Gg7cBF1OOtcDL 8rqDaZ84OyyP3/1W4LqSVXkg4RWtath/RnFjXFBmHI6xbVIi/7osJvgXe9jJXgOGCrfh bg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3fkvnp92k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Apr 2022 15:01:31 +0000 Received: from p1wg14926.americas.hpqcorp.net (unknown [10.119.18.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id E0F10800365; Fri, 22 Apr 2022 15:01:15 +0000 (UTC) Received: from p1wg14925.americas.hpqcorp.net (10.119.18.114) by p1wg14926.americas.hpqcorp.net (10.119.18.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Fri, 22 Apr 2022 03:01:15 -1200 Received: from p1wg14920.americas.hpqcorp.net (16.230.19.123) by p1wg14925.americas.hpqcorp.net (10.119.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15 via Frontend Transport; Fri, 22 Apr 2022 03:01:15 -1200 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (192.58.206.38) by edge.it.hpe.com (16.230.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Fri, 22 Apr 2022 03:01:15 -1200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y4EnejBkzDU7pMiu+9C5p6Xk+XeqnrzCzL6wJHAykiZ17U4KvX8nbwcbTuGG/TYKHZGlFPoi3A8Thb4EqAhMmq27QzdZ23sq5JY4mQ+1Oe/qMSSw/nK0OgpLsT0p0jvumdmbvJD5yOHdO29umPCZVLVj6b1CGtFyKAptSOOXg6e3FUVzhkUTGH3lCdhUoNtRV2N48i2Wven3UY+MBqRNI0ogCUgSQVVWk2KG7ZA7xLxPIx3pbf8ZcPC4LrwbdxVsoxapMprEtUDkHtDwr/Xpi3cvP1GQq20JcgY3DCHLihwCuCSmz0DpVbIbsaxeBm5RRPiQPf1ho7MANiBJAu3ADA== 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=Oz6sQ/3Jk2HsKk5kGVW5VJIwfqYcBv+8Q7bUn3zfHrI=; b=kjXrQo3w9h+eiUccEWcWe/qeZIiCvR6/GsQZHzaTNzWqKjFHhCQ8rFtJ5mOODosgsDtIhZo7YmQsF0BUr0c7kZQL9ZIHZmlEO1DbpJpXQ7eOFs++jWA4txWVr3QrF00XCQZOyO7K8UnnfKE3UEfj53LTWk4liGDACUg0SeQcc2WKXP0mVfUPT/QhrBeCLjcWgYFM8uz+OaqfsF2KTNzY4G4vFV11JU21das5IjxG+krLui7ZUPsqDB5yC4YoZTP49vrqTSV9cdeHdUsDspfR6ByJEmiUtESdtBdQp4CUTX4U0XNbz7IU2mH0SFMNnZUaZ8ryPUtjm166Y/lI5gytqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:173::6) by MN0PR84MB3096.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:208:3c8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Fri, 22 Apr 2022 15:01:13 +0000 Received: from PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM ([fe80::1180:9469:31d2:6933]) by PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM ([fe80::1180:9469:31d2:6933%7]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 15:01:13 +0000 From: "Abner Chang" To: Gerd Hoffmann , "devel@edk2.groups.io" CC: Pawel Polawski , Ard Biesheuvel , Liming Gao , Hao A Wu , Ray Ni , Oliver Steffen , Leif Lindholm , "Jordan Justen" , Jiewen Yao , "Jian J Wang" Subject: Re: [PATCH v5 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory Thread-Topic: [PATCH v5 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory Thread-Index: AQHYVio3jqLn4Ialr0S/sIEhGel6XKz8BgQA Date: Fri, 22 Apr 2022 15:01:13 +0000 Message-ID: References: <20220422073713.2087781-1-kraxel@redhat.com> <20220422073713.2087781-3-kraxel@redhat.com> In-Reply-To: <20220422073713.2087781-3-kraxel@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5da0c6da-c942-4257-fb3e-08da2470f1a4 x-ms-traffictypediagnostic: MN0PR84MB3096:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CpENdbmw+SJdoV2c4oEjNRQBXCFT40j9XiJ3FdRLCZkfnoVzHWsG4CNu4sLUhLoqXvngCJZ7QoyR9W7Tb7TJ6iVfwc5xbZfS0EmZuHzusH31xQsx0T5cyzLSjAL0gPhbViWRlaYk+1etYewxzmwLAd3ydBE5piQs8oq5MQKbfbU53kLaROSDatlEFIj1uDxK+Hzutczu2JO8MMAe+xMK28lz/MhuDfGK3XsyZAZvc5+VPf/y7f1b86CRMJrWmT75jdbuDzzINxnXI6yanwtgZHxgXviAPLOZsDnKI0pq5nS1gztuAwiOSb2dCogQSggHCiFGawi2pwnktsz4PRPNxWiYdd/N29oCsgdcvPCdY82VGbZeN4SdVAM8gIQFLo3FvCyWGXhOH5j6lc60cJEENx2j5JLFQr/00XX1jycqSVwMFKtb8Ko6CQxjeG2J0sjiSVk/AlbHq3HNpfke+qiUnY/C2MN/LZfJyh/7eiJnxfXkohB0hsYlbiDfrFhZe7/9WHl8VPy9qvnv1Bu9fF5A0rmp+tibnUNc568Ap7K0r7NV4s0xV37GOq/xIUij5gs36fBp5YvKy/XWxsWYT39xvX2kTwPX5eCAUFAhH9ekVQEVSASBZPVIXPlMDZoC52wVtPytOmPmyV6DJcISq/lGz51OVV1Oi6eNAQj0/aza03+Cr6yj4H7+c81bHV+aAqQukdNEohW+W67vxPVzpyx+2eqI5CNTW5eoy9UxQ9mFLU0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(366004)(186003)(66946007)(66476007)(110136005)(6506007)(66556008)(7416002)(54906003)(5660300002)(86362001)(71200400001)(4326008)(8676002)(76116006)(66446008)(64756008)(55016003)(8936002)(7696005)(82960400001)(2906002)(508600001)(38100700002)(122000001)(52536014)(316002)(38070700005)(83380400001)(53546011)(33656002)(26005)(9686003)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jWEsPy59PY3Z5574Ox/qXSixQWSXjuzkJNX5Yyt0OADn/zXipAvxdEJQ/slU?= =?us-ascii?Q?mvvshICjxf8CcTbg2W4749CcryQcxnzRJhRfRkFU1/KBTBEAvudm2/Pdu/zi?= =?us-ascii?Q?jjPwh97o7Fcqza/eXTpBgs7+1badqvjqHCFOGP99DtiHv4icpAylqydR2nsw?= =?us-ascii?Q?/Rhf02dPrPlcK2ArpglzzOKCq6QNUrIFkQZmBn6RKSSkydaxlpQnZfVYihsv?= =?us-ascii?Q?AKuJSbwlXLEOa8h3hiPTDeQ5FUhc3Fhm4UEpnopF8Ym1gtnK/U4x6HEdXHJ6?= =?us-ascii?Q?T6dOQ/0iEM8OBbDLP2ZJboBnjZvnlWVgiU9B7q/RiwUiCWWyodzHe3UTVH2k?= =?us-ascii?Q?M8UBvsnEG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j43/1?= =?us-ascii?Q?VX3VKOuBm4dBz91o/OdNYZ/xYmTc6n9ylKjODlRlzOeq9Th9d5Nq4uMCf9nM?= =?us-ascii?Q?lngyRw67ctPN0oN88jnkdBjuFDxmVb5APqZxqUS62pM+g8e3UzPbyGITQGfM?= =?us-ascii?Q?1LaBJmgN84eYANW+kjujjLJ3h0StQ2RY13M0RXYsgMwfRmR4d5wtvx+J4Z5s?= =?us-ascii?Q?N9tV6Zyg8K6FqC50R1yXw+3rD3fIOQoC4jBhgyyCJoXKzbeArWnRE58nZWVv?= =?us-ascii?Q?101No6Ll7ZsfCZcqn2q4A7CwQRwjtJTHw7ISsZY+qYTafTWa8xMMhqd09+KX?= =?us-ascii?Q?ENlP8GGe9SS5Ls6U6pOxNLct5n+Tyvc3uKJH9I5IurAdNIvfCjh0SzaER9AP?= =?us-ascii?Q?584UjwC9r5KdErcZbtAHKDuGajW53ZjNnO4Xa0JGfPUuptXf0m4ZpvYElUXQ?= =?us-ascii?Q?wu3ZAdioGUQeBOmoITEsvkVlDYYTP7xiY1Aw8PnSLrmfHJy3ivqbAhZknIFx?= =?us-ascii?Q?vnvmDwbl6Q=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR84MB1647.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 5da0c6da-c942-4257-fb3e-08da2470f1a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2022 15:01:13.5248 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: G8H18dsarqqQ1bOSv/+grE2iCrxupOEvbYbNdQYbUFI25TFoD633uvSRKtJX2LrUV5KjXKY3kfdphlMSAso+eA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR84MB3096 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: kUILeagv0D_hMDBneenWPyociGYwPxmj X-Proofpoint-ORIG-GUID: kUILeagv0D_hMDBneenWPyociGYwPxmj X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-22_04,2022-04-22_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204220066 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Gerd, I have some comments in line. With those fixes, Reviewed-by: Abner Chang > -----Original Message----- > From: Gerd Hoffmann > Sent: Friday, April 22, 2022 3:37 PM > To: devel@edk2.groups.io > Cc: Pawel Polawski ; Ard Biesheuvel > ; Liming Gao ; > Hao A Wu ; Ray Ni ; Oliver Steffen > ; Leif Lindholm ; Jordan > Justen ; Jiewen Yao ; > Gerd Hoffmann ; Chang, Abner (HPS SW/FW > Technologist) ; Jian J Wang > > Subject: [PATCH v5 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not > mandatory >=20 > io range is not mandatory according to pcie spec, > so allow host bridges without io address space. >=20 > Signed-off-by: Gerd Hoffmann > --- > .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++++++++++--------- > 1 file changed, 23 insertions(+), 22 deletions(-) >=20 > diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c > b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c > index 98828e0b262b..823ea47c80a3 100644 > --- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c > +++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c > @@ -292,13 +292,8 @@ ProcessPciHost ( > } > } >=20 > - if ((*IoSize =3D=3D 0) || (*Mmio32Size =3D=3D 0)) { > - DEBUG (( > - DEBUG_ERROR, > - "%a: %a space empty\n", > - __FUNCTION__, > - (*IoSize =3D=3D 0) ? "IO" : "MMIO32" > - )); > + if (*Mmio32Size =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", > __FUNCTION__)); > return EFI_PROTOCOL_ERROR; > } >=20 > @@ -333,13 +328,15 @@ ProcessPciHost ( > return Status; > } >=20 > - // > - // Map the MMIO window that provides I/O access - the PCI host bridge > code > - // is not aware of this translation and so it will only map the I/O vi= ew > - // in the GCD I/O map. > - // > - Status =3D MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); > - ASSERT_EFI_ERROR (Status); > + if (*IoSize) { I think I missed this in the previous review. According to coding standard, this line should be if (*IoSize !=3D 0) > + // > + // Map the MMIO window that provides I/O access - the PCI host bridg= e > code > + // is not aware of this translation and so it will only map the I/O = view > + // in the GCD I/O map. > + // > + Status =3D MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); > + ASSERT_EFI_ERROR (Status); > + } >=20 > return Status; > } > @@ -413,17 +410,21 @@ PciHostBridgeGetRootBridges ( >=20 > AllocationAttributes =3D EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM; >=20 > - Io.Base =3D IoBase; > - Io.Limit =3D IoBase + IoSize - 1; > + if (IoSize) { Same here > + Io.Base =3D IoBase; > + Io.Limit =3D IoBase + IoSize - 1; > + } else { > + Io.Base =3D MAX_UINT64; > + Io.Limit =3D 0; > + } > + > Mem.Base =3D Mmio32Base; > Mem.Limit =3D Mmio32Base + Mmio32Size - 1; >=20 > - if (sizeof (UINTN) =3D=3D sizeof (UINT64)) { > - MemAbove4G.Base =3D Mmio64Base; > - MemAbove4G.Limit =3D Mmio64Base + Mmio64Size - 1; > - if (Mmio64Size > 0) { > - AllocationAttributes |=3D EFI_PCI_HOST_BRIDGE_MEM64_DECODE; > - } > + if ((sizeof (UINTN) =3D=3D sizeof (UINT64)) && Mmio64Size) { Same here for Mmio64Size. Abner > + MemAbove4G.Base =3D Mmio64Base; > + MemAbove4G.Limit =3D Mmio64Base + Mmio64Size - 1; > + AllocationAttributes |=3D EFI_PCI_HOST_BRIDGE_MEM64_DECODE; > } else { > // > // UEFI mandates a 1:1 virtual-to-physical mapping, so on a 32-bit > -- > 2.35.1