]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/common/paging.c: For `ARM64`, don't map outside unmap region
authorSergiu Moga <sergiu.moga@protonmail.com>
Sun, 21 May 2023 12:52:01 +0000 (15:52 +0300)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 10:18:45 +0000 (10:18 +0000)
Since on `ARM64` we map all of the peripherals' I/O space statically,
make sure that we do not map the regions in the list that are outside
our globally declared unmap memory region descriptor.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #848

plat/common/paging.c

index cf3cdfefc8d36ca8006dfce8940b53b220cd0fd7..85916163a3d659a9131caa24cfbff942bb138a33 100644 (file)
@@ -1436,6 +1436,8 @@ static inline unsigned long bootinfo_to_page_attr(__u16 flags)
        return prot;
 }
 
+extern struct ukplat_memregion_desc bpt_unmap_mrd;
+
 int ukplat_paging_init(void)
 {
        struct ukplat_memregion_desc *mrd;
@@ -1504,6 +1506,13 @@ int ukplat_paging_init(void)
                vaddr = PAGE_ALIGN_DOWN(mrd->vbase);
                paddr = PAGE_ALIGN_DOWN(mrd->pbase);
                len   = PAGE_ALIGN_UP(mrd->len + (mrd->vbase - vaddr));
+
+#if defined(CONFIG_ARCH_ARM_64)
+               if (!RANGE_CONTAIN(bpt_unmap_mrd.pbase, bpt_unmap_mrd.len,
+                                  paddr, len))
+                       continue;
+#endif
+
                prot  = bootinfo_to_page_attr(mrd->flags);
 
                rc = ukplat_page_map(&kernel_pt, vaddr, paddr,