From nobody Fri May 13 03:07:27 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 68BA01AE7D40; Fri, 13 May 2022 03:07:27 +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 4KztqM2VGvz3w6m; Fri, 13 May 2022 03:07:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652411247; 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=gvaCZujnmjMTUXgBySJtPa1cHnVLrjCmGpb2SPSACoM=; b=fWSEhqg15XBQJ1MyTxdWTv8W+dYvY9sofrUPROhw7uPXZSHr9zSaEbU5hqlgfuyZMFUsKX b7RlVYZQRrs5RsTN0mHA179/QER/kU0R1quwxr+Wu/TefKtT+ZEBibpfvwVbXHpndhWW2h 92kyKWsQhfC+wfMyHf88hlA42rDnWUd3qkaOEdVI5PCTRlgCwkKKBpJE65amlvgJby3JlE Xo4Wt12stZnp9fCc9PVtAAiye5wf3xUyPhHzeH1UnAHkDonixRdGwXwyZqDNf15QZwLRVI e0UHYQzpGNNQla2KnMhI6T8j1Dzbl5oy4q9V2afbbCi++R7Hr28WrWiHSVNmXA== 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 356791AE28; Fri, 13 May 2022 03:07:27 +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 24D37RE7062673; Fri, 13 May 2022 03:07:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24D37RNY062672; Fri, 13 May 2022 03:07:27 GMT (envelope-from git) Date: Fri, 13 May 2022 03:07:27 GMT Message-Id: <202205130307.24D37RNY062672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 51adf913e881 - main - arm64: disable the EL2 MMU before dropping to EL1 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51adf913e8815bdc928cb72dd378c596b8b15336 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652411247; 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=gvaCZujnmjMTUXgBySJtPa1cHnVLrjCmGpb2SPSACoM=; b=IuAeQIQPu54s06O70gJJqKdenTiEHxhEh94eJg6apKEFqalDJzOqYMsslQUtlr0jdk79hj gu5HEPVRfR3hbPDjmQ6gCtgF/vR5wxkmXv0SX3JFLxJhonOww/krV2659KnRy7wApo8Fx4 r3mut3XtyjdoYJQx6GBmfYjNAq/Vy0ueOKVNUvrCwLU/6ezeQBw0LrbFZNjuBmE+RX0pGU YLalIPztSQz5wzxU2UdCC6meNiGxXJdOPCaxsgHPxGVufpRDGWhOyurHF75TQTHFBSt3YA 6CZKjttbh13MVD0IOeIJNL0CM/LwVKMtfKYLxmc+UbA0GlXGdcP8cnuZJDhytg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652411247; a=rsa-sha256; cv=none; b=KE+mynP28OtnMuYmwnThKV0AjQAP+d5E6MfGiG65Dyg647S5ugNwjKwCGxCSZTig7rRfV4 zLMmHaWUscyLaFih+UiJBVaz8/ywnsV1xKe3t7yU4cJkX0b82QH3as5ul2ApOlMw43tMs3 g2J3UbTjAfPYJ3CK1MOsNwwgZMML0+XARKAItu0O9m0wdRX/NXuKb556mRnpmdafVp2uO0 gHpwegGvPKsaQM51HFqNEkY2se+D849xuLaHWaUJA6eW1xCMxSsw4jfVqWq2VgCOFKW6nz yEtRYY+0ZiWH/hdHjMxeqJXfCOAE3bLqQw6xDgWmgbQ+6G4heT0fcjksQJ+Y3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=51adf913e8815bdc928cb72dd378c596b8b15336 commit 51adf913e8815bdc928cb72dd378c596b8b15336 Author: Kyle Evans AuthorDate: 2022-05-13 03:03:32 +0000 Commit: Kyle Evans CommitDate: 2022-05-13 03:04:24 +0000 arm64: disable the EL2 MMU before dropping to EL1 An earlier stage may have set HCR_EL2.E2H, the clearing of which may break address translation. We don't need the EL2 MMU at this point, so we can avoid re-enabling it for now and just drop to EL1 as usual. Suggested by: andrew Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D34644 --- sys/arm64/arm64/locore.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index e1b0530006cb..ba85bb4e46b2 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -247,6 +247,16 @@ LENTRY(drop_to_el1) b.eq 1f ret 1: + /* + * Disable the MMU. If the HCR_EL2.E2H field is set we will clear it + * which may break address translation. + */ + dsb sy + mrs x2, sctlr_el2 + bic x2, x2, SCTLR_M + msr sctlr_el2, x2 + isb + /* Configure the Hypervisor */ ldr x2, =(HCR_RW | HCR_APK | HCR_API) msr hcr_el2, x2