git: 0247c33e89ad - main - amd64 efirt: initialize vm_pages backing EFI runtime memory

Konstantin Belousov kib at FreeBSD.org
Thu Jun 17 14:12:32 UTC 2021


The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0247c33e89adaf0c7159b847ef7bae9566e55395

commit 0247c33e89adaf0c7159b847ef7bae9566e55395
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-06-16 01:59:06 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-06-17 13:58:51 +0000

    amd64 efirt: initialize vm_pages backing EFI runtime memory
    
    so that PHYS_TO_VM_PAGE() and consequently physcopyin() work for them
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D30785
---
 sys/amd64/amd64/efirt_machdep.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c
index 3c8392bee86f..6fb64816385e 100644
--- a/sys/amd64/amd64/efirt_machdep.c
+++ b/sys/amd64/amd64/efirt_machdep.c
@@ -180,6 +180,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz)
 	struct efi_md *p;
 	pt_entry_t *pte;
 	void *pml;
+	vm_page_t m;
 	vm_offset_t va;
 	uint64_t idx;
 	int bits, i, mode;
@@ -247,6 +248,14 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz)
 		    va += PAGE_SIZE) {
 			pte = efi_1t1_pte(va);
 			pte_store(pte, va | bits);
+
+			m = PHYS_TO_VM_PAGE(va);
+			if (m != NULL && VM_PAGE_TO_PHYS(m) == 0) {
+				vm_page_init_page(m, va, -1);
+				m->order = VM_NFREEORDER + 1; /* invalid */
+				m->pool = VM_NFREEPOOL + 1; /* invalid */
+				pmap_page_set_memattr(m, mode);
+			}
 		}
 		VM_OBJECT_WUNLOCK(obj_1t1_pt);
 	}


More information about the dev-commits-src-all mailing list