From nobody Fri Jan 05 00:28:16 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 4T5kns0m6kz55ftv; Fri, 5 Jan 2024 00:28: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T5kns0DS8z4hf9; Fri, 5 Jan 2024 00:28:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414497; 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=PiKMWZ+tm0ueXP6w/Qj+xKXh5oNfQDVDpqT522V48VE=; b=efKYg6LcMNJ0REafw2EUOt5XoLFmgUBnCyJUoL+IIge1JDYQp1dCAwVVjhp3Js2334Z1c7 DuhbS2fxFoG0joh4WXb4zwt1CvE5cL3+UZEtle9O3/Y98yxWTQP6JLI7s1uP2P/oMeruhk ygCMyPRJbt9qerlFfNRvRNpyED3VBnauvE7xio1QWM8Xshm10YBVnbTQJ7TTbGk5W5cdnh yqwzRJ4n+Nn7XCUZuUp0GqolJSyKlaao3JUCIiDFAMtKQZvF4xhXDuvernHigOc15yuKGV B4QkCvUUFW+zQg939WAFgyMTtnXKahDjtOp1Ijlmmi2iSM9lASmX2RrtVhjB2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414497; 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=PiKMWZ+tm0ueXP6w/Qj+xKXh5oNfQDVDpqT522V48VE=; b=eM9M8uAsFNScxViR80RznVVBjvyCaVzJYWrggjhXHqRKXrc36JpOlHwZeUz7V0ldw3RFwD FRpaVq8ykQ4yEMoYzuuHfi5z4cIKy2/ygZb0yfUpAnXJwFRM7Y6rQfNJ54axqkXKs40/HY EQxmcfqOAMRTTKL5ncljOyD/onmdPOiyd8WptroR8at1D/b0cxnCa5Wwll7ERT0hdsk+7O jdwjM4I4QrEzAhO1ZRVElnjSBgGNsDXNlulczNBNhTkIUMPDdXTYVRLs2YyhasX2wwNmY/ 7KS1E/AeSLloWYRbXb8nxyDKiIj3m8bIclyqwubswcX9SQWlnENxnGjG39/VlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704414497; a=rsa-sha256; cv=none; b=heBPDFWrMeIho7rf3b3dNn1VgwbCcH9QNYBgEpR+/w2FEX6lUgk3M4EXhwG3xrBkzE3BDI Lz+jIrr0vrWnypjDJ69d3UzEY7+b5w971plHPZHT54FG6Mftz9ikTXhoPaiHiRo+JahWal y9Am0fGXhFsX90d2T6Y4/U/p23TZW4z0ho14iB4rtFSS8rPcpaS3+RJKhXAiattqZAeTvM XXHzdMok+wpJDVfca53J+kD/+hK2iOu4GVT0avPJiJcph4y+cvWdpQAcula47kqxgmcIrj NtT+L+Vpu08I7Oon/sWouFvd0dVEiFoYo1Vy8W1J3w0GyswzTb9FiDzRSGBpdQ== 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 4T5knr6PMZzbvx; Fri, 5 Jan 2024 00:28:16 +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 4050SGxr026641; Fri, 5 Jan 2024 00:28:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4050SGtY026638; Fri, 5 Jan 2024 00:28:16 GMT (envelope-from git) Date: Fri, 5 Jan 2024 00:28:16 GMT Message-Id: <202401050028.4050SGtY026638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 6d80d20a64a4 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 6d80d20a64a414782ab2e06ec0603bb40ecfbf41 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6d80d20a64a414782ab2e06ec0603bb40ecfbf41 commit 6d80d20a64a414782ab2e06ec0603bb40ecfbf41 Author: Bojan Novković AuthorDate: 2023-12-07 22:40:28 +0000 Commit: John Baldwin CommitDate: 2024-01-05 00:24:36 +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 (cherry picked from commit 78c1d174a1e13c6522bd4d663225fc9cbabc329d) --- 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;