From owner-svn-src-all@freebsd.org Mon Jan 13 03:39:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E9BD1F5368; Mon, 13 Jan 2020 03:39:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47wzpb11csz3wsG; Mon, 13 Jan 2020 03:39:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E38526485; Mon, 13 Jan 2020 03:39:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00D3d2Ch067583; Mon, 13 Jan 2020 03:39:02 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00D3d2tR067582; Mon, 13 Jan 2020 03:39:02 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202001130339.00D3d2tR067582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 13 Jan 2020 03:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356675 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2020 03:39:03 -0000 Author: mhorne Date: Mon Jan 13 03:39:02 2020 New Revision: 356675 URL: https://svnweb.freebsd.org/changeset/base/356675 Log: RISC-V: fix global symbol lookups for mpentry with lld This is a follow up to r356481. In locore.S, before virtual memory is set up, we should avoid using indirect address lookups through the GOT. Therefore we need to convert uses of the la instruction to lla, which always generates an auipc/addi pair of instructions. This conversion was done for the BSP case, but not the AP case, resulting in a fault somewhere before mpva and a failure to bring APs online. Reported by: lwhsu Reviewed by: lwhsu, jrtc27 (accepted in a comment) Differential Revision: https://reviews.freebsd.org/D23138 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Jan 13 03:36:43 2020 (r356674) +++ head/sys/riscv/riscv/locore.S Mon Jan 13 03:39:02 2020 (r356675) @@ -287,7 +287,7 @@ ENTRY(mpentry) li t1, 4 mulw t1, t1, a0 /* Get the pointer */ - la t0, __riscv_boot_ap + lla t0, __riscv_boot_ap add t0, t0, t1 1: @@ -296,7 +296,7 @@ ENTRY(mpentry) beqz t1, 1b /* Setup stack pointer */ - la t0, secondary_stacks + lla t0, secondary_stacks li t1, (PAGE_SIZE * KSTACK_PAGES) mulw t2, t1, a0 add t0, t0, t2 @@ -306,14 +306,14 @@ ENTRY(mpentry) add sp, t0, t1 /* Setup supervisor trap vector */ - la t0, mpva + lla t0, mpva sub t0, t0, s9 li t1, KERNBASE add t0, t0, t1 csrw stvec, t0 /* Set page tables base register */ - la s2, pagetable_l1 + lla s2, pagetable_l1 srli s2, s2, PAGE_SHIFT li t0, SATP_MODE_SV39 or s2, s2, t0