Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2019 15:58:11 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348994 - head/sys/powerpc/aim
Message-ID:  <201906121558.x5CFwB5V017292@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdragon
Date: Wed Jun 12 15:58:11 2019
New Revision: 348994
URL: https://svnweb.freebsd.org/changeset/base/348994

Log:
  Fix PPC970 boot after r348783
  
  r348783 changed the behavior of the kernel mappings and broke booting on G5.
  
  - Split the kernel mapping logic out so that the case where we are
  running from the wrong memory space is handled using identity
  mappings, and the case where we are not using a DMAP is handled by
  forcibly mapping the kernel into the dmap range as intended by
  r348783.
  
  Reported by:	Mikael Urankar
  Reviewed by:	luporl
  Approved by:	jhibbits (mentor)
  Differential Revision:	https://reviews.freebsd.org/D20608

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Wed Jun 12 13:34:12 2019	(r348993)
+++ head/sys/powerpc/aim/mmu_oea64.c	Wed Jun 12 15:58:11 2019	(r348994)
@@ -684,8 +684,16 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
 	 * without a direct map or on which the kernel is not already executing
 	 * out of the direct-mapped region.
 	 */
-
-	if (!hw_direct_map || kernelstart < DMAP_BASE_ADDRESS) {
+	if (kernelstart < DMAP_BASE_ADDRESS) {
+		/*
+		 * For pre-dmap execution, we need to use identity mapping
+		 * because we will be operating with the mmu on but in the
+		 * wrong address configuration until we __restartkernel().
+		 */
+		for (pa = kernelstart & ~PAGE_MASK; pa < kernelend;
+		    pa += PAGE_SIZE)
+			moea64_kenter(mmup, pa, pa);
+	} else if (!hw_direct_map) {
 		pkernelstart = kernelstart & ~DMAP_BASE_ADDRESS;
 		pkernelend = kernelend & ~DMAP_BASE_ADDRESS;
 		for (pa = pkernelstart & ~PAGE_MASK; pa < pkernelend;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906121558.x5CFwB5V017292>