From nobody Tue Aug 20 09:02:24 2024 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 4Wp3Pr5Y9vz5Shxw; Tue, 20 Aug 2024 09:02:24 +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 4Wp3Pr3c69z4vpD; Tue, 20 Aug 2024 09:02:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724144544; 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=Hk/+nNyKip15RdrbnkZUC9OR3baog7YWcPEuzeY28Kg=; b=ThBfbbn61T9yqOVdYu9WX9KvuX6Z7x4Tk0HdoH0vYs70xQcBja+4Sf3wH6wSJz+WsEjpC/ FD4VsjwxNPtLoNiLFX5l/A2sd7FbzGA5CxTGZXTwPOgT1ho17uBhKv6rM1xrWO/H83XBSV IXgbiNTQKiQxAwO/C/SJ8zd5ea1Tmmf8cq71dslTU+A5BvNh3kmPOHpZwzt22G+Ybxi4gl 41Zg2XlnZAYmLhg7JoeEJfyHcc2VOkw7SbXVc24NxCtdDvmQM/t9f0u0UuAs/fXFyqT48L TQxt1NaY776BrLRy44iqxwHWs4t9onlVScsJ/nNj9Lq5uf9M/wmTX4PjRg7cIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724144544; a=rsa-sha256; cv=none; b=T4K92mtigJBfj8+HNV217HdG1ESgGRSlRwIdI2fcy9aG3zrASatOBcvx9DFyoOtD4RhXcT wfjOD08HQk3uPeGZGkWDkNm1+HNhB8qfjdu3VwthjoivVXMnEmDNXsk5Pn+sXvuMY5QEmD AaMjiqpT81piwUyV9XAgwxb3ZRvwLtYoh84/klKMu3Vppy8xbHHnxwYwvf3Ksp8Yrrf3m0 LZyyJh79aXljl8vMa+BDWfoFFDlRhYW6AjFxjbsoREcwPWsAtrnT4VvJpS4TQRFtokdMYG JafPOXBqpU2dghDv6LtPOB3hOCHKkpdfp6yaA1cEARA7j+okTPoJRAjM19+NSQ== 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=1724144544; 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=Hk/+nNyKip15RdrbnkZUC9OR3baog7YWcPEuzeY28Kg=; b=H8XkETki8WFz/4GTCU5DmOBwXf7ST4RjvRo+9Ma0+lb5pvEhCzO9SvvRPCY3i3LqYpxeQj hzUsSZZh4EakkdEQOHf8ac30JcgLwNuBRAabWGzQpbRKTB0GFd03+rfiCNcou9XKsJku7H weyoDtPAV6bUtxdj60G0JXBELEuudAdglH3qFuHPS0wubvoBr1Lif7u5JrRoXNbL6rVq1B 4HpP54ii1MZQ4gcZuxQrE8cpyMjlJS8r0W2G1AOF0ROKBUNpk/ZpDVTwRHmCwQx6EOkMf4 oivDxlyf5ku5vd8T+8CMEz0vNpUuxoWlOUe75Em9KNI8gyn9gcOYqcX4ujW7MQ== 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 4Wp3Pr31rzztc4; Tue, 20 Aug 2024 09:02:24 +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 47K92OMV081793; Tue, 20 Aug 2024 09:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47K92Oh7081790; Tue, 20 Aug 2024 09:02:24 GMT (envelope-from git) Date: Tue, 20 Aug 2024 09:02:24 GMT Message-Id: <202408200902.47K92Oh7081790@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: f83a0f38d14e - main - arm64/vmm: Update exception vectors around a guest 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: f83a0f38d14e26f5f7f31050786e9190cd131902 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f83a0f38d14e26f5f7f31050786e9190cd131902 commit f83a0f38d14e26f5f7f31050786e9190cd131902 Author: Andrew Turner AuthorDate: 2024-08-19 12:44:18 +0000 Commit: Andrew Turner CommitDate: 2024-08-20 08:49:16 +0000 arm64/vmm: Update exception vectors around a guest When entering into a guest with VHE we need to switch from the kernel exception vectors to the vmm exception vectors. The latter understands an exception will be from a guest and can switch back to a kernel context. Rather than encoding the location of the kernel vectors we can just read the value from vbar_el2 and restore it later. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46081 --- sys/arm64/vmm/vmm_hyp_exception.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/arm64/vmm/vmm_hyp_exception.S b/sys/arm64/vmm/vmm_hyp_exception.S index 9a1648130f49..cd2b94f1ff0b 100644 --- a/sys/arm64/vmm/vmm_hyp_exception.S +++ b/sys/arm64/vmm/vmm_hyp_exception.S @@ -175,6 +175,10 @@ hyp_vectors: /* Restore host VTTBR */ mov x9, #VTTBR_HOST msr vttbr_el2, x9 + +#ifdef VMM_VHE + msr vbar_el1, x1 +#endif .endm @@ -288,6 +292,14 @@ LEND(handle_el2_el1_error64) * x0 - hypctx address */ ENTRY(VMM_HYP_FUNC(do_call_guest)) +#ifdef VMM_VHE + mrs x1, vbar_el1 + adrp x2, hyp_vectors + add x2, x2, :lo12:hyp_vectors + msr vbar_el1, x2 + isb +#endif + /* Save hypctx address */ msr tpidr_el2, x0