Date: Wed, 13 Jun 2018 10:32:21 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335047 - head/sys/riscv/riscv Message-ID: <201806131032.w5DAWLCR045247@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806131032.w5DAWLCR045247>