aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorvin Köhne <CorvinK@beckhoff.com>2022-07-27 14:39:47 +0000
committerCorvin Köhne <corvink@FreeBSD.org>2022-12-09 12:45:04 +0000
commitb03c642aab05f60524b98473789716c84cd0fb95 (patch)
treeb635f167866c2c8316029dbf5d36cb0094f00022
parent308d3d6be6da1df4a47e641b5e0cedeccea7b09f (diff)
downloadsrc-b03c642aab05f60524b98473789716c84cd0fb95.tar.gz
src-b03c642aab05f60524b98473789716c84cd0fb95.zip
vmm: emulate INVD by ignoring it
On physical systems the ram isn't initialized on boot. So, coreboot uses the cache as ram in this boot phase. When exiting cache as ram, coreboot calls INVD for making the cache consistent. In a virtual environment ram is always initialized and the cache is always consistent. So, we can safely ignore this call. Reviewed by: jhb, imp Differential Revision: https://reviews.freebsd.org/D35620 Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 4eadbef92493ea8d375207b2c2a0bd3a22603750)
-rw-r--r--sys/amd64/vmm/amd/svm.c4
-rw-r--r--sys/amd64/vmm/intel/vmx.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index 3b119c722934..474350e9a1fa 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -1551,13 +1551,13 @@ svm_vmexit(struct svm_softc *svm_sc, int vcpu, struct vm_exit *vmexit)
case VMCB_EXIT_CLGI:
case VMCB_EXIT_SKINIT:
case VMCB_EXIT_ICEBP:
- case VMCB_EXIT_INVD:
case VMCB_EXIT_INVLPGA:
vm_inject_ud(svm_sc->vm, vcpu);
handled = 1;
break;
+ case VMCB_EXIT_INVD:
case VMCB_EXIT_WBINVD:
- /* ignore WBINVD */
+ /* ignore exit */
handled = 1;
break;
default:
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index d4e0d2c65650..9a621b9bb3a2 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -2790,8 +2790,9 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
SDT_PROBE3(vmm, vmx, exit, vminsn, vmx, vcpu, vmexit);
vmexit->exitcode = VM_EXITCODE_VMINSN;
break;
+ case EXIT_REASON_INVD:
case EXIT_REASON_WBINVD:
- /* ignore WBINVD */
+ /* ignore exit */
handled = HANDLED;
break;
default: