[coreboot-gerrit] New patch to review for coreboot: libpayload: arm64: Fix MMU range overlap check

Julius Werner (jwerner@chromium.org) gerrit at coreboot.org
Fri Aug 5 20:05:26 CEST 2016


Julius Werner (jwerner at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16075

-gerrit

commit 2fb91f88d64bfddaa89bb33d1c97032e7b0d413c
Author: Julius Werner <jwerner at chromium.org>
Date:   Fri Aug 5 10:37:52 2016 -0700

    libpayload: arm64: Fix MMU range overlap check
    
    The ARM64 MMU code maintains a list of used ranges, to avoid mapping the
    DMA buffer over the coreboot tables and things like that. Unfortunately,
    the overlap with ranges in that list is checked with
    
     (start1 >= start2 && start1 <= end2) || (end1 >= start2 && end1 <= end2)
    
    which is not a full overlap check and misses the case where the second
    region is completely contained within the first. This patch replaces
    that code with a properly vetted primitive from Stack Overflow.
    
    BRANCH=none
    BUG=chrome-os-partner:54416
    TEST=Observe how Kevin recovery screen now gets drawn at 10x the speed.
    
    Change-Id: I7e2706426762794e160d743bbfc40da1e26eee12
    Signed-off-by: Julius Werner <jwerner at chromium.org>
---
 payloads/libpayload/arch/arm64/mmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c
index 50e7f6c..d84f969 100644
--- a/payloads/libpayload/arch/arm64/mmu.c
+++ b/payloads/libpayload/arch/arm64/mmu.c
@@ -441,8 +441,7 @@ static int mmu_is_range_free(uint64_t r_base,
 		uint64_t start = r[i].base;
 		uint64_t end = start + r[i].size;
 
-		if (((r_base >= start) && (r_base <= end)) ||
-		    ((r_end >= start) && (r_end <= end)))
+		if ((start < r_end) && (end > r_base))
 			return 0;
 	}
 



More information about the coreboot-gerrit mailing list