From nobody Sun Sep 18 06:27:02 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 4MVdBZ6Whtz4c2vf; Sun, 18 Sep 2022 06:27:02 +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 4MVdBZ666tz3XtS; Sun, 18 Sep 2022 06:27:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663482422; 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=d0vbsay7pC95PKjy8Sz/bdnHkAJIugEa/uszzF8B+Gc=; b=qwAUDKvoGVsbHZBYfyjFAL8Rm5OQuDzOfnLFe6dniC5JU3lC2naP/AacgMM/OV3flkDKfN iYK0ULNtGLRsTRBDfJE0do+S+EsVmPOX03EHHfqBkRS7BBdCS84YlXFe4/8dsgvQcfKIOp AHXLCh4iE9Fok6fROYw4aHW1NWw5xDaN4qeMocsIUGVzG7QsilJFCuxBUnnksRMSSxJZz5 msKWWeDDlLD9Wxx5vL238nuVsyo5NWtAb/JKZ75Up0lMcA/e/6BcU2PJ3KyxNl3GCHrCvi ooYSfdB8TLc6rIsWJf0dsPv9py1F7/YvwnfstWiDq8xddycVhzv19PfwEcDcKg== 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 4MVdBZ5Btqzxdb; Sun, 18 Sep 2022 06:27:02 +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 28I6R2ST067744; Sun, 18 Sep 2022 06:27:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28I6R2xd067743; Sun, 18 Sep 2022 06:27:02 GMT (envelope-from git) Date: Sun, 18 Sep 2022 06:27:02 GMT Message-Id: <202209180627.28I6R2xd067743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 5a08fbb315e8 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a08fbb315e82a08022e205e2c2ea4f4d0857f9e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663482422; 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=d0vbsay7pC95PKjy8Sz/bdnHkAJIugEa/uszzF8B+Gc=; b=PIVycdTSqf02ApMzCFZhz9A0UKF5sjCLyfz7xgI6S6x9I6ZmZHMpU0YG0x4S8qBoY0WtC9 REXc6PfrLnuMxImM0xL6zVYPkBx3ZsIe63oOXaRQeKhUBcGzUDaYD/SpP1dV4s38K2SuD7 2je2dVq/C8iGyniuknQbnyECq+0EPmcIXaShyaNZ6dd6iEVZ62cSKFTbRmyxkbzPBoFPj5 6WGIrm2xhypqVttPPvAjRnlLW95/4KE1bT064z6YUxHaJlIFnHmgsne8R+SkN/YfEMTZUs uPQKwmXdjeYgSS7pxE0ozch0I36de3PIOgU6Muc7shiB3wXmJFw2fJcn9WPsFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663482422; a=rsa-sha256; cv=none; b=uPnp0I3RMBTTRuUaltl+J3DjZio+pJwpC9RHMWAJ53xEZC75lmX0CW+2oOZkXDRryel2jw AGQ9MNw4kLa78R/A6tXCXZCgfLK2chtql6OmbIRihdhynoz5IQf81OZmVix5yQDKzcM6Sl VlTjduvphFX/9sM5oTCzewCO7En19FKY4GujYCHxOADS1sIFUTlCr/+hzGFer7N/adETcU zKoh5lDqiT3VIZwXJ2q0DQoO61E4Ysi2soFAIKibuO7MaZkZkj4jlxI69xrRk+vPfPuXFg Xw8prVGtrAgLQFzDCSVNOosEnowyeYv1ctDzF95nioCBg9YMZsrmyv/QgMJfyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5a08fbb315e82a08022e205e2c2ea4f4d0857f9e commit 5a08fbb315e82a08022e205e2c2ea4f4d0857f9e Author: Kyle Evans AuthorDate: 2022-05-13 03:03:32 +0000 Commit: Kyle Evans CommitDate: 2022-09-18 06:26:39 +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 (cherry picked from commit 51adf913e8815bdc928cb72dd378c596b8b15336) --- 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 9aeb83008a15..94c8f8b87403 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -237,6 +237,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 */ mov x2, #(HCR_RW) msr hcr_el2, x2