summaryrefslogtreecommitdiff
path: root/OvmfPkg/VirtioNetDxe
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2013-08-23 18:46:03 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-23 18:46:03 +0000
commitdc9447bd3777614529b711c9976979fe61822ba8 (patch)
tree02fe72a3e29eaea6d49b58a47dcf8e9e0a553f0b /OvmfPkg/VirtioNetDxe
parent9bef3cdc8a9d9f9344bd9cb94af3bbdc4ec5ed4d (diff)
downloadedk2-platforms-dc9447bd3777614529b711c9976979fe61822ba8.tar.xz
OvmfPkg: Virtio: load used ring element strictly after loading used index
Enforce in-order execution of these steps even on not sequentially consistent architectures, as discussed in [1]. These changes should be unnecessary on x86 (the only architecture OVMF currently supports), but they align the OVMF virtio code with the virtio specification and could be necessary for future OVMF ports. [1] http://lists.linuxfoundation.org/pipermail/virtualization/2013-June/024547.html Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14601 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/VirtioNetDxe')
-rw-r--r--OvmfPkg/VirtioNetDxe/Events.c1
-rw-r--r--OvmfPkg/VirtioNetDxe/SnpGetStatus.c1
-rw-r--r--OvmfPkg/VirtioNetDxe/SnpReceive.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c
index 3a5b6b492e..b9d7bbf6c6 100644
--- a/OvmfPkg/VirtioNetDxe/Events.c
+++ b/OvmfPkg/VirtioNetDxe/Events.c
@@ -61,6 +61,7 @@ VirtioNetIsPacketAvailable (
//
MemoryFence ();
RxCurUsed = *Dev->RxRing.Used.Idx;
+ MemoryFence ();
if (Dev->RxLastUsed != RxCurUsed) {
gBS->SignalEvent (&Dev->Snp.WaitForPacket);
diff --git a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c b/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
index eabcf93c4b..adb57cf8fe 100644
--- a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
+++ b/OvmfPkg/VirtioNetDxe/SnpGetStatus.c
@@ -103,6 +103,7 @@ VirtioNetGetStatus (
MemoryFence ();
RxCurUsed = *Dev->RxRing.Used.Idx;
TxCurUsed = *Dev->TxRing.Used.Idx;
+ MemoryFence ();
if (InterruptStatus != NULL) {
//
diff --git a/OvmfPkg/VirtioNetDxe/SnpReceive.c b/OvmfPkg/VirtioNetDxe/SnpReceive.c
index 8b3faa38b6..87c6ca9b4b 100644
--- a/OvmfPkg/VirtioNetDxe/SnpReceive.c
+++ b/OvmfPkg/VirtioNetDxe/SnpReceive.c
@@ -105,6 +105,7 @@ VirtioNetReceive (
//
MemoryFence ();
RxCurUsed = *Dev->RxRing.Used.Idx;
+ MemoryFence ();
if (Dev->RxLastUsed == RxCurUsed) {
Status = EFI_NOT_READY;