From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (NAM04-BN3-obe.outbound.protection.outlook.com [40.107.68.65]) by mx.groups.io with SMTP id smtpd.web10.942.1589216113229927107 for ; Mon, 11 May 2020 09:55:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=yZnUUE/h; spf=pass (domain: vmware.com, ip: 40.107.68.65, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MX/jv6sKZsilbCcza5KlA7HMvAdDJzw3/Wz+MGXLLHxoZFu9wU4xPsMpUTJwqz5WK4T8RxUJqW5pXl9acK7niDwkL4tNDgF0UGPgxLDz/hsPsGfyEd7cySHGKBy3UZknZfG0uzDx3Vu8ayFD+QNG3hSSB7U9tJNTUa+F5OIUUI7wi3yl2pVqBEmAbTsuF8OaFIaThac3othgBeaLeCtxmTr94Qc+aawvffpmQISVmWxaK9YyU19C6otU4w4b9osSvD+m8AiqqD2dhE+jM0cbWNrz9QBf8XI7IMl7Q3iyL0tyzHER2uj6RrQleA3W0hEU0cFYztsRXEobPwJUC+i2xw== 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-SenderADCheck; bh=sDTiOPFnmYG+2pz4iHRsguJrWbM//El6E51Rsh/RJs4=; b=bpxImrDbppaXQvim+Qw2Qr/xHKxyqHg8QsIVVC0YfucgFyvMx41XTM3CECnMil2C4ns9oT04EElSgcEtO/2S9YvepzEhpf5U9fOfXx86Q7NbkU92RW2eidBEFf0XozPjNcjpH/uv+yALYBJ/hJhIYHsMk2z05cAPqrBNrzF5rlgUGQqWWiTLxYIPCKrUb1Rofo+jH8sAkZ8KFABGd4KElZSDzJE2MqY0RgNHRIVBDGoKINXwZlr8IdmLfhOzlVTXoQ88AJ8ZwGzIKSAXa3uvkxxVHS6qWpEmaYTzIgQmDqxAnTW1SSiRneDpOcVki9TINXaVeuhfig+/sux6qgNbTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sDTiOPFnmYG+2pz4iHRsguJrWbM//El6E51Rsh/RJs4=; b=yZnUUE/hnVqpgylkoSAG7HNrHMEZKN+wIGWKWEASc9Ti2ghbVcL8Tm7NIkYjKSTUTztPjBQOTvYDNuQz0dWXB1TYa4gKeLdotSKoDF+Jo7B8abwX4i9BtpbxBDN5gFZu0CJ39MFDFJZWqYk7d1hmtvgnY3Wx59DWdyxvYDLBX+4= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN6PR05MB3554.namprd05.prod.outlook.com (2603:10b6:405:44::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.11; Mon, 11 May 2020 16:55:11 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::f463:db64:43d8:5a0f%3]) with mapi id 15.20.3000.016; Mon, 11 May 2020 16:55:11 +0000 From: "Andrei Warkentin" To: "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: Pete Batard , Jared McNeill , Samer El-Haj-Mahmoud , Jeremy Linton Subject: Re: [edk2-devel] [PATCH edk2-platforms v4 7/9] Silicon/Broadcom/BcmGenetDxe: use MemoryFence() for MMIO write ordering Thread-Topic: [edk2-devel] [PATCH edk2-platforms v4 7/9] Silicon/Broadcom/BcmGenetDxe: use MemoryFence() for MMIO write ordering Thread-Index: AQHWJ6RGFQ0G47mwJU+QtndjSmg89qijGCZc Date: Mon, 11 May 2020 16:55:11 +0000 Message-ID: References: <20200511145527.23453-1-ard.biesheuvel@arm.com>,<20200511145527.23453-8-ard.biesheuvel@arm.com> In-Reply-To: <20200511145527.23453-8-ard.biesheuvel@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 15313b76-7ea1-4b1a-955f-08d7f5cc118f x-ms-traffictypediagnostic: BN6PR05MB3554: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 04004D94E2 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eHwc+DFmJc3IG100HRATeGCObpmNRdmSFEmrhYZvVXs8zC5ZEYrgohMxyCZbthbKJ+aIx/kxmQwi51yBsjjs+z3SYR3NNcpt1bwt0ZO0vbFblYmeFpvb29LeQ9jGRZKBiIK3llCgKR61o0IpJGeRXggtqDe5OcbUG44dZAh7lcEOUV48c7TXvJ8x7Y4IYRwPfxaQmCRLLW4v0c1Xm0XNav2/+EYbyjniWoNzoCNyC8xVaEYzojr+tJVpEbFdUah+iuey6KV1zQUqQQ7ssQZJxRrrItj/dMIs1YigqZMk0rLJ5UGrYBbqAdf5OtfmM22ov5LQWwgRh+Zf9h5D2P+ULmB5EKU2Y5KKOC50bLzhNc/Xw9Kici5S0gIPuAQz8fVqtGsDAzCHoXUpGk/Af2wYSonriPvzgxFriC2vNblgjsxWZtC2vJu22jLkbezyDJz5P2C585gL3gs5WEweZkZWXeEdWAgg29RJdt4Jc14hqXUwZ8OoIlFAbXHozIck7bwJ9djW4ABa+dQCC7GqyAzpAlb0wTQhhPMuUvCqdGPLDgNERpt2f4q4MAiP8a59xTUdllEGEVCOdhsEBpCEfBF8iNolPpgtNH8pRljmDXOO/zA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(346002)(376002)(396003)(366004)(39860400002)(33430700001)(54906003)(8936002)(45080400002)(26005)(66946007)(966005)(66446008)(66476007)(8676002)(7696005)(110136005)(5660300002)(9686003)(76116006)(64756008)(71200400001)(186003)(6506007)(86362001)(52536014)(4326008)(166002)(478600001)(66556008)(2906002)(33440700001)(55016002)(19627405001)(33656002)(53546011)(316002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: w1oDwMWDwVRoFhNMv6cKZWv15B3aJKjhmW4iBXKq+AZA6apUi8az4DvYmaVwWMyy0UQBehnsIW2KHWsZ02dlQI1dOEabxuGcJ/ivVWJvNxt9GDdzrdaVT+og/O8IXSPJIMUsDkZwbhtSHoi+HYPxV2LyJp3LXMwsAWc5a2S6jg7V+MySOIK7lCi53kWk26JF7lYGcasHlvCsyCKVm1wGKjQYoeg+piuxIwJDWFsvN9a45jN6XFqLRImcB8SrZ67Yp+lISMXkfki2GvilwYjfttcKFDPDSIXHw1GKSNy/IAddGqu/+kQxWxbieWLIvfG3aSuzfd6IrL/KPOTLBqDnsjtbponPko4WJEz/XOU3czvjvc30RaPehYsW6PqG10EOj3RFKUfvW6GqHg+773Ku2T8bqp+RogttoA6hAMYr2OKcMrklfU432V7h/m2BlhymDqiJZIygpMBhBq+g+FWgiMdQoXUgQNXr0KkrT97msAY= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15313b76-7ea1-4b1a-955f-08d7f5cc118f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2020 16:55:11.0821 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: d7+sRfK68zgn/LDiD5MsU9HMmbpanfQfjqxu6f60GbZeKcxPE0xV5dwKDOnU6d5GrRdkIRzAX6ChgdpFTkpfqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR05MB3554 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB34118D58D2510A386C8B4170B9A10BN6PR05MB3411namp_" --_000_BN6PR05MB34118D58D2510A386C8B4170B9A10BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: devel@edk2.groups.io on behalf of Ard Biesheu= vel via groups.io Sent: Monday, May 11, 2020 9:55 AM To: devel@edk2.groups.io Cc: Ard Biesheuvel ; Pete Batard ; J= ared McNeill ; Andrei Warkentin ; Samer El-Haj-Mahmoud ; Jeremy Linton Subject: [edk2-devel] [PATCH edk2-platforms v4 7/9] Silicon/Broadcom/BcmGe= netDxe: use MemoryFence() for MMIO write ordering ARM synchronization barriers can be used to stall execution and wait for cache or TLB maintenance to complete. TLB maintenance is irrelevant in the context of the GENET driver, but cache maintenance is important for non-cache coherent DMA, and synchronization barriers are needed to ensure that outgoing data is cleaned before starting DMA for TX frames. However, this cache maintenance is already taken care of by the cache maintenance routines, and so all we need to do in our I/O routines is ensure that MMIO writes are issued in the right order, and for this, an ordinary MemoryFence () is sufficient. This means we don't need to depend on ArmLib either. Signed-off-by: Ard Biesheuvel --- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf | 2 -- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c | 1 - Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c | 3 +-- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf b/Si= licon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf index 9b3dc5e62ecf..e3e4ebbddb93 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf @@ -27,7 +27,6 @@ [Sources] SimpleNetwork.c [Packages] - ArmPkg/ArmPkg.dec EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec @@ -35,7 +34,6 @@ [Packages] Silicon/Broadcom/Drivers/Net/BcmNet.dec [LibraryClasses] - ArmLib BaseLib BaseMemoryLib DebugLib diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c b/Si= licon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c index 00fbfbc109bb..630a92ef210b 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c @@ -9,7 +9,6 @@ **/ -#include #include #include #include diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silico= n/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c index 35a3c7abdf1e..e3ce8614aeb2 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c @@ -8,7 +8,6 @@ #include "GenetUtil.h" -#include #include #include #include @@ -64,7 +63,7 @@ GenetMmioWrite ( { ASSERT ((Offset & 3) =3D=3D 0); - ArmDataSynchronizationBarrier (); + MemoryFence (); MmioWrite32 (Genet->RegBase + Offset, Data); } -- 2.17.1 --_000_BN6PR05MB34118D58D2510A386C8B4170B9A10BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warkentin <andrey.warkentin@gmail.com><= br>

From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Ard Biesheuvel via groups.io <= ;ard.biesheuvel=3Darm.com@groups.io>
Sent: Monday, May 11, 2020 9:55 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>; Pete Batard <= pete@akeo.ie>; Jared McNeill <jmcneill@invisible.ca>; Andrei Warke= ntin <awarkentin@vmware.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-M= ahmoud@arm.com>; Jeremy Linton <jeremy.linton@arm.com>
Subject: [edk2-devel] [PATCH edk2-platforms v4 7/9] Silicon/Broadco= m/BcmGenetDxe: use MemoryFence() for MMIO write ordering
 
ARM synchronization barriers can be used to stall= execution and wait
for cache or TLB maintenance to complete. TLB maintenance is irrelevant in the context of the GENET driver, but cache maintenance is important
for non-cache coherent DMA, and synchronization barriers are needed to
ensure that outgoing data is cleaned before starting DMA for TX frames.
However, this cache maintenance is already taken care of by the cache
maintenance routines, and so all we need to do in our I/O routines is
ensure that MMIO writes are issued in the right order, and for this,
an ordinary MemoryFence () is sufficient.

This means we don't need to depend on ArmLib either.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
 Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf | 2 --
 Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c | 1 -
 Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c  &nbs= p;  | 3 +--
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf b/Si= licon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf
index 9b3dc5e62ecf..e3e4ebbddb93 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf=
@@ -27,7 +27,6 @@ [Sources]
   SimpleNetwork.c
 
 [Packages]
-  ArmPkg/ArmPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
@@ -35,7 +34,6 @@ [Packages]
   Silicon/Broadcom/Drivers/Net/BcmNet.dec
 
 [LibraryClasses]
-  ArmLib
   BaseLib
   BaseMemoryLib
   DebugLib
diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c b/Si= licon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c
index 00fbfbc109bb..630a92ef210b 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c=
@@ -9,7 +9,6 @@
 
 **/
 
-#include <Library/ArmLib.h>
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
 #include <Library/MemoryAllocationLib.h>
diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silico= n/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
index 35a3c7abdf1e..e3ce8614aeb2 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
@@ -8,7 +8,6 @@
 
 #include "GenetUtil.h"
 
-#include <Library/ArmLib.h>
 #include <Library/DmaLib.h>
 #include <Library/IoLib.h>
 #include <Library/UefiBootServicesTableLib.h>
@@ -64,7 +63,7 @@ GenetMmioWrite (
 {
   ASSERT ((Offset & 3) =3D=3D 0);
 
-  ArmDataSynchronizationBarrier ();
+  MemoryFence ();
   MmioWrite32 (Genet->RegBase + Offset, Data);
 }
 
--
2.17.1




--_000_BN6PR05MB34118D58D2510A386C8B4170B9A10BN6PR05MB3411namp_--