ArmVirtualizationPkg/PciHostBridgeDxe: MMIO aperture must not be uncached
Quite non-intuitively, we must allow guest-side writes to emulated PCI MMIO regions to go through the CPU cache, otherwise QEMU, whose accesses always go through the cache, may see stale data in the region. This change makes no difference for QEMU/TCG, but it is important for QEMU/KVM, at the moment. Because gDS->SetMemorySpaceAttributes() is ultimately implemented by EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes() -- see "MdeModulePkg/Core/Dxe/Gcd/Gcd.c" and "ArmPkg/Drivers/CpuDxe/" -- we add the CPU architectural protocol to the module's DepEx. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16904 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -97,6 +97,7 @@ InitializePciHostBridge (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
UINT64 MmioAttributes;
|
||||
EFI_STATUS Status;
|
||||
UINTN Loop1;
|
||||
UINTN Loop2;
|
||||
@@ -133,17 +134,31 @@ InitializePciHostBridge (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
MmioAttributes = FeaturePcdGet (PcdKludgeMapPciMmioAsCached) ?
|
||||
EFI_MEMORY_WB : EFI_MEMORY_UC;
|
||||
|
||||
Status = gDS->AddMemorySpace (
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
PcdGet32 (PcdPciMmio32Base),
|
||||
PcdGet32 (PcdPciMmio32Size),
|
||||
EFI_MEMORY_UC
|
||||
MmioAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "%a: AddMemorySpace: %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gDS->SetMemorySpaceAttributes (
|
||||
PcdGet32 (PcdPciMmio32Base),
|
||||
PcdGet32 (PcdPciMmio32Size),
|
||||
MmioAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "%a: SetMemorySpaceAttributes: %r\n", __FUNCTION__,
|
||||
Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Create Host Bridge Device Handle
|
||||
//
|
||||
|
Reference in New Issue
Block a user