From nobody Thu Dec 12 21:11:26 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y8QBQ6PDyz5glPl; Thu, 12 Dec 2024 21:11:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y8QBQ5rLHz4LDq; Thu, 12 Dec 2024 21:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734037886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmndM7CUaLyYYiFALdZCWN+zNd3REfdgbsVqTPPiAxM=; b=omS8sB6N9/9vyargFiOwz4UKU5kQCEt0/W/Iy+TTKP5gh3Agfypic9StXIp536Mdj3XI1z 1VhCsGxXkQeWmWkuQgBN1ncO9k7NjNk8Q7sUJbm2hyyRb5WEvilLV+4JhEAatwX3F/woM7 8KKv9tktwR28FTak9S89FnPR9k+C7KyCXnLGERjNhQvCPuix6ZKI+6/SYNLdyfwX6BYHDo 2VX13MjixcToOOiKq5KNfN4iLfm2ECzzH5aFqqTEhGfRyz0LZBxR83zDy2H9crd15yrhId /Hc8MSZ6pG5zB2QEjisX6aslq+y3NKwezQqX1de1Tg9fDtBkasuc4V09KxFm7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734037886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmndM7CUaLyYYiFALdZCWN+zNd3REfdgbsVqTPPiAxM=; b=F/wPkfHmpgkMloLUqv9UPWjfyBCMdhfg63EdeZ1EVA20CQ9+fyWku9UitgCSxHxNpnGSRV GgAqRiqFDGebARvNFBTzbcxBTmHwu5ZymR6CQfMhwM80PXms0JoxmPxGJ0bb9X1kqDyXXK cShp3GdO3KYke98YYle5N5vWI+7+N5aK53kFGuL4/rCJ4pPzDRoeo+B3S3wdBFvywQmYjv TyZ5srYlHh9N3uTUb1eZuSxpAdKL0a3EWj4E0PFwi7GQaGWQv9xhLuZ0BdOIqvfcON5pPv NohEboWvfSSUE6wFmXmPeQMNELHItNNRSV4Nebye8muptz9cp+zdDU3BrVcdoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734037886; a=rsa-sha256; cv=none; b=KabA365eE8j09UobvKXSDAE//FZnmFzU24dUJZ50YTXKQNzwfHK28RSh8rphzV/n9+A57A h+/zHHkDkghkN0ZOgkxjQRQSt3Jm40xUN7q28AbGdmq/frsmw2hGOUpsebBp9mpK8gEAr3 PzHEdRo52hj/2A/OaBwsN0eh5VdxqpWNLPc7ntT87jUDprg5oKMvQmHnvsh5TqWKBapHkT CkCFAZRS5XPTycsSX6EzdsnIQY4NuTGaP7NZ5BWFTv6iDAsrjHRfpkx+KdttpRhuxaTRCc sKdKEmcwiZLbV2nzksej6Kgu954/uWSQrL2WFMkeO07yRdlsSxzCo72Xzb/pNg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y8QBQ5Rlcz18P4; Thu, 12 Dec 2024 21:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BCLBQZc026564; Thu, 12 Dec 2024 21:11:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BCLBQCY026561; Thu, 12 Dec 2024 21:11:26 GMT (envelope-from git) Date: Thu, 12 Dec 2024 21:11:26 GMT Message-Id: <202412122111.4BCLBQCY026561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 2151a0bec08c - stable/12 - mips/malta: Explicitly set AP entry point to _locore List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2151a0bec08c5c08ca1e2cc5419a5392bc76a6cd Auto-Submitted: auto-generated The branch stable/12 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=2151a0bec08c5c08ca1e2cc5419a5392bc76a6cd commit 2151a0bec08c5c08ca1e2cc5419a5392bc76a6cd Author: Jessica Clarke AuthorDate: 2024-12-12 21:07:14 +0000 Commit: Jessica Clarke CommitDate: 2024-12-12 21:11:15 +0000 mips/malta: Explicitly set AP entry point to _locore Otherwise we rely on the firmware implicitly ending up there without faulting. Perhaps the hardware this was tested on does so, but on QEMU this is not the case, as the AP will otherwise re-run bootloader code that tries to reconfigure PCI BARs and ends up faulting, so the AP is never seen by FreeBSD to have started. This matches Linux's arch/mips/kernel/smp-mt.c:vsmp_boot_secondary, which unconditionally writes to TCRestart (this register), albeit using a separate entry point, whilst ours is shared. This is a direct commit to stable/13 as mips no longer exists in main. Obtained from: CheriBSD (diagnosis; patch rewritten from scratch) (cherry picked from commit cc521bcf790bdcc76fddd619f35d0279f22e535a) --- sys/mips/malta/malta_mp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/mips/malta/malta_mp.c b/sys/mips/malta/malta_mp.c index 64aeb3bee93c..efdadae0952d 100644 --- a/sys/mips/malta/malta_mp.c +++ b/sys/mips/malta/malta_mp.c @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include #include +void _locore(__register_t a0, __register_t a1, __register_t a2, + __register_t a3); + #define VPECONF0_VPA (1 << 0) #define MVPCONTROL_VPC (1 << 1) #define MVPCONF0_PVPE_SHIFT 10 @@ -239,11 +242,8 @@ platform_start_ap(int cpuid) set_thread_context(cpuid); - /* - * Hint: how to set entry point. - * reg = 0x80000000; - * mttc0(2, 3, reg); - */ + /* Set entry point */ + mttc0(2, 3, (register_t)&_locore); /* Enable thread */ reg = mftc0(2, 1);