OvmfPkg/LoongArchVirt: Clear the PGD series registers

Since the PGD series registers are in an unknown state when reset, some
simulators will hang when restarting if these registers are not cleared,
so they are cleared in this patch.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Chao Li <lichao@loongson.cn>
This commit is contained in:
Chao Li 2024-08-27 10:30:36 +08:00 committed by mergify[bot]
parent 25da777d95
commit 99e4c8ea93
1 changed files with 6 additions and 0 deletions

View File

@ -141,6 +141,12 @@ ConfigureMemoryManagementUnit (
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
//
// Clear PGD series registers.
//
CsrWrite (LOONGARCH_CSR_PGDL, 0x0);
CsrWrite (LOONGARCH_CSR_PGDH, 0x0);
PageTable = 0; PageTable = 0;
while (MemoryTable->NumberOfPages != 0) { while (MemoryTable->NumberOfPages != 0) {
DEBUG (( DEBUG ((