svn commit: r335047 - head/sys/riscv/riscv
Ruslan Bukin
br at FreeBSD.org
Wed Jun 13 10:32:22 UTC 2018
Author: br
Date: Wed Jun 13 10:32:21 2018
New Revision: 335047
URL: https://svnweb.freebsd.org/changeset/base/335047
Log:
Don't jump to VA space until kernel is ready.
This fixes the race when first core sets up the pagetables, while
secondary cores do translating the address of __riscv_boot_ap.
This now allows us to smpboot in QEMU with 8 cores just fine.
Sponsored by: DARPA, AFRL
Modified:
head/sys/riscv/riscv/locore.S
Modified: head/sys/riscv/riscv/locore.S
==============================================================================
--- head/sys/riscv/riscv/locore.S Wed Jun 13 09:28:47 2018 (r335046)
+++ head/sys/riscv/riscv/locore.S Wed Jun 13 10:32:21 2018 (r335047)
@@ -263,6 +263,21 @@ END(mpentry)
* Called by a core when it is being brought online.
*/
ENTRY(mpentry)
+ /*
+ * Calculate the offset to __riscv_boot_ap
+ * for the current core, cpuid is in a0.
+ */
+ li t1, 4
+ mulw t1, t1, a0
+ /* Get the pointer */
+ la t0, __riscv_boot_ap
+ add t0, t0, t1
+
+1:
+ /* Wait the kernel to be ready */
+ lw t1, 0(t0)
+ beqz t1, 1b
+
/* Setup stack pointer */
la t0, secondary_stacks
li t1, (PAGE_SIZE * KSTACK_PAGES)
@@ -296,20 +311,6 @@ mpva:
/* Ensure sscratch is zero */
li t0, 0
csrw sscratch, t0
- /*
- * Calculate the offset to __riscv_boot_ap
- * for current core, cpuid in a0.
- */
- li t1, 4
- mulw t1, t1, a0
- /* Get pointer */
- la t0, __riscv_boot_ap
- add t0, t0, t1
-
-1:
- /* Wait the kernel to be ready */
- lw t1, 0(t0)
- beqz t1, 1b
call init_secondary
END(mpentry)
More information about the svn-src-all
mailing list