Module Name:    src
Committed By:   maxv
Date:           Wed Jun 14 08:12:22 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: x86_machdep.c

Log Message:
Fix a bug introduced in bus_space.c::r1.39. This check too is hard-coded.
Might have had a cumulative effect on PR/52000.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/x86/x86/x86_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.91 src/sys/arch/x86/x86/x86_machdep.c:1.92
--- src/sys/arch/x86/x86/x86_machdep.c:1.91	Fri Apr 14 04:43:47 2017
+++ src/sys/arch/x86/x86/x86_machdep.c	Wed Jun 14 08:12:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -514,6 +514,7 @@ static int
 x86_add_cluster(uint64_t seg_start, uint64_t seg_end, uint32_t type)
 {
 	extern struct extent *iomem_ex;
+	const uint64_t endext = MAXIOMEM + 1;
 	uint64_t new_physmem = 0;
 	phys_ram_seg_t *cluster;
 	int i;
@@ -556,15 +557,19 @@ x86_add_cluster(uint64_t seg_start, uint
 	}
 
 	/*
-	 * Allocate the physical addresses used by RAM from the iomem extent
-	 * map. This is done before the addresses are page rounded just to make
+	 * This cluster is used by RAM. If it is included in the iomem extent,
+	 * allocate it from there, so that we won't unintentionally reuse it
+	 * later with extent_alloc_region. A way to avoid collision (with UVM
+	 * for example).
+	 *
+	 * This is done before the addresses are page rounded just to make
 	 * sure we get them all.
 	 */
-	if (seg_start < 0x100000000ULL) {
+	if (seg_start < endext) {
 		uint64_t io_end;
 
-		if (seg_end > 0x100000000ULL)
-			io_end = 0x100000000ULL;
+		if (seg_end > endext)
+			io_end = endext;
 		else
 			io_end = seg_end;
 

Reply via email to