In one of the following patches, we'll change OvmfPkg/IoMmuDxe so that it
unmaps all existent bus master operations (CommonBuffer, Read, Write) at
ExitBootServices(), strictly after the individual device drivers abort
pending DMA on the devices they manage, in their own ExitBootServices()
notification functions.

In preparation, remove the explicit
VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer() calls from VirtioGpuExitBoot(),
originally added in commit 9bc5026c19a5 ("OvmfPkg/VirtioGpuDxe: map VRING
for bus master common buffer operation", 2017-08-26) and commit
f10ae923665f ("OvmfPkg/VirtioGpuDxe: map backing store to bus master
device address", 2017-08-26).

Add a DEBUG message so we can observe the ordering between
VirtioGpuExitBoot() and the upcoming cleanup of mappings in
OvmfPkg/IoMmuDxe.

Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Brijesh Singh <brijesh.si...@amd.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/VirtioGpuDxe/Commands.c | 23 +-------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index 6e70b1c33f65..6ce21976c918 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -351,34 +351,13 @@ VirtioGpuExitBoot (
   IN VOID      *Context
   )
 {
   VGPU_DEV *VgpuDev;
 
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
   VgpuDev = Context;
   VgpuDev->VirtIo->SetDeviceStatus (VgpuDev->VirtIo, 0);
-
-  //
-  // If VirtioGpuDriverBindingStart() and VirtioGpuDriverBindingStop() have
-  // been called thus far in such a sequence that right now our (sole) child
-  // handle exists -- with the GOP on it standing for head (scanout) #0 --,
-  // then we have to unmap the current video mode's backing store.
-  //
-  if (VgpuDev->Child != NULL) {
-    //
-    // The current video mode is guaranteed to have a valid and mapped backing
-    // store, due to the first Gop.SetMode() call, made internally in
-    // InitVgpuGop().
-    //
-    ASSERT (VgpuDev->Child->BackingStore != NULL);
-
-    VgpuDev->VirtIo->UnmapSharedBuffer (
-                       VgpuDev->VirtIo,
-                       VgpuDev->Child->BackingStoreMap
-                       );
-  }
-
-  VgpuDev->VirtIo->UnmapSharedBuffer (VgpuDev->VirtIo, VgpuDev->RingMap);
 }
 
 /**
   Internal utility function that sends a request to the VirtIo GPU device
   model, awaits the answer from the host, and returns a status.
-- 
2.14.1.3.gb7cf6e02401b


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to