The branch main has been updated by andrew:

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

commit f3ef799f564515b58a24a328739a4c749a02b110
Author:     Andrew Turner <[email protected]>
AuthorDate: 2022-04-09 11:43:08 +0000
Commit:     Andrew Turner <[email protected]>
CommitDate: 2022-04-10 08:41:54 +0000

    Only return a mapped address from efi_phys_to_kva
    
    On some hardware the EFI system table is not in memory mapped in the
    DMAP section. Rather than panic the kernel check if it is mapped and
    return a failure if not from efi_phys_to_kva.
    
    Reported by:    kevans
    Differential Revision: https://reviews.freebsd.org/D34858
---
 sys/arm64/arm64/efirt_machdep.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/efirt_machdep.c b/sys/arm64/arm64/efirt_machdep.c
index 6e6541900efb..727c9c37f94d 100644
--- a/sys/arm64/arm64/efirt_machdep.c
+++ b/sys/arm64/arm64/efirt_machdep.c
@@ -150,10 +150,17 @@ efi_1t1_l3(vm_offset_t va)
 vm_offset_t
 efi_phys_to_kva(vm_paddr_t paddr)
 {
+       vm_offset_t vaddr;
 
-       if (!PHYS_IN_DMAP(paddr))
-               return (0);
-       return (PHYS_TO_DMAP(paddr));
+       if (PHYS_IN_DMAP(paddr)) {
+               vaddr = PHYS_TO_DMAP(paddr);
+               if (pmap_klookup(vaddr, NULL))
+                       return (vaddr);
+       }
+
+       /* TODO: Map memory not in the DMAP */
+
+       return (0);
 }
 
 /*

Reply via email to