Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2022 13:18:55 GMT
From:      =?utf-8?Q?Corvin=20K=C3=B6hne?= <corvink@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b03c642aab05 - stable/13 - vmm: emulate INVD by ignoring it
Message-ID:  <202212091318.2B9DItMq072641@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=b03c642aab05f60524b98473789716c84cd0fb95

commit b03c642aab05f60524b98473789716c84cd0fb95
Author:     Corvin Köhne <CorvinK@beckhoff.com>
AuthorDate: 2022-07-27 14:39:47 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-12-09 12:45:04 +0000

    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)
---
 sys/amd64/vmm/amd/svm.c   | 4 ++--
 sys/amd64/vmm/intel/vmx.c | 3 ++-
 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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212091318.2B9DItMq072641>