public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Pete Batard <pete@akeo.ie>, Jared McNeill <jmcneill@invisible.ca>,
	Andrei Warkentin <awarkentin@vmware.com>,
	Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH edk2-platforms v4 7/9] Silicon/Broadcom/BcmGenetDxe: use MemoryFence() for MMIO write ordering
Date: Mon, 11 May 2020 16:55:25 +0200	[thread overview]
Message-ID: <20200511145527.23453-8-ard.biesheuvel@arm.com> (raw)
In-Reply-To: <20200511145527.23453-1-ard.biesheuvel@arm.com>

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     | 3 +--
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/BcmGenetDxe.inf b/Silicon/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/Silicon/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/Silicon/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) == 0);
 
-  ArmDataSynchronizationBarrier ();
+  MemoryFence ();
   MmioWrite32 (Genet->RegBase + Offset, Data);
 }
 
-- 
2.17.1


  parent reply	other threads:[~2020-05-11 14:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 14:55 [PATCH edk2-platforms v4 0/9] BCM genet fixes Ard Biesheuvel
2020-05-11 14:55 ` [PATCH edk2-platforms v4 1/9] Silicon/Broadcom/BcmGenetDxe: whitespace/cosmetic cleanup Ard Biesheuvel
2020-05-11 16:36   ` Samer El-Haj-Mahmoud
2020-05-11 21:14   ` [edk2-devel] " Philippe Mathieu-Daudé
2020-05-11 14:55 ` [PATCH edk2-platforms v4 2/9] Silicon/Broadcom/BcmGenetDxe: add support for broadcast filtering Ard Biesheuvel
2020-05-11 16:44   ` Andrei Warkentin
2020-05-11 20:34   ` Jeremy Linton
2020-05-11 21:21     ` Ard Biesheuvel
2020-05-11 14:55 ` [PATCH edk2-platforms v4 3/9] Silicon/Broadcom/BcmGenetDxe: fix multicast/broadcast handling Ard Biesheuvel
2020-05-11 14:55 ` [PATCH edk2-platforms v4 4/9] Silicon/Broadcom/BcmGenetDxe: avoid uncached memory for streaming DMA Ard Biesheuvel
2020-05-11 16:42   ` Andrei Warkentin
2020-05-11 16:53     ` Ard Biesheuvel
2020-05-11 14:55 ` [PATCH edk2-platforms v4 5/9] Silicon/Broadcom/BcmGenetDxe: shut down devices on ExitBootServices() Ard Biesheuvel
2020-05-11 16:32   ` Andrei Warkentin
2020-05-11 14:55 ` [PATCH edk2-platforms v4 6/9] Silicon/Broadcom/BcmGenetDxe: keep TX buffer mapped during DMA transfer Ard Biesheuvel
2020-05-11 16:19   ` Andrei Warkentin
2020-05-11 14:55 ` Ard Biesheuvel [this message]
2020-05-11 16:55   ` [edk2-devel] [PATCH edk2-platforms v4 7/9] Silicon/Broadcom/BcmGenetDxe: use MemoryFence() for MMIO write ordering Andrei Warkentin
2020-05-11 21:11   ` Philippe Mathieu-Daudé
2020-05-11 14:55 ` [PATCH edk2-platforms v4 8/9] Silicon/Broadcom/BcmGenetDxe: add unload support Ard Biesheuvel
2020-05-11 16:17   ` Andrei Warkentin
2020-05-11 14:55 ` [PATCH edk2-platforms v4 9/9] Platform/RaspberryPi4: remove ASIX 88772b driver Ard Biesheuvel
2020-05-11 16:06   ` Andrei Warkentin
2020-05-11 16:24   ` Samer El-Haj-Mahmoud
2020-05-11 23:20 ` [PATCH edk2-platforms v4 0/9] BCM genet fixes Jeremy Linton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511145527.23453-8-ard.biesheuvel@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox