Module Name:    src
Committed By:   jmcneill
Date:           Sat Jan  9 15:07:42 UTC 2021

Modified Files:
        src/sys/arch/aarch64/aarch64: locore.S

Log Message:
Avoid mismatched memory attributes for kernel and page table memory.

The initial page table code enters mappings first through an identity
mapped normal-NC mapping. Then later on, additional mappings are added
through a KVA-mapped normal-WB mapping. There is a warning about this
in the Armv8 ARM:

  Bytes written without the Write-Back cacheable attribute within the
  same Write-Back granule as bytes written with the Write-Back cacheable
  attribute might have their values reverted to the old values as a result
  of cache Write-Back.

Change the identity mapping attributes to match the KVA-mapping. This
fixes an issue where the kernel often doesn't start under ESXi-Arm Fling.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/aarch64/aarch64/locore.S

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/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.75 src/sys/arch/aarch64/aarch64/locore.S:1.76
--- src/sys/arch/aarch64/aarch64/locore.S:1.75	Sat Dec 26 00:55:26 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Sat Jan  9 15:07:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.75 2020/12/26 00:55:26 jmcneill Exp $	*/
+/*	$NetBSD: locore.S,v 1.76 2021/01/09 15:07:42 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <r...@nerv.org>
@@ -38,7 +38,7 @@
 #include <aarch64/hypervisor.h>
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.75 2020/12/26 00:55:26 jmcneill Exp $")
+RCSID("$NetBSD: locore.S,v 1.76 2021/01/09 15:07:42 jmcneill Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -865,7 +865,8 @@ init_mmutable:
 	sub	x2, x2, x1			/* size = _end - start */
 	add	x2, x2, #PMAPBOOT_PAGEALLOCMAX	/* for pmapboot_pagealloc() */
 	mov	x3, #L2_SIZE			/* blocksize */
-	mov	x4, #LX_BLKPAG_ATTR_NORMAL_NC | LX_BLKPAG_AP_RW	/* attr */
+	mov	x4, #LX_BLKPAG_ATTR_NORMAL_WB | LX_BLKPAG_AP_RW	/* attr */
+	orr	x4, x4, #LX_BLKPAG_UXN
 	mov	x5, x26				/* pr func */
 	bl	pmapboot_enter
 	cbnz	x0, init_mmutable_error
@@ -879,7 +880,7 @@ init_mmutable:
 	mov	x1, x8				/* pa */
 	mov	x2, #L2_SIZE			/* size */
 	mov	x3, #L2_SIZE			/* blocksize */
-	mov	x4, #LX_BLKPAG_ATTR_NORMAL_NC | LX_BLKPAG_AP_RW
+	mov	x4, #LX_BLKPAG_ATTR_NORMAL_WB | LX_BLKPAG_AP_RW
 	orr	x4, x4, #LX_BLKPAG_UXN | LX_BLKPAG_PXN	/* attr */
 	mov	x5, x26				/* pr func */
 	bl	pmapboot_enter

Reply via email to