Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64 In pmap_devmap_bootstrap(), cpu_earlydevice...



details:   https://anonhg.NetBSD.org/src/rev/2a303ae38f2a
branches:  trunk
changeset: 459499:2a303ae38f2a
user:      ryo <ryo%NetBSD.org@localhost>
date:      Fri Sep 13 18:07:30 2019 +0000

description:
In pmap_devmap_bootstrap(), cpu_earlydevice_va_p() must not return true until *all* devmap tables have been enabled.
console mapping may be present in the last table.

diffstat:

 sys/arch/aarch64/aarch64/pmap.c    |  7 +++++--
 sys/arch/aarch64/include/cpufunc.h |  6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 10d5828267c5 -r 2a303ae38f2a sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Fri Sep 13 17:32:29 2019 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Fri Sep 13 18:07:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.44 2019/09/07 09:57:37 ryo Exp $    */
+/*     $NetBSD: pmap.c,v 1.45 2019/09/13 18:07:30 ryo Exp $    */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.44 2019/09/07 09:57:37 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.45 2019/09/13 18:07:30 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -214,6 +214,7 @@
 
 vaddr_t virtual_avail, virtual_end;
 vaddr_t virtual_devmap_addr;
+bool pmap_devmap_bootstrap_done = false;
 
 static struct pool_cache _pmap_cache;
 static struct pool_cache _pmap_pv_pool;
@@ -338,6 +339,8 @@
                    table[i].pd_prot,
                    table[i].pd_flags);
        }
+
+       pmap_devmap_bootstrap_done = true;
 }
 
 const struct pmap_devmap *
diff -r 10d5828267c5 -r 2a303ae38f2a sys/arch/aarch64/include/cpufunc.h
--- a/sys/arch/aarch64/include/cpufunc.h        Fri Sep 13 17:32:29 2019 +0000
+++ b/sys/arch/aarch64/include/cpufunc.h        Fri Sep 13 18:07:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.h,v 1.6 2019/09/07 11:10:24 ryo Exp $  */
+/*     $NetBSD: cpufunc.h,v 1.7 2019/09/13 18:07:30 ryo Exp $  */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -148,14 +148,14 @@
 static inline bool
 cpu_earlydevice_va_p(void)
 {
-       extern vaddr_t virtual_devmap_addr;     /* in pmap.c */
+       extern bool pmap_devmap_bootstrap_done; /* in pmap.c */
 
        /* This function may be called before enabling MMU, or mapping KVA */
        if ((reg_sctlr_el1_read() & SCTLR_M) == 0)
                return false;
 
        /* device mapping will be availabled after pmap_devmap_bootstrap() */
-       if (virtual_devmap_addr == 0)
+       if (!pmap_devmap_bootstrap_done)
                return false;
 
        return true;



Home | Main Index | Thread Index | Old Index