Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch/aarch64/aarch64 Pull up following revision(s) (r...
details: https://anonhg.NetBSD.org/src/rev/132ace5e2404
branches: netbsd-9
changeset: 942516:132ace5e2404
user: martin <martin%NetBSD.org@localhost>
date: Mon Nov 09 11:47:15 2020 +0000
description:
Pull up following revision(s) (requested by skrll in ticket #1128):
sys/arch/aarch64/aarch64/pmapboot.c: revision 1.11
Fix the use of the contiguous bit by checking the output address as well.
diffstat:
sys/arch/aarch64/aarch64/pmapboot.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diffs (80 lines):
diff -r ba8358504707 -r 132ace5e2404 sys/arch/aarch64/aarch64/pmapboot.c
--- a/sys/arch/aarch64/aarch64/pmapboot.c Sun Nov 08 08:40:01 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmapboot.c Mon Nov 09 11:47:15 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmapboot.c,v 1.4 2019/07/18 06:47:36 skrll Exp $ */
+/* $NetBSD: pmapboot.c,v 1.4.2.1 2020/11/09 11:47:15 martin Exp $ */
/*
* Copyright (c) 2018 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmapboot.c,v 1.4 2019/07/18 06:47:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmapboot.c,v 1.4.2.1 2020/11/09 11:47:15 martin Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -44,7 +44,6 @@
#include <aarch64/pmap.h>
#include <aarch64/pte.h>
-
#define OPTIMIZE_TLB_CONTIG
@@ -157,16 +156,23 @@
#ifdef OPTIMIZE_TLB_CONTIG
static inline bool
-tlb_contiguous_p(vaddr_t addr, vaddr_t start, vaddr_t end, vsize_t blocksize)
+tlb_contiguous_p(vaddr_t va, paddr_t pa, vaddr_t start, vaddr_t end,
+ vsize_t blocksize)
{
/*
* when using 4KB granule, 16 adjacent and aligned entries can be
* unified to one TLB cache entry.
* in other size of granule, not supported.
*/
- if (((addr & ~((blocksize << 4) - 1)) >= start) &&
- ((addr | ((blocksize << 4) - 1)) <= end))
+ const vaddr_t mask = (blocksize << 4) - 1;
+
+ /* if the output address doesn't align it can't be contiguous */
+ if ((va & mask) != (pa & mask))
+ return false;
+
+ if ((va & ~mask) >= start && (va | mask) <= end)
return true;
+
return false;
}
#endif /* OPTIMIZE_TLB_CONTIG */
@@ -284,7 +290,7 @@
#endif
attr;
#ifdef OPTIMIZE_TLB_CONTIG
- if (tlb_contiguous_p(va, va_start, va_end, blocksize))
+ if (tlb_contiguous_p(va, pa, va_start, va_end, blocksize))
pte |= LX_BLKPAG_CONTIG;
ll = l1;
llidx = idx1;
@@ -329,7 +335,7 @@
#endif
attr;
#ifdef OPTIMIZE_TLB_CONTIG
- if (tlb_contiguous_p(va, va_start, va_end, blocksize))
+ if (tlb_contiguous_p(va, pa, va_start, va_end, blocksize))
pte |= LX_BLKPAG_CONTIG;
ll = l2;
llidx = idx2;
@@ -373,7 +379,7 @@
#endif
attr;
#ifdef OPTIMIZE_TLB_CONTIG
- if (tlb_contiguous_p(va, va_start, va_end, blocksize))
+ if (tlb_contiguous_p(va, pa, va_start, va_end, blocksize))
pte |= LX_BLKPAG_CONTIG;
ll = l3;
llidx = idx3;
Home |
Main Index |
Thread Index |
Old Index