Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 Avoid mismatched memory attributes ...



details:   https://anonhg.NetBSD.org/src/rev/2e566741b81d
branches:  trunk
changeset: 949311:2e566741b81d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jan 09 15:07:42 2021 +0000

description:
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.

diffstat:

 sys/arch/aarch64/aarch64/locore.S |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 1fe50431f9f2 -r 2e566741b81d sys/arch/aarch64/aarch64/locore.S
--- a/sys/arch/aarch64/aarch64/locore.S Sat Jan 09 14:37:16 2021 +0000
+++ b/sys/arch/aarch64/aarch64/locore.S Sat Jan 09 15:07:42 2021 +0000
@@ -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 <ryo%nerv.org@localhost>
@@ -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 @@
        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 @@
        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



Home | Main Index | Thread Index | Old Index