Date: Tue, 20 Aug 2024 09:02:24 GMT From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: f83a0f38d14e - main - arm64/vmm: Update exception vectors around a guest Message-ID: <202408200902.47K92Oh7081790@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f83a0f38d14e26f5f7f31050786e9190cd131902 commit f83a0f38d14e26f5f7f31050786e9190cd131902 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-08-19 12:44:18 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408200902.47K92Oh7081790>