From 21e57370fc238735d01bd0bb852003e0e0bfe36f Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 7 Sep 2017 14:24:22 +0200 Subject: [PATCH] OvmfPkg/VirtioRngDxe: don't unmap VRING at ExitBootServices() 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() call from VirtioRngExitBoot(), originally added in commit 0a568ccbcbd1 ("OvmfPkg/VirtioRngDxe: map host address to device address", 2017-08-23). Add a DEBUG message so we can observe the ordering between VirtioRngExitBoot() and the upcoming cleanup of mappings in OvmfPkg/IoMmuDxe. Cc: Ard Biesheuvel Cc: Brijesh Singh Cc: Jiewen Yao Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Brijesh Singh Tested-by: Brijesh Singh --- OvmfPkg/VirtioRngDxe/VirtioRng.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c index 80380bcdf8..3c733ea4db 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -435,6 +435,7 @@ VirtioRngExitBoot ( { VIRTIO_RNG_DEV *Dev; + DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context)); // // Reset the device. This causes the hypervisor to forget about the virtio // ring. @@ -444,12 +445,6 @@ VirtioRngExitBoot ( // Dev = Context; Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); - - // - // Unmap the ring buffer so that hypervisor will not be able to get readable - // data after device reset. - // - Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap); }