From nobody Fri Aug 19 11:54:33 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 4M8KtK6W4Hz4YvP9; Fri, 19 Aug 2022 11:54:33 +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 4M8KtK5L3bz3yhr; Fri, 19 Aug 2022 11:54:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660910073; 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=NLwjLdlvhZjTDcM4r8K5z84FLGPAdcJWFA5OSQHjJbw=; b=v3GSpQQ+J5hKSGyqvOo3x8Z8uTtWeTiZCu5/+gGzJePj+LGv/lrcoINuYp4pnJj7AM9A+H KqtKMGD2mr6FidMUizGtOLKOhfEZfP6riNExS+m/h3dj2muVT1H2uxtJMDMAZSSqxLBftc 2s5dq6fPuLZF/A85j+Oc0tbwWT7BEMeVcPQITSncAh1y0oFCB+z69s2+VzAJO8wWGxW8Rh rkJI3tsrI1JwFSGNsCT/n+G3tBaESpGVbGewOY0oTkvp262/DwBgQRN4zaeX3pe2Q345D7 NJwm2G0129nL7pslza7Scnh5j7njFJWbkfyGk/6AG8Gt5cp0QikqpOw0hnKsww== 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 4M8KtK4Q50zsG5; Fri, 19 Aug 2022 11:54:33 +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 27JBsXBB080897; Fri, 19 Aug 2022 11:54:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27JBsXQl080896; Fri, 19 Aug 2022 11:54:33 GMT (envelope-from git) Date: Fri, 19 Aug 2022 11:54:33 GMT Message-Id: <202208191154.27JBsXQl080896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 363d4b3b42c1 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 363d4b3b42c1d5ec9a2543a0d1f8068cd7f8b87f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660910073; 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=NLwjLdlvhZjTDcM4r8K5z84FLGPAdcJWFA5OSQHjJbw=; b=nY1Vrj2VvOZuQolzbIkaRAcnGX3DFrg8T4s4bs/bvegHSI2xg5gwkvHjkbFEEL7YTGYTbh cvShYbSF1sHv5r/Qn1iMcAfIPyau+YlaOfxocupZvvN6KC0xwlerBDw6h+NI5U1mJ5C9+O 32lUWs9FotuUtfW7URQd4oZw/3i/LVs/HhBj3hOouo893ZJxC9uzfyqV079M6jLpcNDw71 ydcJrTUOoQdyW/XBhDRlOJ5bj4xfq+ttWPQuhFGhoPX2faXZQctNZ2GhtDtCeOJqpG+nDs xdGpxLUfhZkeBgMmPz5mlFf/fQkUIdhwSOUQ0YP0TmXEcARORGFlsPtxvwydig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660910073; a=rsa-sha256; cv=none; b=RlXPhk045X6k9sVqXsn5NHmev3A0WTPRWYFNBZ8C4cZ4ipdEc+OjkPjP4AEYo5QL3b21C2 +3w7PhPoScDROdzXKxasSvZwQSWWrA4tqQ/flOaekyhPWUxMLkVjJIhvz51WG7WlDH5lJn NbklbLPGWDwf7VllliBw5UqI/T4QUD9hQ+1+yNHsB5zJrRx+I1+e3/798/6y9j01GSMD9S FOjrlW1bVUE5GnvFOuT9rh7iqvBcAKUuqL+gBRWJXNkOKfbUN/Se9CxDZsGGS3+nwdtfD/ Suc5iOOe4gWtk8lfLASuvOBkCz3lG7Hswnw//KRfXx0NRfNbGIT8vnBLtvbiDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=363d4b3b42c1d5ec9a2543a0d1f8068cd7f8b87f commit 363d4b3b42c1d5ec9a2543a0d1f8068cd7f8b87f Author: Mark Johnston AuthorDate: 2022-08-05 20:21:09 +0000 Commit: Mark Johnston CommitDate: 2022-08-19 11:54:14 +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 Sponsored by: The FreeBSD Foundation (cherry picked from commit e9552d8b45d67ca44d91b3ec09c91253e7e99b28) --- 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