From nobody Thu Dec 7 23:17:15 2023 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 4SmVXq4TCBz53mcv; Thu, 7 Dec 2023 23:17:15 +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 4SmVXq41TZz3Wm1; Thu, 7 Dec 2023 23:17:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701991035; 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=4fV54BNeZ4H0+xrLRC0N9+78P/az7J/0LUJgt9zZ9CI=; b=Lfi+768dATA4lyTmywjwxSXz4D2SGQMTELeoGZDSJ/0GaRg8DbyU34mJIcJaza+MhPpWfn WiWbC7F+YTzGK1zpjxtOTK9MsDzlWSNSJrcZIcBwOqjcf04H5b/LiDkyQSdwjTxNlKg/Ka pgiHxvWx1c526R/oWRV6/GAta+cge0tcDtVDYa4FnAYS02mJD7xK6driSlJkq/MFPO5Qxv iWhopuX6t7xHldz6hP/HT52iQ7f7/skylIUqdWC4RZnK2RwbQIUQfjcA4F3b3AyEK2Syym Tgsq7ntwBgebmvcQtKWJ3Hkzv3IG3M5mpCEIbnix4wae13sWzLnKPNCGLkSkdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701991035; a=rsa-sha256; cv=none; b=DIpr/rfsZRVnwybvz6RaA9DI5FoR3PvJTHZ5RureoLwJ2jcehoYNlk67ahUwkUgCS725ok S270c/O/Kz0AE3u7xHptU4J2PgymQCbmGM+vFuGylchujx87HFBPadE4JyABoZ36vuOSfs Qu/iT5SiMrDMfdiqm0phfDXeaSK/WP6aQtVAkakP4hGe8SDzcAnZuGpGQbc3nfwDZ15Tl6 VkTeFKzejrimnAUACJxzYM+Ua4GZDqqcibwBbsrzBipmT5lCuO3hGzksWHmg1SK4pGpPFj +cVeYIigOCigTMDERqKH8Wn/MUW+VP0axeMnkUybqf9KhPY8EvDr20tQlGWMSA== 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=1701991035; 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=4fV54BNeZ4H0+xrLRC0N9+78P/az7J/0LUJgt9zZ9CI=; b=cdHC6PeRk2fpswcDc4OxNboEwuOJ4gFF9tU2ocjVoKyzVJKE05nLRH1tjRwoJqmZ0Y9UGq pZkkRAsLRVOO8PA5MUUPvOfU2nQt0CR8oK3FJYZpOtoy4IAx+22JC+qedAcu0EjhTgy5be hjtor3oP85L+u5cTLna0QK/khoTSI9D+SSNomtkRsUl1fybChClCZIMw9GKxXlYOgCtgKm jNax0EQ+9Zy1Bro4I0fi936+VJCLBzmIrxrtIufHTdlQ1xyQixjUk/ePxY1mlEtu3/2m+O CyLpMnjwnqgyU0ljGkKB5l2/tO84omPljyndGByYeBfIlG/WwGdxFOW53bmmXw== 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 4SmVXq2yq7zxBq; Thu, 7 Dec 2023 23:17:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B7NHFSd026636; Thu, 7 Dec 2023 23:17:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B7NHFKO026633; Thu, 7 Dec 2023 23:17:15 GMT (envelope-from git) Date: Thu, 7 Dec 2023 23:17:15 GMT Message-Id: <202312072317.3B7NHFKO026633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 78c1d174a1e1 - main - vmm: refactor event reflection in AMD SVM 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78c1d174a1e13c6522bd4d663225fc9cbabc329d Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=78c1d174a1e13c6522bd4d663225fc9cbabc329d commit 78c1d174a1e13c6522bd4d663225fc9cbabc329d Author: Bojan Novković AuthorDate: 2023-12-07 22:40:28 +0000 Commit: John Baldwin CommitDate: 2023-12-07 23:10:53 +0000 vmm: refactor event reflection in AMD SVM This patch refactors AMD SVM event reflection to allow events to be propagated to userland, rather than always reflected into the guest. This is necessary to implement some capabilities that request VMEXITs when a specific exception occurs (e.g. VM_CAP_BPT_EXIT). Reviewed by: jhb Sponsored by: Google, Inc. (GSoC 2022) Differential Revision: https://reviews.freebsd.org/D42405 --- sys/amd64/vmm/amd/svm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c index 33ab2eeaedf4..a502632f6ed6 100644 --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -1442,11 +1442,12 @@ svm_vmexit(struct svm_softc *svm_sc, struct svm_vcpu *vcpu, info1 = 0; break; } - KASSERT(vmexit->inst_length == 0, ("invalid inst_length (%d) " - "when reflecting exception %d into guest", - vmexit->inst_length, idtvec)); if (reflect) { + KASSERT(vmexit->inst_length == 0, + ("invalid inst_length (%d) " + "when reflecting exception %d into guest", + vmexit->inst_length, idtvec)); /* Reflect the exception back into the guest */ SVM_CTR2(vcpu, "Reflecting exception " "%d/%#x into the guest", idtvec, (int)info1); @@ -1454,8 +1455,8 @@ svm_vmexit(struct svm_softc *svm_sc, struct svm_vcpu *vcpu, errcode_valid, info1, 0); KASSERT(error == 0, ("%s: vm_inject_exception error %d", __func__, error)); + handled = 1; } - handled = 1; break; case VMCB_EXIT_MSR: /* MSR access. */ eax = state->rax;