diff options
author | Bojan Novković <bojan.novkovic@fer.hr> | 2023-12-07 22:40:28 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2023-12-07 23:10:53 +0000 |
commit | 78c1d174a1e13c6522bd4d663225fc9cbabc329d (patch) | |
tree | 193429e7ed6efda23dfc20bf30c7f0a80d55acde | |
parent | 3f46be6acadd5d660acde67d9d4c80137f424b70 (diff) | |
download | src-78c1d174a1e13c6522bd4d663225fc9cbabc329d.tar.gz src-78c1d174a1e13c6522bd4d663225fc9cbabc329d.zip |
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
-rw-r--r-- | sys/amd64/vmm/amd/svm.c | 9 |
1 files 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; |