Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/mips/mips Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/8338f6b52595
branches:  netbsd-9
changeset: 936029:8338f6b52595
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 16 12:34:49 2020 +0000

description:
Pull up following revision(s) (requested by simonb in ticket #1016):

        sys/arch/mips/mips/mips_machdep.c: revision 1.294

Fix mm_md_kernacc() for 64 bit kernels (including n32):
 - FAULT for any physical address less than start of cached XKPHY address.
 - Pass any remaining physical address less then end of RAM.
 - Pass any remaining physical address within the KEGS0 kernel address range.

Ignore all remaining addresses and fall back to uvm_kernacc() for checking
virtual address ranges.

Fixes pmap(1) (and probably other kmem grovellers).

diffstat:

 sys/arch/mips/mips/mips_machdep.c |  27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diffs (55 lines):

diff -r 706fa7bb1325 -r 8338f6b52595 sys/arch/mips/mips/mips_machdep.c
--- a/sys/arch/mips/mips/mips_machdep.c Wed Jul 15 17:27:25 2020 +0000
+++ b/sys/arch/mips/mips/mips_machdep.c Thu Jul 16 12:34:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_machdep.c,v 1.279 2019/03/29 05:23:12 simonb Exp $        */
+/*     $NetBSD: mips_machdep.c,v 1.279.4.1 2020/07/16 12:34:49 martin Exp $    */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.279 2019/03/29 05:23:12 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.279.4.1 2020/07/16 12:34:49 martin Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -2421,21 +2421,28 @@
        const vaddr_t v = (vaddr_t)ptr;
 
 #ifdef _LP64
-       if (v < MIPS_XKPHYS_START) {
+       extern char end[];
+
+       /* For any address < XKPHYS cached address 0, fault */
+       if (v < MIPS_PHYS_TO_XKPHYS_CACHED(0)) {
                return EFAULT;
        }
-       if (MIPS_XKPHYS_P(v) && v > MIPS_PHYS_TO_XKPHYS_CACHED(pmap_limits.avail_end +
+
+       /* If address < XKPHY(end of message buffer), good! */
+       if (v < MIPS_PHYS_TO_XKPHYS_CACHED(pmap_limits.avail_end +
            mips_round_page(MSGBUFSIZE))) {
-               return EFAULT;
-       }
-       if (MIPS_KSEG0_P(v) ||
-           (MIPS_XKSEG_P(v) && v < MIPS_KSEG0_START)) {
+               /* XXX holes in RAM (eg, EdgeRouter 4) */
                *handled = true;
                return 0;
        }
-       if (MIPS_KSEG1_P(v) || MIPS_KSEG2_P(v)) {
-               return EFAULT;
+
+       /* If address in KSEG0 and is before end of kernel, good! */
+       if (MIPS_KSEG0_P(v) && v < (vaddr_t)end) {
+               *handled = true;
+               return 0;
        }
+
+       /* Otherwise, fall back to the uvm_kernacc() check. */
 #else
        if (v < MIPS_KSEG0_START) {
                return EFAULT;



Home | Main Index | Thread Index | Old Index