From nobody Tue Aug 20 09:02:27 2024 X-Original-To: dev-commits-src-main@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 4Wp3Pw1jDkz5Sj9N; Tue, 20 Aug 2024 09:02:28 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wp3Pv6mlhz4vbF; Tue, 20 Aug 2024 09:02:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724144548; 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=nq4RrZgPMfl/PqXOPWc0h4xaoEC9jPHAXUWpFGdR904=; b=TCfchDPjfKr896Cwr35y4XiRdqgLmlf3ssu8XznZM1Pt54gidZ/cuv+p0p486euIXV5qfz Oxnga0YoUQ31pm5166s7sYfTBJt6Kpy+wamw8pvUCkfb4B3bCcDDV+MD3MFahQVTlBBTfF jEhVBvfaEIcBksCWzZqnwpa9W5xBzb/p1ZHRBhDKRY7pyZRxnATfJ9SZb9zYvA/TBm9DPX juZc4zPuIvGFK5XcF6SoLKazthN6iS4FIjZHYmupq50zpnyjZq9ccfFR4EMAso6OPbjX0N d6hXeTxKuSiO8FWkMUh3t1VOIpH5iiqdPumRTm+ryuCmH5WfUbmTAKZ5/9k0ig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724144548; a=rsa-sha256; cv=none; b=cvW6YYsvvOBmbzeTlQKfXxD2nVvOuTKCLRmyA4RTbtDdQ3ccmHu8D1YQRSOnxx/yge5Rrf zLAfamE+2GrWyZiCOcPnWgX6CI/TRO4636p5ApaCXW7Okk0aaoM/Nf3+UM2C+Lj7Z0NJgM ctLgolV2wbrYeNgVtpLnQPVoNMTCpWiM42lH+StF2SgHpCLpe9z51zsl4mNRiFMI5Rx3N1 j8z5zLroRmqXAFvS4wDtCq50A4Kv6buzmIBkW0wNhNuaCmIkGmD7YBkpDuADszx1sR1MC6 qcEHs/dJTIoBPCqvMx/fMwIppzCTyfTvpAdhKrRfbSLOxH2/onQ7l5GReMb85A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724144547; 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=nq4RrZgPMfl/PqXOPWc0h4xaoEC9jPHAXUWpFGdR904=; b=yEZp0Ji/d+1kdckSgfLpo+zF+JpA5Ve+PThrgmVCxt7rCpmhhuDchBG+q2WFQnW1VfkxPY 6NKx0cEkqlV3XHLQBikv1o8lokHWtNptEHuYaFKfLDrMSRJchtYQ33tAvThKJVTtbgE4XE JCHVJ6RN2zx/y8UcM86eAfZO82KZ6Tmxw9S/TtKUR/xd7Ruv4doZ+sforYlDadc9LV+KKx AG+UaPCPRQYxYnVpol4Nfu5UKRZ4YgT3VZY7u/qCLQ9/zhoRv3AUFhE+/YEL6PL04F19sb Bos8fe+ZNAL8wHttTSEtkI3uT3+Sj2kA/jr5fobVVpVZBVHkr67TnoBUwltv2Q== 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 4Wp3Pv6MgXztpl; Tue, 20 Aug 2024 09:02:27 +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 47K92Ro0081940; Tue, 20 Aug 2024 09:02:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47K92Rpv081937; Tue, 20 Aug 2024 09:02:27 GMT (envelope-from git) Date: Tue, 20 Aug 2024 09:02:27 GMT Message-Id: <202408200902.47K92Rpv081937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: bbe97db3c211 - main - arm64/vmm: Add the VHE exception and switcher files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbe97db3c211bd0a89a5b9c1a58857625b763475 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=bbe97db3c211bd0a89a5b9c1a58857625b763475 commit bbe97db3c211bd0a89a5b9c1a58857625b763475 Author: Andrew Turner AuthorDate: 2024-08-19 12:44:31 +0000 Commit: Andrew Turner CommitDate: 2024-08-20 08:49:16 +0000 arm64/vmm: Add the VHE exception and switcher files These just need to include the common code with macros to ensure it is built correctly. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46083 --- sys/arm64/vmm/vmm_vhe.c | 39 +++++++++++++++++++++++++++++++++++++++ sys/arm64/vmm/vmm_vhe_exception.S | 31 +++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 2 ++ sys/modules/vmm/Makefile | 2 ++ 4 files changed, 74 insertions(+) diff --git a/sys/arm64/vmm/vmm_vhe.c b/sys/arm64/vmm/vmm_vhe.c new file mode 100644 index 000000000000..8a12852e2a7a --- /dev/null +++ b/sys/arm64/vmm/vmm_vhe.c @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Arm Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "vmm_handlers.h" + +#define VMM_VHE + +#define VMM_STATIC +#define VMM_HYP_FUNC(func) vmm_vhe_ ## func + +#define guest_or_nonvhe(guest) (guest) +#define EL1_REG(reg) MRS_REG_ALT_NAME(reg ## _EL12) +#define EL0_REG(reg) MRS_REG_ALT_NAME(reg ## _EL02) + +#include "vmm_hyp.c" diff --git a/sys/arm64/vmm/vmm_vhe_exception.S b/sys/arm64/vmm/vmm_vhe_exception.S new file mode 100644 index 000000000000..286f5df03707 --- /dev/null +++ b/sys/arm64/vmm/vmm_vhe_exception.S @@ -0,0 +1,31 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Arm Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define VMM_VHE +#define VMM_HYP_FUNC(func) vmm_vhe_ ## func + +#include "vmm_hyp_exception.S" diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index b522177221e5..b105ce873d24 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -145,6 +145,8 @@ vmm_hyp_blob.bin optional vmm \ arm64/vmm/vmm_hyp_el2.S optional vmm \ dependency vmm_hyp_blob.bin arm64/vmm/vmm_mmu.c optional vmm +arm64/vmm/vmm_vhe.c optional vmm +arm64/vmm/vmm_vhe_exception.S optional vmm arm64/vmm/io/vgic.c optional vmm arm64/vmm/io/vgic_v3.c optional vmm arm64/vmm/io/vgic_if.m optional vmm diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile index a3a878a653ff..0604a34690e5 100644 --- a/sys/modules/vmm/Makefile +++ b/sys/modules/vmm/Makefile @@ -30,6 +30,8 @@ SRCS+= vmm_arm64.c \ vmm_call.S \ vmm_handlers.c \ vmm_mmu.c \ + vmm_vhe_exception.S \ + vmm_vhe.c \ vmm_hyp_el2.S .PATH: ${SRCTOP}/sys/${MACHINE}/vmm/io