Module Name:    src
Committed By:   skrll
Date:           Mon Dec 30 16:06:29 UTC 2019

Modified Files:
        src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Invalidate the cache just before trying to read the results from the
firmware as RPI4 A72s can fill the cache with speculation


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/broadcom/bcm283x_platform.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/arm/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.29 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.30
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.29	Mon Dec 30 15:36:37 2019
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Mon Dec 30 16:06:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.29 2019/12/30 15:36:37 skrll Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.30 2019/12/30 16:06:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.29 2019/12/30 15:36:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.30 2019/12/30 16:06:29 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -744,6 +744,13 @@ bcm283x_bootparams(bus_space_tag_t iot, 
 
 	bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res);
 
+	/*
+	 * RPI4 has Cortex A72 processors which do speculation, so
+	 * we need to invalidate the cache for an updates done by
+	 * the firmware
+	 */
+	cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb));
+
 	if (!vcprop_buffer_success_p(&vb.vb_hdr)) {
 		bootconfig.dramblocks = 1;
 		bootconfig.dram[0].address = 0x0;

Reply via email to