diff options
author | Laszlo Ersek <lersek@redhat.com> | 2013-08-23 18:46:03 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-23 18:46:03 +0000 |
commit | dc9447bd3777614529b711c9976979fe61822ba8 (patch) | |
tree | 02fe72a3e29eaea6d49b58a47dcf8e9e0a553f0b /OvmfPkg | |
parent | 9bef3cdc8a9d9f9344bd9cb94af3bbdc4ec5ed4d (diff) | |
download | edk2-dc9447bd3777614529b711c9976979fe61822ba8.zip edk2-dc9447bd3777614529b711c9976979fe61822ba8.tar.gz edk2-dc9447bd3777614529b711c9976979fe61822ba8.tar.bz2 |
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')
-rw-r--r-- | OvmfPkg/Library/VirtioLib/VirtioLib.c | 1 | ||||
-rw-r--r-- | OvmfPkg/VirtioNetDxe/Events.c | 1 | ||||
-rw-r--r-- | OvmfPkg/VirtioNetDxe/SnpGetStatus.c | 1 | ||||
-rw-r--r-- | OvmfPkg/VirtioNetDxe/SnpReceive.c | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/VirtioLib/VirtioLib.c index 87797e1..959bc5d 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -456,5 +456,6 @@ VirtioFlush ( MemoryFence();
}
+ MemoryFence();
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c index 3a5b6b4..b9d7bbf 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 eabcf93..adb57cf 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 8b3faa3..87c6ca9 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;
|