From nobody Tue Oct 15 17:25:17 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 4XSgwF71rwz5YkrN; Tue, 15 Oct 2024 17:25:17 +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 4XSgwF5LfTz4V5f; Tue, 15 Oct 2024 17:25:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013117; 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=x59PuM2zEow1N0VOTP9PTnDFunDagsQH6oMBGJvjydM=; b=QksZYrFmdV3gw5j0TzXG1UYO25z50v5gYP48nXNqPtDwx9enzMnztbZZgRPo04VB0vErC4 gJGcftSXkndQneqj6/3NAa8wu0txBwS3zhkqjiCAgtbGtLxTliliSAsBPw8lkgUVgdnFSk HKEYBpW2VhyEQue2tROzDplVdhsMpYxSHO5l+NSi8ix7XHbsfnmBnBeY9mp5PMk7rRN4Cy TZ20MEgjGxzjtnMDqhYHirDCT6mWwW2XAaYBqhN7/k7+yOW2+dgfFhiHz3fJpwZfpsnxGr vF+gWmE9IzutCoq10tacl4IGXdYzvwU/vx2i/1gpCnYvY8uE8GOAqU7P7o83mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013117; 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=x59PuM2zEow1N0VOTP9PTnDFunDagsQH6oMBGJvjydM=; b=to/IPpFVYZ5Ip7sNnfzxhaihCXmD1xNca6/HffMRCXRRTes5l/gD1ZORkULRFGsr+0WYJO Dbs7N8b713u0U/EKGAoFHmZE2PESYIFUSusG+GXVODVV9pNkwhpsFed9qF7MUeMQ46ojKV VMyGTgi05R7AFsKbeLPhP6w4B7x7zHTtHMa4c9aQL/PnjPv56RXABSziRzXhIxz8w+ELLI S2Ukd2bjEDMk3yDkac2HR/9u0ykTjmoLRDy2+jIrAhVtToUuM9ky3cyY7KWNiLA1JtckGu yI2fExAn5uCaRs/ZaY84YeonIzita2X+n1knzMMkDYcmFO+V3URgXkP9R7SBwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729013117; a=rsa-sha256; cv=none; b=q//wXxp7Xx++rk6nIBeefmlI5X0h11Zs2JiR5lHsa0AYiVNqV9udTZeKZG4tjcXxjvyiDN QsrYHS+tKA+PBoaHqktJ8U0FXwx80ZXn78d2d6T65Ic5IxxMsjuoAiY1DP7xh1JE/FOMVu MBgMd8fI3iMicQ8gjLg7IAtWM2b+/RI6ZD2SLxRhGYWE8TZcIRy43Lts94psjrqAsrM0rm HMV7xpyr7ghmz4o+eEqui7uT9pv2kx/a0HIWknzTTEbXB0+ITI5bg+RVc8gPeVUKze8FoW NiXqgqIICKn78ncoaToMkiQ59u061PEa0+RqAJ02FRYI7kX0xnuwfAi7haeq8Q== 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 4XSgwF4yrZzWLP; Tue, 15 Oct 2024 17:25:17 +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 49FHPHaU028153; Tue, 15 Oct 2024 17:25:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHPHtu028150; Tue, 15 Oct 2024 17:25:17 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:25:17 GMT Message-Id: <202410151725.49FHPHtu028150@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: e51ed89897da - main - bhyve/aarch64: Handle unknown exceptions 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: e51ed89897da9b940bb4399427aec398dae96fba Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e51ed89897da9b940bb4399427aec398dae96fba commit e51ed89897da9b940bb4399427aec398dae96fba Author: Andrew Turner AuthorDate: 2024-10-14 14:39:29 +0000 Commit: Andrew Turner CommitDate: 2024-10-15 17:24:42 +0000 bhyve/aarch64: Handle unknown exceptions When an exception class is unhandled by the kernel we handle it in userspace by exiting the process. Rather than exiting raise an unknown reason exception in the guest. The guest can then handle the exception as it wishes. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46511 --- usr.sbin/bhyve/aarch64/vmexit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c index e1a9509d5d12..9ecf25c04e41 100644 --- a/usr.sbin/bhyve/aarch64/vmexit.c +++ b/usr.sbin/bhyve/aarch64/vmexit.c @@ -263,15 +263,15 @@ vmexit_smccc(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) } static int -vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu __unused, - struct vm_run *vmrun) +vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun) { - struct vm_exit *vme; + /* Raise an unknown reason exception */ + if (vm_inject_exception(vcpu, + (EXCP_UNKNOWN << ESR_ELx_EC_SHIFT) | ESR_ELx_IL, + vmrun->vm_exit->u.hyp.far_el2) != 0) + return (VMEXIT_ABORT); - vme = vmrun->vm_exit; - printf("unhandled exception: esr %#lx, far %#lx\n", - vme->u.hyp.esr_el2, vme->u.hyp.far_el2); - return (VMEXIT_ABORT); + return (VMEXIT_CONTINUE); } static int