summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/PiDxeS3BootScriptLib
diff options
context:
space:
mode:
authorDongyan Qian <qiandongyan@loongson.cn>2026-08-19 04:25:33 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-08-31 14:13:39 +0300
commit5e1db3b4a457d83e3ddace716a7e60e68f3ffb61 (patch)
treeb18e126c60b9b3bf259c91b3dffd490b99f587fc /MdeModulePkg/Library/PiDxeS3BootScriptLib
parent8bf75267f9311a8a66a3864ee71426c70bb288bb (diff)
downloadedk2-5e1db3b4a457d83e3ddace716a7e60e68f3ffb61.tar.xz
UefiCpuPkg/LoongArch64: Keep no-read mappings valid
The LoongArch64 MMU code currently makes EFI_MEMORY_RP effective by setting PAGE_NO_READ and then clearing PAGE_PRESENT and PAGE_VALID. That is a conservative guard-page fallback, but it is stronger than the architectural read-protect mapping requested by EFI_MEMORY_RP. Restore the pure no-read behavior by leaving the PTE present and valid and relying on PAGE_NO_READ to request a read-protected mapping. A PTE with P=1, V=1, and NR=1 should fault a data load with a non-readable-page exception in both the hardware page-table-walk and software TLB refill paths. An older QEMU binary used during bring-up exposed an emulator issue in the software refill path: the page-table PTE contained NR=1, but after LDPTE/TLBFILL the guest TLB entry lost NR, so QEMU installed the mapping as readable. That QEMU issue was fixed by: 2d877bc02a3b (target/loongarch: Preserve PTE permission bits in LDPTE) That QEMU change preserves the architecturally defined LoongArch64 PTE permission bits, including NR, NX, and RPLV, when LDPTE sanitizes the hardware PTE. Newer QEMU and real hardware should therefore honor PAGE_NO_READ without requiring firmware to make the mapping not present or invalid. Keeping PAGE_PRESENT and PAGE_VALID also avoids turning every EFI_MEMORY_RP request into a fully invalid PTE. The NULL-page use case still receives read protection through PAGE_NO_READ, while the implementation remains aligned with the intended memory-attribute semantics. Link: https://github.com/qemu/qemu/commit/2d877bc02a3b Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib')
0 files changed, 0 insertions, 0 deletions