From nobody Fri Aug 05 20:47:20 2022 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 4LzyMX2Yljz4Xj8X; Fri, 5 Aug 2022 20:47:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LzyMX23tNz42wC; Fri, 5 Aug 2022 20:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659732440; 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=hyhd1kt3Yb4DC6jaAJwLyyH9aejg0KrKqkWYhxsN3wA=; b=ofU6dSeqP4RsiGaSBdU0LFtuqprNeEWO+9Pg1q9DaJ+WU6iK2K75qCtU9FNX7cTI+gBPOb fFKGbZKIy3yNOCYSHKNR1mVOwHJR+UE3aw4VMAHMs84uZcpr4GeNdkGlj26HtIx1cupcNU J5iFFXKu3Ado2dTEVO4l+VSEhZkf6v5sVxOUQi/BAbRODOZHX3hiToWIERPBFjuMWFGw+0 wfaPz9VwdYzdbKJMK/x5jgrNtcaDuVNF62OVPtLriAS5cJdquGuwNzuQDvMbMNDceXeZbG /apYeq1y2pfhRuUj3Bl66Tsu6zYqsZpcsiwZU0gkw020XvXkzHOZ3cJ5MNJw9Q== 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 4LzyMX17Kzz16fJ; Fri, 5 Aug 2022 20:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 275KlKe0070633; Fri, 5 Aug 2022 20:47:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 275KlKBk070632; Fri, 5 Aug 2022 20:47:20 GMT (envelope-from git) Date: Fri, 5 Aug 2022 20:47:20 GMT Message-Id: <202208052047.275KlKBk070632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e9552d8b45d6 - main - arm: Clear TTBCR before enabling the MMU 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9552d8b45d67ca44d91b3ec09c91253e7e99b28 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659732440; 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=hyhd1kt3Yb4DC6jaAJwLyyH9aejg0KrKqkWYhxsN3wA=; b=Omdw3g2lsME+c1T9d0clFHfYrS5WV946P+jZ2bTpmuVoJK+EMCyZXHGGOXn+mhaI9ZNOHs Hb6Y7emHDaR1U4CiZvBoT9jLI+6XDaa/UVQbDEh1bmqTLrzSAXiz/Go+eD09jy3AsbYDSa frWEfMvhlauY+3PuaMpPM6ZyKWvYNHvBw2PHz95IqXaqu4TJs8rhGddVwEEyAMgng7tAzY ULQadmWDn33dEFr0XCUDbagBph06BtFc5wXgcAznGQRozNYxIDqYbpeZ3w0KeKNDJXcTCU D8VElUmY/bPrBRy4ud0iK//JUUdqaFfe87ndYImliXOyfdfnxvPwA3mNhA4/yg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659732440; a=rsa-sha256; cv=none; b=tEKPsuu2IvGMIwF5aBzXmLJ5xtE7DONNQpMWy4JiaLfN/uzIl8jzyWpgM3FlGld9pf37jH Jl1mOgEEpTq08hfVKqoMFrBFu4K09DzZnKfb/OpdLrJoO0ZYRvydrV8Tqqk8zwhijYf2AZ gEK45A7ySMZNchlntTfALGyIPObtS1KmzMWZhxKU5/bf4mVTgPL3FqF9im3dL/Dipgena4 jCOedL8qDCZxhHP/NQBbTl9cwVblKak7p3H5l49+vyMbtpzuv5BfnOqmpfUMvlFVqcy7HV i2aa574QCY39nJ51HuKBux1iKXpkRBtZ15LoP5Y+h0qYJe6EfSPsyZZ0fsRgOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e9552d8b45d67ca44d91b3ec09c91253e7e99b28 commit e9552d8b45d67ca44d91b3ec09c91253e7e99b28 Author: Mark Johnston AuthorDate: 2022-08-05 20:21:09 +0000 Commit: Mark Johnston CommitDate: 2022-08-05 20:21:09 +0000 arm: Clear TTBCR before enabling the MMU Upon reset, this register is supposed to have a value of zero. But when booting certain v7 CPUs in QEMU, we enter the kernel with several bits set, including the EAE bit, which enables ARM's PAE extension. I'm not sure if QEMU is setting it or if it's the uboot loader. Because FreeBSD doesn't implement that extension and uses regular 32-bit page tables, the kernel hangs immediately after enabling the MMU. Just clear everything in TTBCR before enabling the MMU, to match the reset value. FreeBSD doesn't toggle anything in that register. PR: 251187 Reviewed by: imp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36041 --- sys/arm/arm/locore-v6.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S index d796e6267cdc..ad96b0b9d638 100644 --- a/sys/arm/arm/locore-v6.S +++ b/sys/arm/arm/locore-v6.S @@ -294,6 +294,13 @@ ASENTRY_NP(init_mmu) mov r0, #DOMAIN_CLIENT /* Only domain #0 is used */ mcr CP15_DACR(r0) + /* + * Ensure that LPAE is disabled and that TTBR0 is used for translation, + * use a 16KB translation table + */ + mov r0, #0 + mcr CP15_TTBCR(r0) + /* * Set TEX remap registers * - All is set to uncacheable memory