From 0e75d9cba077a3cc747e384b525cc48b2e662bf5 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Mon, 25 Mar 2024 11:39:46 +0100 Subject: [PATCH] patches: update for version 20240325 --- README.md | 5 +- ...dd-Cyberus-configuration-adjustments.patch | 10 +- patches/0002-NEM-Implement-KVM-backend.patch | 58 +++--- ...-passthrough-add-VFIO-implementation.patch | 46 ++--- ...tio-gpu-Add-virtiogpu-implementation.patch | 82 ++++---- ...ource-add-public-information-tooling.patch | 137 ++++++++++++++ ...d-concrete-installation-instructions.patch | 48 +++++ ...switch-to-split-irq-chip-as-default.patch} | 8 +- ...-rm-redundant-split-irq-definitions.patch} | 8 +- ...-disable-KVM-access-to-Hyper-V-MSRs.patch} | 8 +- ...lobber-TSC-during-VM-suspend-resume.patch} | 8 +- ...h => 0011-vmm-rm-unused-pcid-hiding.patch} | 8 +- patches/0012-doc-readme-additions.patch | 114 ++++++++++++ ...yperV-PV-on-KVM-stub-implementation.patch} | 8 +- ...add-HyperV-PV-on-KVM-implementation.patch} | 10 +- ...on-KVM-GIM-implementation-when-VBOX.patch} | 8 +- ...atch => 0016-NEM-MSR-access-helpers.patch} | 10 +- ...IMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch} | 8 +- ...-disable-KVM-access-to-Hyper-V-MSRs.patch} | 8 +- ...MHvOnKvm-state-save-resume-handling.patch} | 10 +- ...020-GIMHvOnKvm-SynIC-STimer-support.patch} | 10 +- ...-Intel-SR-IOV-graphics-documentation.patch | 130 +++++++++++++ ...2-doc-link-SR-IOV-howto-in-README.md.patch | 28 +++ .../0023-doc-Clarify-KVM-backend-name.patch | 140 ++++++++++++++ patches/0024-doc-update-readme.patch | 30 +++ .../0025-doc-move-readme-into-top-level.patch | 175 ++++++++++++++++++ ...issue-template-into-top-level-direct.patch | 56 ++++++ ...graphics-documentation-into-top-leve.patch | 131 +++++++++++++ ...add-PASSTHRU_FEATURE_KVM_ONLY-helper.patch | 30 +++ ...handle-MSR_IA32_ARCH_CAPABILITIES-an.patch | 44 +++++ ...tore-IA32_ARCH_CAPABILITIES-and-IA32.patch | 35 ++++ ...d-allow-guests-to-use-gigabyte-pages.patch | 25 +++ ...id-allow-guests-to-use-SMEP-and-SMAP.patch | 34 ++++ ...low-guests-to-use-Enhanced-REP-MOVSB.patch | 25 +++ ...0034-NEM-KVM-allow-guests-to-use-ADX.patch | 25 +++ ...ests-to-use-SHA-1-and-SHA-256-extens.patch | 25 +++ ...w-guests-to-use-Fast-Short-REP-MOVSB.patch | 38 ++++ ...ests-to-use-cache-line-write-back-CL.patch | 39 ++++ ...BRS-IBPB-STIBP-and-SSBD-to-the-guest.patch | 43 +++++ ...e-SERIALIZE-instruction-to-the-guest.patch | 38 ++++ ...040-NEM-KVM-expose-GFNI-to-the-guest.patch | 38 ++++ ...041-NEM-KVM-expose-F16C-to-the-guest.patch | 25 +++ ...EM-KVM-let-KVM-handle-IA32_FLUSH_CMD.patch | 24 +++ ...resume-failing-with-VERR_CPUM_INVALI.patch | 39 ++++ 44 files changed, 1673 insertions(+), 156 deletions(-) create mode 100644 patches/0005-open-source-add-public-information-tooling.patch create mode 100644 patches/0006-open-source-add-concrete-installation-instructions.patch rename patches/{0005-config-switch-to-split-irq-chip-as-default.patch => 0007-config-switch-to-split-irq-chip-as-default.patch} (71%) rename patches/{0006-NEM-rm-redundant-split-irq-definitions.patch => 0008-NEM-rm-redundant-split-irq-definitions.patch} (94%) rename patches/{0007-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch => 0009-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch} (89%) rename patches/{0008-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch => 0010-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch} (94%) rename patches/{0009-vmm-rm-unused-pcid-hiding.patch => 0011-vmm-rm-unused-pcid-hiding.patch} (95%) create mode 100644 patches/0012-doc-readme-additions.patch rename patches/{0010-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch => 0013-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch} (96%) rename patches/{0011-GIMR3-add-HyperV-PV-on-KVM-implementation.patch => 0014-GIMR3-add-HyperV-PV-on-KVM-implementation.patch} (99%) rename patches/{0012-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch => 0015-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch} (84%) rename patches/{0013-NEM-MSR-access-helpers.patch => 0016-NEM-MSR-access-helpers.patch} (94%) rename patches/{0014-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch => 0017-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch} (94%) rename patches/{0015-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch => 0018-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch} (88%) rename patches/{0016-GIMHvOnKvm-state-save-resume-handling.patch => 0019-GIMHvOnKvm-state-save-resume-handling.patch} (98%) rename patches/{0017-GIMHvOnKvm-SynIC-STimer-support.patch => 0020-GIMHvOnKvm-SynIC-STimer-support.patch} (93%) create mode 100644 patches/0021-doc-add-Intel-SR-IOV-graphics-documentation.patch create mode 100644 patches/0022-doc-link-SR-IOV-howto-in-README.md.patch create mode 100644 patches/0023-doc-Clarify-KVM-backend-name.patch create mode 100644 patches/0024-doc-update-readme.patch create mode 100644 patches/0025-doc-move-readme-into-top-level.patch create mode 100644 patches/0026-doc-move-github-issue-template-into-top-level-direct.patch create mode 100644 patches/0027-doc-move-sr-iov-graphics-documentation-into-top-leve.patch create mode 100644 patches/0028-NEM-KVM-cpuid-add-PASSTHRU_FEATURE_KVM_ONLY-helper.patch create mode 100644 patches/0029-NEM-KVM-let-KVM-handle-MSR_IA32_ARCH_CAPABILITIES-an.patch create mode 100644 patches/0030-NEM-KVM-save-restore-IA32_ARCH_CAPABILITIES-and-IA32.patch create mode 100644 patches/0031-NEM-KVM-cpuid-allow-guests-to-use-gigabyte-pages.patch create mode 100644 patches/0032-NEM-KVM-cpuid-allow-guests-to-use-SMEP-and-SMAP.patch create mode 100644 patches/0033-NEM-KVM-cpuid-allow-guests-to-use-Enhanced-REP-MOVSB.patch create mode 100644 patches/0034-NEM-KVM-allow-guests-to-use-ADX.patch create mode 100644 patches/0035-NEM-KVM-allow-guests-to-use-SHA-1-and-SHA-256-extens.patch create mode 100644 patches/0036-NEM-KVM-allow-guests-to-use-Fast-Short-REP-MOVSB.patch create mode 100644 patches/0037-NEM-KVM-allow-guests-to-use-cache-line-write-back-CL.patch create mode 100644 patches/0038-NEM-KVM-expose-IBRS-IBPB-STIBP-and-SSBD-to-the-guest.patch create mode 100644 patches/0039-NEM-KVM-expose-SERIALIZE-instruction-to-the-guest.patch create mode 100644 patches/0040-NEM-KVM-expose-GFNI-to-the-guest.patch create mode 100644 patches/0041-NEM-KVM-expose-F16C-to-the-guest.patch create mode 100644 patches/0042-NEM-KVM-let-KVM-handle-IA32_FLUSH_CMD.patch create mode 100644 patches/0043-vbox-workaround-resume-failing-with-VERR_CPUM_INVALI.patch diff --git a/README.md b/README.md index c2071c51..2eecbc21 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,12 @@ to the following steps: ```shell $ # Download the VirtualBox 7.0.14 source package from Oracle. $ tar xf VirtualBox-7.0.14.tar.bz2 -$ git clone https://github.com/cyberus-technology/virtualbox-kvm vbox-patches +$ git clone https://github.com/cyberus-technology/virtualbox-kvm vbox-kvm $ cd VirtualBox-7.0.14 +$ git init $ git add * $ git commit -m "VirtualBox vanilla code" -$ git am ../vbox-patches/patches/*.patch +$ git am ../vbox-kvm/patches/*.patch $ ./configure --with-kvm --disable-kmods --disable-docs --disable-hardening --disable-java $ source ./env.sh $ kmk diff --git a/patches/0001-config-add-Cyberus-configuration-adjustments.patch b/patches/0001-config-add-Cyberus-configuration-adjustments.patch index d17c01e6..e2d64adb 100644 --- a/patches/0001-config-add-Cyberus-configuration-adjustments.patch +++ b/patches/0001-config-add-Cyberus-configuration-adjustments.patch @@ -1,7 +1,7 @@ -From 2b8c0f68a0c23ea4e80bedd82cda4a0cd22c13f3 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Messer Date: Wed, 5 Apr 2023 11:22:27 +0200 -Subject: [PATCH 01/17] config: add Cyberus configuration adjustments +Subject: [PATCH] config: add Cyberus configuration adjustments config: make kvm backend configurable @@ -18,7 +18,7 @@ config: define for VBOX_WITH_KVM_IRQCHIP_FULL 2 files changed, 29 insertions(+) diff --git a/Config.kmk b/Config.kmk -index 38833aa29f..d353b0920f 100644 +index 38833aa29..d353b0920 100644 --- a/Config.kmk +++ b/Config.kmk @@ -1584,6 +1584,19 @@ ifdef VBOX_HEADLESS @@ -66,7 +66,7 @@ index 38833aa29f..d353b0920f 100644 VBOX_GCC_std := -std=c++11 # else if "$(VBOX_GCC_VERSION_CXX)" vge 70000 # Language feature P0512R0 was v8, rest v7 or earlier. Most lib stuff present in 7, complete in v12. diff --git a/configure b/configure -index 4b69712cd6..22709bf934 100755 +index 4b69712cd..22709bf93 100755 --- a/configure +++ b/configure @@ -86,6 +86,7 @@ SETUP_WINE= @@ -104,5 +104,5 @@ index 4b69712cd6..22709bf934 100755 [ $WITH_LIBTPMS -eq 0 ] && cnf_append "VBOX_WITH_LIBTPMS" "" [ $WITH_LIBLZMA -eq 0 ] && cnf_append "VBOX_WITH_LIBLZMA" "" -- -2.43.0 +2.44.0 diff --git a/patches/0002-NEM-Implement-KVM-backend.patch b/patches/0002-NEM-Implement-KVM-backend.patch index e8c82573..16dd2b4d 100644 --- a/patches/0002-NEM-Implement-KVM-backend.patch +++ b/patches/0002-NEM-Implement-KVM-backend.patch @@ -1,7 +1,7 @@ -From e1b953abdcc0f7c5270ea75e191d10a1633ef239 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Messer Date: Wed, 5 Apr 2023 13:49:04 +0000 -Subject: [PATCH 02/17] NEM: Implement KVM backend +Subject: [PATCH] NEM: Implement KVM backend NEM: Log A20 changes everytime. @@ -288,7 +288,7 @@ account for the CPUID values VBox wants to offer to the guest. 26 files changed, 1895 insertions(+), 98 deletions(-) diff --git a/include/VBox/vmm/nem.h b/include/VBox/vmm/nem.h -index 0d960a7eee..26d055fcd0 100644 +index 0d960a7ee..26d055fcd 100644 --- a/include/VBox/vmm/nem.h +++ b/include/VBox/vmm/nem.h @@ -43,6 +43,14 @@ @@ -503,7 +503,7 @@ index 0d960a7eee..26d055fcd0 100644 * @{ */ /** Set if the range is replacing RAM rather that unused space. */ diff --git a/include/VBox/vmm/pdmdev.h b/include/VBox/vmm/pdmdev.h -index f895eb86f5..525d82e030 100644 +index f895eb86f..525d82e03 100644 --- a/include/VBox/vmm/pdmdev.h +++ b/include/VBox/vmm/pdmdev.h @@ -64,6 +64,49 @@ @@ -649,7 +649,7 @@ index f895eb86f5..525d82e030 100644 uint32_t u32TheEnd; } PDMIOAPICHLP; diff --git a/include/iprt/mangling.h b/include/iprt/mangling.h -index 0c8c027f1b..7b27bba35d 100644 +index 0c8c027f1..7b27bba35 100644 --- a/include/iprt/mangling.h +++ b/include/iprt/mangling.h @@ -2555,6 +2555,7 @@ @@ -661,7 +661,7 @@ index 0c8c027f1b..7b27bba35d 100644 # define RTThreadPreemptDisable RT_MANGLER(RTThreadPreemptDisable) /* r0drv */ # define RTThreadPreemptIsEnabled RT_MANGLER(RTThreadPreemptIsEnabled) /* r0drv */ diff --git a/include/iprt/thread.h b/include/iprt/thread.h -index 7d9257ec4c..243d76de75 100644 +index 7d9257ec4..243d76de7 100644 --- a/include/iprt/thread.h +++ b/include/iprt/thread.h @@ -555,6 +555,12 @@ RTDECL(int) RTThreadPoke(RTTHREAD hThread); @@ -678,7 +678,7 @@ index 7d9257ec4c..243d76de75 100644 # ifdef IN_RING0 diff --git a/src/VBox/Devices/PC/DevACPI.cpp b/src/VBox/Devices/PC/DevACPI.cpp -index abf2ba5e25..672b9afae0 100644 +index abf2ba5e2..672b9afae 100644 --- a/src/VBox/Devices/PC/DevACPI.cpp +++ b/src/VBox/Devices/PC/DevACPI.cpp @@ -812,7 +812,11 @@ struct ACPITBLISO @@ -769,7 +769,7 @@ index abf2ba5e25..672b9afae0 100644 madt.header_addr()->u8Checksum = acpiR3Checksum(madt.data(), madt.size()); acpiR3PhysCopy(pDevIns, addr, madt.data(), madt.size()); diff --git a/src/VBox/Devices/PC/DevIoApic.cpp b/src/VBox/Devices/PC/DevIoApic.cpp -index a69d8e3f02..f56c66725d 100644 +index a69d8e3f0..f56c66725 100644 --- a/src/VBox/Devices/PC/DevIoApic.cpp +++ b/src/VBox/Devices/PC/DevIoApic.cpp @@ -32,6 +32,14 @@ @@ -1102,7 +1102,7 @@ index a69d8e3f02..f56c66725d 100644 * Validate and read the configuration. */ diff --git a/src/VBox/Devices/PC/DevPIC.cpp b/src/VBox/Devices/PC/DevPIC.cpp -index b4e195952e..f44e2c6f73 100644 +index b4e195952..f44e2c6f7 100644 --- a/src/VBox/Devices/PC/DevPIC.cpp +++ b/src/VBox/Devices/PC/DevPIC.cpp @@ -366,6 +366,16 @@ static DECLCALLBACK(void) picSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel, ui @@ -1199,7 +1199,7 @@ index b4e195952e..f44e2c6f73 100644 return VINF_SUCCESS; } diff --git a/src/VBox/HostDrivers/Support/Makefile.kmk b/src/VBox/HostDrivers/Support/Makefile.kmk -index 6543b624f6..205c66e930 100644 +index 6543b624f..205c66e93 100644 --- a/src/VBox/HostDrivers/Support/Makefile.kmk +++ b/src/VBox/HostDrivers/Support/Makefile.kmk @@ -191,6 +191,7 @@ SUPR3_DEFS = \ @@ -1211,7 +1211,7 @@ index 6543b624f6..205c66e930 100644 VBOX_PERMIT_EVEN_MORE SUPR3_INCS := $(PATH_SUB_CURRENT) diff --git a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp -index 5bdcda63c4..61ffb906da 100644 +index 5bdcda63c..61ffb906d 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp +++ b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp @@ -255,6 +255,10 @@ DECLHIDDEN(int) suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, uint32_t fFl @@ -1226,7 +1226,7 @@ index 5bdcda63c4..61ffb906da 100644 if ( !pThis->fSysMadviseWorks && (fFlags & (SUP_PAGE_ALLOC_F_FOR_LOCKING | SUP_PAGE_ALLOC_F_LARGE_PAGES)) == SUP_PAGE_ALLOC_F_FOR_LOCKING) diff --git a/src/VBox/Main/Makefile.kmk b/src/VBox/Main/Makefile.kmk -index 5711816d74..6f5d1a7071 100644 +index 5711816d7..6f5d1a707 100644 --- a/src/VBox/Main/Makefile.kmk +++ b/src/VBox/Main/Makefile.kmk @@ -1088,7 +1088,9 @@ if !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_EXTPACKS) # Note this goes on f @@ -1241,7 +1241,7 @@ index 5711816d74..6f5d1a7071 100644 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/psapi.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib diff --git a/src/VBox/Runtime/r3/posix/thread-posix.cpp b/src/VBox/Runtime/r3/posix/thread-posix.cpp -index cd621ce0a1..c89c600e46 100644 +index cd621ce0a..c89c600e4 100644 --- a/src/VBox/Runtime/r3/posix/thread-posix.cpp +++ b/src/VBox/Runtime/r3/posix/thread-posix.cpp @@ -727,6 +727,10 @@ RTDECL(int) RTThreadControlPokeSignal(RTTHREAD hThread, bool fEnable) @@ -1256,7 +1256,7 @@ index cd621ce0a1..c89c600e46 100644 #endif diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk -index c3a097b821..4ecc3e535a 100644 +index c3a097b82..4ecc3e535 100644 --- a/src/VBox/Runtime/testcase/Makefile.kmk +++ b/src/VBox/Runtime/testcase/Makefile.kmk @@ -559,6 +559,7 @@ ifdef VBOX_WITH_TESTCASES # The whole file @@ -1268,7 +1268,7 @@ index c3a097b821..4ecc3e535a 100644 $(QUIET)$(SED) -n -e 's/^ *LOG_GROUP_\([A-Z0-9_]*\),.*$(DOLLAR)/{ LOG_GROUP_\1, "\1" },/p' --output "$@" "$<" endif # !VBOX_ONLY_VALIDATIONKIT diff --git a/src/VBox/VMM/VMMAll/APICAll.cpp b/src/VBox/VMM/VMMAll/APICAll.cpp -index 6041a8433a..e2df2ec202 100644 +index 6041a8433..e2df2ec20 100644 --- a/src/VBox/VMM/VMMAll/APICAll.cpp +++ b/src/VBox/VMM/VMMAll/APICAll.cpp @@ -2726,6 +2726,16 @@ VMM_INT_DECL(VBOXSTRICTRC) APICLocalInterrupt(PVMCPUCC pVCpu, uint8_t u8Pin, uin @@ -1289,7 +1289,7 @@ index 6041a8433a..e2df2ec202 100644 /* If the APIC is enabled, the interrupt is subject to LVT programming. */ if (APICIsEnabled(pVCpu)) diff --git a/src/VBox/VMM/VMMAll/PGMAllBth.h b/src/VBox/VMM/VMMAll/PGMAllBth.h -index 50b7a30e84..9d4bd8ca62 100644 +index 50b7a30e8..9d4bd8ca6 100644 --- a/src/VBox/VMM/VMMAll/PGMAllBth.h +++ b/src/VBox/VMM/VMMAll/PGMAllBth.h @@ -5046,7 +5046,10 @@ PGM_BTH_DECL(int, MapCR3)(PVMCPUCC pVCpu, RTGCPHYS GCPhysCR3) @@ -1304,7 +1304,7 @@ index 50b7a30e84..9d4bd8ca62 100644 # if PGM_GST_TYPE == PGM_TYPE_PAE if ( !pVCpu->pgm.s.CTX_SUFF(fPaePdpesAndCr3Mapped) diff --git a/src/VBox/VMM/VMMAll/TMAll.cpp b/src/VBox/VMM/VMMAll/TMAll.cpp -index 677decdd81..8edc178af1 100644 +index 677decdd8..8edc178af 100644 --- a/src/VBox/VMM/VMMAll/TMAll.cpp +++ b/src/VBox/VMM/VMMAll/TMAll.cpp @@ -208,7 +208,10 @@ VMMDECL(void) TMNotifyEndOfExecution(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uTsc) @@ -1320,7 +1320,7 @@ index 677decdd81..8edc178af1 100644 uint64_t cNsExecutingDelta; if (uCpuHz < _4G) diff --git a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp -index 9244bd850b..2e34aeaf6d 100644 +index 9244bd850..2e34aeaf6 100644 --- a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp +++ b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp @@ -952,7 +952,11 @@ VMM_INT_DECL(uint64_t) TMVirtualSyncGetWithDeadlineNoCheck(PVMCC pVM, uint64_t * @@ -1336,7 +1336,7 @@ index 9244bd850b..2e34aeaf6d 100644 } diff --git a/src/VBox/VMM/VMMR3/APIC.cpp b/src/VBox/VMM/VMMR3/APIC.cpp -index 6753ac6080..b5ff86cc7f 100644 +index 6753ac608..b5ff86cc7 100644 --- a/src/VBox/VMM/VMMR3/APIC.cpp +++ b/src/VBox/VMM/VMMR3/APIC.cpp @@ -36,6 +36,7 @@ @@ -1403,7 +1403,7 @@ index 6753ac6080..b5ff86cc7f 100644 APIC_REG_COUNTER(&pApicCpu->StatPostIntrCnt, "%u", "APIC/VCPU stats / number of apicPostInterrupt calls."); for (size_t i = 0; i < RT_ELEMENTS(pApicCpu->aStatVectors); i++) diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp -index a22882500f..c448c9ecd8 100644 +index a22882500..c448c9ecd 100644 --- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp @@ -1419,6 +1419,51 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) @@ -1475,7 +1475,7 @@ index a22882500f..c448c9ecd8 100644 /* diff --git a/src/VBox/VMM/VMMR3/EM.cpp b/src/VBox/VMM/VMMR3/EM.cpp -index bd15b8872c..5e52065aab 100644 +index bd15b8872..5e52065aa 100644 --- a/src/VBox/VMM/VMMR3/EM.cpp +++ b/src/VBox/VMM/VMMR3/EM.cpp @@ -219,7 +219,11 @@ VMMR3_INT_DECL(int) EMR3Init(PVM pVM) @@ -1506,7 +1506,7 @@ index bd15b8872c..5e52065aab 100644 break; } diff --git a/src/VBox/VMM/VMMR3/GIMHv.cpp b/src/VBox/VMM/VMMR3/GIMHv.cpp -index 0452facbe3..1da9065120 100644 +index 0452facbe..1da906512 100644 --- a/src/VBox/VMM/VMMR3/GIMHv.cpp +++ b/src/VBox/VMM/VMMR3/GIMHv.cpp @@ -34,6 +34,9 @@ @@ -1631,7 +1631,7 @@ index 0452facbe3..1da9065120 100644 /* diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index fa73141590..38251a5568 100644 +index fa7314159..38251a556 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -38,20 +38,29 @@ @@ -3020,7 +3020,7 @@ index fa73141590..38251a5568 100644 */ - diff --git a/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp b/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp -index f11f0b2151..d723f54531 100644 +index f11f0b215..d723f5453 100644 --- a/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp +++ b/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp @@ -34,6 +34,7 @@ @@ -3162,7 +3162,7 @@ index f11f0b2151..d723f54531 100644 }; diff --git a/src/VBox/VMM/VMMR3/PGMPhys.cpp b/src/VBox/VMM/VMMR3/PGMPhys.cpp -index fb9fd66828..b54be52089 100644 +index fb9fd6682..b54be5208 100644 --- a/src/VBox/VMM/VMMR3/PGMPhys.cpp +++ b/src/VBox/VMM/VMMR3/PGMPhys.cpp @@ -1862,7 +1862,12 @@ int pgmR3PhysRamPreAllocate(PVM pVM) @@ -3179,7 +3179,7 @@ index fb9fd66828..b54be52089 100644 /* diff --git a/src/VBox/VMM/VMMR3/VMM.cpp b/src/VBox/VMM/VMMR3/VMM.cpp -index e235184c56..787df961f1 100644 +index e235184c5..787df961f 100644 --- a/src/VBox/VMM/VMMR3/VMM.cpp +++ b/src/VBox/VMM/VMMR3/VMM.cpp @@ -1092,6 +1092,11 @@ static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, @@ -3195,7 +3195,7 @@ index e235184c56..787df961f1 100644 } diff --git a/src/VBox/VMM/include/GIMHvInternal.h b/src/VBox/VMM/include/GIMHvInternal.h -index 960dc36c6c..14b00b7394 100644 +index 960dc36c6..14b00b739 100644 --- a/src/VBox/VMM/include/GIMHvInternal.h +++ b/src/VBox/VMM/include/GIMHvInternal.h @@ -202,6 +202,8 @@ @@ -3208,7 +3208,7 @@ index 960dc36c6c..14b00b7394 100644 diff --git a/src/VBox/VMM/include/NEMInternal.h b/src/VBox/VMM/include/NEMInternal.h -index e0817e219c..35a7665f4f 100644 +index e0817e219..35a7665f4 100644 --- a/src/VBox/VMM/include/NEMInternal.h +++ b/src/VBox/VMM/include/NEMInternal.h @@ -35,13 +35,24 @@ @@ -3276,5 +3276,5 @@ index e0817e219c..35a7665f4f 100644 #endif /* !VMM_INCLUDED_SRC_include_NEMInternal_h */ - -- -2.43.0 +2.44.0 diff --git a/patches/0003-pci-passthrough-add-VFIO-implementation.patch b/patches/0003-pci-passthrough-add-VFIO-implementation.patch index a6606943..a352b629 100644 --- a/patches/0003-pci-passthrough-add-VFIO-implementation.patch +++ b/patches/0003-pci-passthrough-add-VFIO-implementation.patch @@ -1,7 +1,7 @@ -From 41bd920f88c30daeff49f6f60de963bf2d460975 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Messer Date: Tue, 5 Oct 2021 13:57:43 +0000 -Subject: [PATCH 03/17] pci-passthrough: add VFIO implementation +Subject: [PATCH] pci-passthrough: add VFIO implementation The VFIO device is added an can be configured via VBoxManage to pass-through arbitrary PCI devices from the host system. The user is @@ -39,7 +39,7 @@ license: vfio create mode 100644 vboxsrc/src/VBox/Devices/Bus/VfioDevice.cpp diff --git a/include/VBox/log.h b/include/VBox/log.h -index af00cf901a..aaec2b54bd 100644 +index af00cf901..aaec2b54b 100644 --- a/include/VBox/log.h +++ b/include/VBox/log.h @@ -178,6 +178,8 @@ typedef enum VBOXLOGGROUP @@ -60,7 +60,7 @@ index af00cf901a..aaec2b54bd 100644 "DEV_VIRTIO", \ "DEV_VIRTIO_NET", \ diff --git a/include/VBox/pci.h b/include/VBox/pci.h -index cd28b08375..41124406c5 100644 +index cd28b0837..41124406c 100644 --- a/include/VBox/pci.h +++ b/include/VBox/pci.h @@ -631,6 +631,8 @@ typedef enum PCIADDRTYPE @@ -73,7 +73,7 @@ index cd28b08375..41124406c5 100644 #define PCI_ROM_SLOT VBOX_PCI_ROM_SLOT /**< deprecated */ #define PCI_NUM_REGIONS VBOX_PCI_NUM_REGIONS /**< deprecated */ diff --git a/include/VBox/settings.h b/include/VBox/settings.h -index 674e169f9b..78bcbf6bc6 100644 +index 674e169f9..78bcbf6bc 100644 --- a/include/VBox/settings.h +++ b/include/VBox/settings.h @@ -1116,6 +1116,22 @@ struct HostPCIDeviceAttachment @@ -110,7 +110,7 @@ index 674e169f9b..78bcbf6bc6 100644 }; diff --git a/include/svp/pci.h b/include/svp/pci.h new file mode 100644 -index 0000000000..9a020b6803 +index 000000000..9a020b680 --- /dev/null +++ b/include/svp/pci.h @@ -0,0 +1,444 @@ @@ -560,7 +560,7 @@ index 0000000000..9a020b6803 +} diff --git a/src/VBox/Devices/Bus/DevVfio.cpp b/src/VBox/Devices/Bus/DevVfio.cpp new file mode 100644 -index 0000000000..f93fcd7381 +index 000000000..f93fcd738 --- /dev/null +++ b/src/VBox/Devices/Bus/DevVfio.cpp @@ -0,0 +1,154 @@ @@ -720,7 +720,7 @@ index 0000000000..f93fcd7381 +}; diff --git a/src/VBox/Devices/Bus/DevVfio.h b/src/VBox/Devices/Bus/DevVfio.h new file mode 100644 -index 0000000000..cfe384d7a1 +index 000000000..cfe384d7a --- /dev/null +++ b/src/VBox/Devices/Bus/DevVfio.h @@ -0,0 +1,412 @@ @@ -1138,7 +1138,7 @@ index 0000000000..cfe384d7a1 +typedef VFIODEV *PVFIODEV; diff --git a/src/VBox/Devices/Bus/VfioDevice.cpp b/src/VBox/Devices/Bus/VfioDevice.cpp new file mode 100644 -index 0000000000..d8cf3ef1b0 +index 000000000..d8cf3ef1b --- /dev/null +++ b/src/VBox/Devices/Bus/VfioDevice.cpp @@ -0,0 +1,910 @@ @@ -2053,7 +2053,7 @@ index 0000000000..d8cf3ef1b0 + return {barValue & std::numeric_limits::max()}; +} diff --git a/src/VBox/Devices/Makefile.kmk b/src/VBox/Devices/Makefile.kmk -index a17e655fa7..d2bef9129d 100644 +index a17e655fa..d2bef9129 100644 --- a/src/VBox/Devices/Makefile.kmk +++ b/src/VBox/Devices/Makefile.kmk @@ -187,6 +187,8 @@ if !defined(VBOX_ONLY_EXTPACKS) && "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SU @@ -2077,7 +2077,7 @@ index a17e655fa7..d2bef9129d 100644 ifn1of ($(KBUILD_TARGET), darwin) VBoxDD_SOURCES += Storage/HBDMgmt-generic.cpp diff --git a/src/VBox/Devices/build/VBoxDD.cpp b/src/VBox/Devices/build/VBoxDD.cpp -index 36b12c694f..d601e45546 100644 +index 36b12c694..d601e4554 100644 --- a/src/VBox/Devices/build/VBoxDD.cpp +++ b/src/VBox/Devices/build/VBoxDD.cpp @@ -218,6 +218,9 @@ extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t @@ -2091,7 +2091,7 @@ index 36b12c694f..d601e45546 100644 if (RT_FAILURE(rc)) return rc; diff --git a/src/VBox/Devices/build/VBoxDD.h b/src/VBox/Devices/build/VBoxDD.h -index 9350f42885..d208ea1e7f 100644 +index 9350f4288..d208ea1e7 100644 --- a/src/VBox/Devices/build/VBoxDD.h +++ b/src/VBox/Devices/build/VBoxDD.h @@ -107,6 +107,7 @@ extern const PDMDEVREG g_DeviceEFI; @@ -2103,7 +2103,7 @@ index 9350f42885..d208ea1e7f 100644 extern const PDMDEVREG g_DeviceLPC; #ifdef VBOX_WITH_VIRTUALKD diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp -index 524c1be284..fffa353734 100644 +index 524c1be28..fffa35373 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp @@ -2685,6 +2685,30 @@ HRESULT showVMInfo(ComPtr pVirtualBox, @@ -2138,7 +2138,7 @@ index 524c1be284..fffa353734 100644 * Bandwidth groups */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp -index 4a3607250a..aa3ecf7986 100644 +index 4a3607250..aa3ecf798 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp @@ -234,6 +234,8 @@ enum @@ -2178,7 +2178,7 @@ index 4a3607250a..aa3ecf7986 100644 #ifdef VBOX_WITH_USB_CARDREADER case MODIFYVM_USBCARDREADER: diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl -index 8654afec6d..26e9d94aa0 100644 +index 8654afec6..26e9d94aa 100644 --- a/src/VBox/Main/idl/VirtualBox.xidl +++ b/src/VBox/Main/idl/VirtualBox.xidl @@ -7336,6 +7336,12 @@ @@ -2220,7 +2220,7 @@ index 8654afec6d..26e9d94aa0 100644 diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h -index fdea838fc0..e1fc1f9b4d 100644 +index fdea838fc..e1fc1f9b4 100644 --- a/src/VBox/Main/include/ConsoleImpl.h +++ b/src/VBox/Main/include/ConsoleImpl.h @@ -807,6 +807,7 @@ private: @@ -2232,7 +2232,7 @@ index fdea838fc0..e1fc1f9b4d 100644 typedef struct LEDSET *PLEDSET; PPDMLED volatile *i_getLedSet(uint32_t iLedSet); diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h -index 311a80bdc2..5a90896947 100644 +index 311a80bdc..5a9089694 100644 --- a/src/VBox/Main/include/MachineImpl.h +++ b/src/VBox/Main/include/MachineImpl.h @@ -364,6 +364,8 @@ public: @@ -2262,7 +2262,7 @@ index 311a80bdc2..5a90896947 100644 ComPtr &aAdapter); HRESULT addStorageController(const com::Utf8Str &aName, diff --git a/src/VBox/Main/src-client/BusAssignmentManager.cpp b/src/VBox/Main/src-client/BusAssignmentManager.cpp -index a8d36d0717..b4665d696c 100644 +index a8d36d071..b4665d696 100644 --- a/src/VBox/Main/src-client/BusAssignmentManager.cpp +++ b/src/VBox/Main/src-client/BusAssignmentManager.cpp @@ -109,17 +109,18 @@ static const DeviceAssignmentRule g_aGenericRules[] = @@ -2292,7 +2292,7 @@ index a8d36d0717..b4665d696c 100644 /* ISA/LPC controller */ {"lpc", 0, 31, 0, 0}, diff --git a/src/VBox/Main/src-client/ConsoleImpl2.cpp b/src/VBox/Main/src-client/ConsoleImpl2.cpp -index 3576c49354..7a4ee5db5f 100644 +index 3576c4935..7a4ee5db5 100644 --- a/src/VBox/Main/src-client/ConsoleImpl2.cpp +++ b/src/VBox/Main/src-client/ConsoleImpl2.cpp @@ -674,6 +674,66 @@ HRESULT Console::i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, @@ -2372,7 +2372,7 @@ index 3576c49354..7a4ee5db5f 100644 * Enable the following devices: HPET, SMC and LPC on MacOS X guests or on ICH9 chipset */ diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp -index c3c63d5989..e3d3287a7d 100644 +index c3c63d598..e3d3287a7 100644 --- a/src/VBox/Main/src-server/MachineImpl.cpp +++ b/src/VBox/Main/src-server/MachineImpl.cpp @@ -7064,6 +7064,80 @@ HRESULT Machine::getPCIDeviceAssignments(std::vectorsv < SettingsVersion_v1_16) diff --git a/src/VBox/Runtime/VBox/log-vbox.cpp b/src/VBox/Runtime/VBox/log-vbox.cpp -index 2e82f859f7..9d9c5d731e 100644 +index 2e82f859f..9d9c5d731 100644 --- a/src/VBox/Runtime/VBox/log-vbox.cpp +++ b/src/VBox/Runtime/VBox/log-vbox.cpp @@ -272,6 +272,7 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void) @@ -2595,5 +2595,5 @@ index 2e82f859f7..9d9c5d731e 100644 ASSERT_LOG_GROUP(DEV_VIRTIO); ASSERT_LOG_GROUP(DEV_VIRTIO_NET); -- -2.43.0 +2.44.0 diff --git a/patches/0004-virtio-gpu-Add-virtiogpu-implementation.patch b/patches/0004-virtio-gpu-Add-virtiogpu-implementation.patch index 9f7c0f76..1a167e21 100644 --- a/patches/0004-virtio-gpu-Add-virtiogpu-implementation.patch +++ b/patches/0004-virtio-gpu-Add-virtiogpu-implementation.patch @@ -1,7 +1,7 @@ -From 165a9c5ea8b5b416655eaeecf8b54f400b53e954 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sebastian Eydam Date: Mon, 15 Aug 2022 14:13:14 +0200 -Subject: [PATCH 04/17] virtio-gpu: Add virtiogpu implementation +Subject: [PATCH] virtio-gpu: Add virtiogpu implementation virtiogpu: enable hotplug support @@ -111,7 +111,7 @@ license: virtiogpu create mode 100644 vboxsrc/src/VBox/Devices/testcase/tstVirtioGpuCmdHandling.cpp diff --git a/include/VBox/log.h b/include/VBox/log.h -index aaec2b54bd..93129cb334 100644 +index aaec2b54b..93129cb33 100644 --- a/include/VBox/log.h +++ b/include/VBox/log.h @@ -184,6 +184,8 @@ typedef enum VBOXLOGGROUP @@ -132,7 +132,7 @@ index aaec2b54bd..93129cb334 100644 "DEV_VMM", \ "DEV_VMM_BACKDOOR", \ diff --git a/include/VBox/vmm/pdmcommon.h b/include/VBox/vmm/pdmcommon.h -index cbad79983e..8746e53afc 100644 +index cbad79983..8746e53af 100644 --- a/include/VBox/vmm/pdmcommon.h +++ b/include/VBox/vmm/pdmcommon.h @@ -111,6 +111,11 @@ @@ -148,7 +148,7 @@ index cbad79983e..8746e53afc 100644 /** * Is asynchronous handling of suspend or power off notification completed? diff --git a/include/VBox/vmm/pdmifs.h b/include/VBox/vmm/pdmifs.h -index c4eaeb1fca..86a3a94afb 100644 +index c4eaeb1fc..86a3a94af 100644 --- a/include/VBox/vmm/pdmifs.h +++ b/include/VBox/vmm/pdmifs.h @@ -42,6 +42,9 @@ @@ -177,7 +177,7 @@ index c4eaeb1fca..86a3a94afb 100644 /** Pointer to a display port interface. */ typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT; diff --git a/include/VBox/vmm/vmmr3vtable-def.h b/include/VBox/vmm/vmmr3vtable-def.h -index e603a58997..b4207844f5 100644 +index e603a5899..b4207844f 100644 --- a/include/VBox/vmm/vmmr3vtable-def.h +++ b/include/VBox/vmm/vmmr3vtable-def.h @@ -595,6 +595,7 @@ VTABLE_ENTRY(PDMR3DeviceDetach) @@ -190,7 +190,7 @@ index e603a58997..b4207844f5 100644 VTABLE_ENTRY(PDMR3QueryLun) diff --git a/include/cyberus/edid.hpp b/include/cyberus/edid.hpp new file mode 100644 -index 0000000000..b05b59ebb3 +index 000000000..b05b59ebb --- /dev/null +++ b/include/cyberus/edid.hpp @@ -0,0 +1,423 @@ @@ -622,7 +622,7 @@ similarity index 100% rename from include/svp/pci.h rename to include/cyberus/pci.h diff --git a/src/VBox/Devices/Bus/DevVfio.h b/src/VBox/Devices/Bus/DevVfio.h -index cfe384d7a1..d6bfb0a9f2 100644 +index cfe384d7a..d6bfb0a9f 100644 --- a/src/VBox/Devices/Bus/DevVfio.h +++ b/src/VBox/Devices/Bus/DevVfio.h @@ -19,7 +19,7 @@ @@ -635,7 +635,7 @@ index cfe384d7a1..d6bfb0a9f2 100644 #include #include diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp -index a2ce3b3937..6c0ab349b6 100644 +index a2ce3b393..6c0ab349b 100644 --- a/src/VBox/Devices/Graphics/DevVGA.cpp +++ b/src/VBox/Devices/Graphics/DevVGA.cpp @@ -6213,6 +6213,49 @@ static DECLCALLBACK(void) vgaR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) @@ -702,7 +702,7 @@ index a2ce3b3937..6c0ab349b6 100644 VERR_INVALID_PARAMETER); diff --git a/src/VBox/Devices/Graphics/DevVirtioGpu.cpp b/src/VBox/Devices/Graphics/DevVirtioGpu.cpp new file mode 100644 -index 0000000000..20f3e54de8 +index 000000000..20f3e54de --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpu.cpp @@ -0,0 +1,407 @@ @@ -1115,7 +1115,7 @@ index 0000000000..20f3e54de8 +} diff --git a/src/VBox/Devices/Graphics/DevVirtioGpu.hpp b/src/VBox/Devices/Graphics/DevVirtioGpu.hpp new file mode 100644 -index 0000000000..72474ed6eb +index 000000000..72474ed6e --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpu.hpp @@ -0,0 +1,373 @@ @@ -1494,7 +1494,7 @@ index 0000000000..72474ed6eb +}; diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.cpp b/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.cpp new file mode 100644 -index 0000000000..4db05af5b7 +index 000000000..4db05af5b --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.cpp @@ -0,0 +1,687 @@ @@ -2187,7 +2187,7 @@ index 0000000000..4db05af5b7 +} diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.hpp b/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.hpp new file mode 100644 -index 0000000000..7cf4bf583d +index 000000000..7cf4bf583 --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuCmdHandler.hpp @@ -0,0 +1,353 @@ @@ -2546,7 +2546,7 @@ index 0000000000..7cf4bf583d +}; diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuDefinitions.hpp b/src/VBox/Devices/Graphics/DevVirtioGpuDefinitions.hpp new file mode 100644 -index 0000000000..fbb2fa78e8 +index 000000000..fbb2fa78e --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuDefinitions.hpp @@ -0,0 +1,360 @@ @@ -2912,7 +2912,7 @@ index 0000000000..fbb2fa78e8 +} // namespace virtioGpu diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.cpp b/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.cpp new file mode 100644 -index 0000000000..7a04ca9d5c +index 000000000..7a04ca9d5 --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.cpp @@ -0,0 +1,413 @@ @@ -3331,7 +3331,7 @@ index 0000000000..7a04ca9d5c +} diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.hpp b/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.hpp new file mode 100644 -index 0000000000..838a23602d +index 000000000..838a23602 --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuDisplayManager.hpp @@ -0,0 +1,213 @@ @@ -3550,7 +3550,7 @@ index 0000000000..838a23602d +}; diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuResource.hpp b/src/VBox/Devices/Graphics/DevVirtioGpuResource.hpp new file mode 100644 -index 0000000000..f27d57618f +index 000000000..f27d57618 --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuResource.hpp @@ -0,0 +1,80 @@ @@ -3636,7 +3636,7 @@ index 0000000000..f27d57618f +}; diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.cpp b/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.cpp new file mode 100644 -index 0000000000..5a5d18c2e2 +index 000000000..5a5d18c2e --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.cpp @@ -0,0 +1,342 @@ @@ -3984,7 +3984,7 @@ index 0000000000..5a5d18c2e2 +} diff --git a/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.hpp b/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.hpp new file mode 100644 -index 0000000000..fd6a56241c +index 000000000..fd6a56241 --- /dev/null +++ b/src/VBox/Devices/Graphics/DevVirtioGpuVBoxStubs.hpp @@ -0,0 +1,71 @@ @@ -4060,7 +4060,7 @@ index 0000000000..fd6a56241c +DECLCALLBACK(void) vbvavirtioGpuPortReportHostCursorCapabilities(PPDMIDISPLAYPORT, bool, bool); +DECLCALLBACK(void) vbvavirtioGpuPortReportHostCursorPosition(PPDMIDISPLAYPORT, uint32_t, uint32_t, bool); diff --git a/src/VBox/Devices/Makefile.kmk b/src/VBox/Devices/Makefile.kmk -index d2bef9129d..a4caa91016 100644 +index d2bef9129..a4caa9101 100644 --- a/src/VBox/Devices/Makefile.kmk +++ b/src/VBox/Devices/Makefile.kmk @@ -197,6 +197,10 @@ if !defined(VBOX_ONLY_EXTPACKS) && "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SU @@ -4088,7 +4088,7 @@ index d2bef9129d..a4caa91016 100644 VBoxDD_SOURCES += Storage/HBDMgmt-generic.cpp endif diff --git a/src/VBox/Devices/VirtIO/VirtioCore.cpp b/src/VBox/Devices/VirtIO/VirtioCore.cpp -index 3849aa7cbe..8abd7619ba 100644 +index 3849aa7cb..8abd7619b 100644 --- a/src/VBox/Devices/VirtIO/VirtioCore.cpp +++ b/src/VBox/Devices/VirtIO/VirtioCore.cpp @@ -1272,7 +1272,7 @@ static int virtioNudgeGuest(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint8_t uCa @@ -4101,7 +4101,7 @@ index 3849aa7cbe..8abd7619ba 100644 } else if (uMsixVector != VIRTIO_MSI_NO_VECTOR) diff --git a/src/VBox/Devices/build/VBoxDD.cpp b/src/VBox/Devices/build/VBoxDD.cpp -index d601e45546..e7497c649f 100644 +index d601e4554..e7497c649 100644 --- a/src/VBox/Devices/build/VBoxDD.cpp +++ b/src/VBox/Devices/build/VBoxDD.cpp @@ -250,6 +250,9 @@ extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t @@ -4115,7 +4115,7 @@ index d601e45546..e7497c649f 100644 return VINF_SUCCESS; } diff --git a/src/VBox/Devices/build/VBoxDD.h b/src/VBox/Devices/build/VBoxDD.h -index d208ea1e7f..63dedfaa64 100644 +index d208ea1e7..63dedfaa6 100644 --- a/src/VBox/Devices/build/VBoxDD.h +++ b/src/VBox/Devices/build/VBoxDD.h @@ -109,6 +109,7 @@ extern const PDMDEVREG g_DevicePciRaw; @@ -4127,7 +4127,7 @@ index d208ea1e7f..63dedfaa64 100644 #ifdef VBOX_WITH_VIRTUALKD extern const PDMDEVREG g_DeviceVirtualKD; diff --git a/src/VBox/Devices/testcase/Makefile.kmk b/src/VBox/Devices/testcase/Makefile.kmk -index a65768b802..288199e3bc 100644 +index a65768b80..288199e3b 100644 --- a/src/VBox/Devices/testcase/Makefile.kmk +++ b/src/VBox/Devices/testcase/Makefile.kmk @@ -70,12 +70,18 @@ ifeq ($(KBUILD_TARGET),$(KBUILD_HOST)) @@ -4196,7 +4196,7 @@ index a65768b802..288199e3bc 100644 include $(FILE_KBUILD_SUB_FOOTER) diff --git a/src/VBox/Devices/testcase/tstVirtioGpuAdapter.hpp b/src/VBox/Devices/testcase/tstVirtioGpuAdapter.hpp new file mode 100644 -index 0000000000..9e23a733cf +index 000000000..9e23a733c --- /dev/null +++ b/src/VBox/Devices/testcase/tstVirtioGpuAdapter.hpp @@ -0,0 +1,181 @@ @@ -4383,7 +4383,7 @@ index 0000000000..9e23a733cf +}; diff --git a/src/VBox/Devices/testcase/tstVirtioGpuCmdHandling.cpp b/src/VBox/Devices/testcase/tstVirtioGpuCmdHandling.cpp new file mode 100644 -index 0000000000..a10d4e1aaf +index 000000000..a10d4e1aa --- /dev/null +++ b/src/VBox/Devices/testcase/tstVirtioGpuCmdHandling.cpp @@ -0,0 +1,450 @@ @@ -4838,7 +4838,7 @@ index 0000000000..a10d4e1aaf + } +} diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp -index fffa353734..3381669b3c 100644 +index fffa35373..3381669b3 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp @@ -1457,6 +1457,18 @@ HRESULT showVMInfo(ComPtr pVirtualBox, @@ -4861,7 +4861,7 @@ index fffa353734..3381669b3c 100644 if (details == VMINFO_MACHINEREADABLE) pszCtrl = "unknown"; diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp -index aa3ecf7986..ce922b008c 100644 +index aa3ecf798..ce922b008 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp @@ -1005,6 +1005,12 @@ RTEXITCODE handleModifyVM(HandlerArg *a) @@ -4878,7 +4878,7 @@ index aa3ecf7986..ce922b008c 100644 { errorArgument(ModifyVM::tr("Invalid --graphicscontroller argument '%s'"), ValueUnion.psz); diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp -index 3799bcab84..f5da2c826a 100644 +index 3799bcab8..f5da2c826 100644 --- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp +++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp @@ -316,6 +316,8 @@ template<> QString toString(const KGraphicsControllerType &type) @@ -4900,7 +4900,7 @@ index 3799bcab84..f5da2c826a 100644 { AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData())); diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl -index 26e9d94aa0..ad6b2dd395 100644 +index 26e9d94aa..ad6b2dd39 100644 --- a/src/VBox/Main/idl/VirtualBox.xidl +++ b/src/VBox/Main/idl/VirtualBox.xidl @@ -6536,6 +6536,12 @@ @@ -4917,7 +4917,7 @@ index 26e9d94aa0..ad6b2dd395 100644 setAttribute("controller", pcszGraphics); diff --git a/src/VBox/Main/xml/VirtualBox-settings.xsd b/src/VBox/Main/xml/VirtualBox-settings.xsd -index 60f7303c5e..460c5e7907 100644 +index 60f7303c5..460c5e790 100644 --- a/src/VBox/Main/xml/VirtualBox-settings.xsd +++ b/src/VBox/Main/xml/VirtualBox-settings.xsd @@ -289,6 +289,8 @@ @@ -5239,7 +5239,7 @@ index 60f7303c5e..460c5e7907 100644 diff --git a/src/VBox/Runtime/VBox/log-vbox.cpp b/src/VBox/Runtime/VBox/log-vbox.cpp -index 9d9c5d731e..5b75d76fbe 100644 +index 9d9c5d731..5b75d76fb 100644 --- a/src/VBox/Runtime/VBox/log-vbox.cpp +++ b/src/VBox/Runtime/VBox/log-vbox.cpp @@ -273,6 +273,7 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void) @@ -5251,7 +5251,7 @@ index 9d9c5d731e..5b75d76fbe 100644 ASSERT_LOG_GROUP(DEV_VIRTIO); ASSERT_LOG_GROUP(DEV_VIRTIO_NET); diff --git a/src/VBox/VMM/VMMR3/GIMHv.cpp b/src/VBox/VMM/VMMR3/GIMHv.cpp -index 1da9065120..116045bb2f 100644 +index 1da906512..116045bb2 100644 --- a/src/VBox/VMM/VMMR3/GIMHv.cpp +++ b/src/VBox/VMM/VMMR3/GIMHv.cpp @@ -239,7 +239,8 @@ VMMR3_INT_DECL(int) gimR3HvInit(PVM pVM, PCFGMNODE pGimCfg) @@ -5283,5 +5283,5 @@ index 1da9065120..116045bb2f 100644 #ifdef VBOX_WITH_KVM /* Extended hypercalls require KVM_EXIT_HYPER_HCALL exits to be forwarded gimHvHypercall. -- -2.43.0 +2.44.0 diff --git a/patches/0005-open-source-add-public-information-tooling.patch b/patches/0005-open-source-add-public-information-tooling.patch new file mode 100644 index 00000000..a190adf0 --- /dev/null +++ b/patches/0005-open-source-add-public-information-tooling.patch @@ -0,0 +1,137 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Hertrampf +Date: Thu, 18 Jan 2024 16:08:47 +0100 +Subject: [PATCH] open-source: add public information/tooling + +doc: Add readme for open-source release + +The Readme is placed in the vboxsrc/ directory, so that is directly +included when shipping our vbox sources. + +open-source: add github issue template +--- + .github/ISSUE_TEMPLATE/issue_template.md | 37 +++++++++++++ + README.md | 67 ++++++++++++++++++++++++ + 2 files changed, 104 insertions(+) + create mode 100644 vboxsrc/.github/ISSUE_TEMPLATE/issue_template.md + create mode 100644 vboxsrc/README.md + +diff --git a/.github/ISSUE_TEMPLATE/issue_template.md b/.github/ISSUE_TEMPLATE/issue_template.md +new file mode 100644 +index 000000000..264a4f24c +--- /dev/null ++++ b/.github/ISSUE_TEMPLATE/issue_template.md +@@ -0,0 +1,37 @@ ++--- ++name: Bug report ++about: Create a bug report ++title: '' ++labels: '' ++assignees: '' ++ ++--- ++ ++### Bug Description ++ ++A clear and concise description of what the bug is. ++ ++### How to Reproduce ++ ++Steps to reproduce the behavior. ++ ++### VM configuration ++ ++Guest OS configuration details: ++ ++* Guest OS type and version (e.g. Windows 10 22H2) ++* Attach guest VM configuration file from `VirtualBox VMs//.vbox` ++ ++Host OS details: ++ ++* Host OS distribution ++* Host OS kernel version ++ ++### Logs ++ ++Following logs are required: ++ ++* Linux kernel output ++* VirtualBox Release Log ++ * In the VirtualBox GUI click the three dots next to the ++ guest VM name -> Logs -> Save +diff --git a/README.md b/README.md +new file mode 100644 +index 000000000..09ab81668 +--- /dev/null ++++ b/README.md +@@ -0,0 +1,67 @@ ++# VirtualBox KVM ++ ++This repository contains an adapted version of the open source virtualization ++tool VirtualBox called VirtualBox KVM. ++VirtualBox KVM uses Linux KVM as the underlying hypervisor. ++ ++## What to expect ++ ++The basic look and feel of VirtualBox KVM will be the same as with an ++conventional VirtualBox. The user is able to boot the same guest VMs in their ++existing VirtualBox configuration. ++ ++Nonetheless, there are the following benefits of using VirtualBox KVM compared ++to the conventional VirtualBox: ++ ++* VirtualBox can run in parallel to QEMU/KVM ++* VirtualBox kernel driver (`vboxdrv`) is not required ++* Modern virtualization features supported by KVM are automatically used (e.g. ++ APICv) ++* KVM is part of the Linux kernel and therefore always directly available with ++ every kernel update ++ ++Due to the replacement of the underlying hypervisor, there will be differences ++in the guest performance. Performance differences heavily depend on the guest ++workload. ++ ++## How to use ++ ++There are no prebuilt packages of VirtualBox KVM and it needs to be build from ++source. The process of building VirtualBox from source can be found ++[on virtualbox.org](https://www.virtualbox.org/wiki/Linux%20build%20instructions) and only ++minor adjustments are required to build VirtualBox with KVM as a backend. ++ ++After having all the prerequisites installed, the build process can be condensed ++to the following steps: ++ ++```shell ++$ ./configure --with-kvm --disable-kmods --disable-docs --disable-hardening --disable-java ++$ source ./env.sh ++$ kmk ++$ out/linux.amd64/release/bin/VirtualBox ++``` ++ ++The noticeable difference to the official build process is the addition of ++`--with-kvm` when calling `./configure`. ++ ++## Known issues and limitations ++ ++* Currently, Intel x86_64 is the only supported host platform. ++ * AMD will most likely work too but is considered experimental at the moment. ++* Linux is required as a host operating system for building and running ++ VirtualBox KVM. ++* Starting with Intel Tiger Lake (11th Gen Core processors) or newer, split lock ++ detection must be turned off in the host system. This can be achieved using ++ the Linux kernel command line parameter `split_lock_detect=off` or using the ++ `split_lock_mitigate` sysctl. ++ ++## How to engage ++ ++If you would like to use VirtualBox with KVM or if you have a need for custom ++virtualization solutions, we are happy to provide guidance and engineering ++services. Please reach out to us via our ++[support form](https://cyberus-technology.de/contact) or via e-mail at ++. ++ ++If you encounter any issues please use the provided issue template and describe ++your problem as detailed as possible. +-- +2.44.0 + diff --git a/patches/0006-open-source-add-concrete-installation-instructions.patch b/patches/0006-open-source-add-concrete-installation-instructions.patch new file mode 100644 index 00000000..2f3c72e5 --- /dev/null +++ b/patches/0006-open-source-add-concrete-installation-instructions.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Markus Napierkowski +Date: Tue, 30 Jan 2024 16:20:36 +0100 +Subject: [PATCH] open-source: add concrete installation instructions + +--- + README.md | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/README.md b/README.md +index 09ab81668..b143e2e15 100644 +--- a/README.md ++++ b/README.md +@@ -26,11 +26,30 @@ workload. + + ## How to use + +-There are no prebuilt packages of VirtualBox KVM and it needs to be build from ++There are no prebuilt packages of VirtualBox KVM and it needs to be built from + source. The process of building VirtualBox from source can be found + [on virtualbox.org](https://www.virtualbox.org/wiki/Linux%20build%20instructions) and only + minor adjustments are required to build VirtualBox with KVM as a backend. + ++On a fresh install of Ubuntu 22.04, you can use the following command to install ++all prerequisites via `apt`: ++ ++```shell ++apt install acpica-tools chrpath doxygen g++-multilib libasound2-dev libcap-dev \ ++ libcurl4-openssl-dev libdevmapper-dev libidl-dev libopus-dev libpam0g-dev \ ++ libpulse-dev libqt5opengl5-dev libqt5x11extras5-dev qttools5-dev libsdl1.2-dev libsdl-ttf2.0-dev \ ++ libssl-dev libvpx-dev libxcursor-dev libxinerama-dev libxml2-dev libxml2-utils \ ++ libxmu-dev libxrandr-dev make nasm python3-dev python2-dev qttools5-dev-tools \ ++ texlive texlive-fonts-extra texlive-latex-extra unzip xsltproc \ ++ \ ++ default-jdk libstdc++5 libxslt1-dev linux-kernel-headers makeself \ ++ mesa-common-dev subversion yasm zlib1g-dev glslang-tools \ ++ libc6-dev-i386 lib32stdc++6 libtpms-dev ++``` ++ ++Newer GCC versions (>= 12) might cause build issues. The command above installs a ++compatible version on Ubuntu 22.04. ++ + After having all the prerequisites installed, the build process can be condensed + to the following steps: + +-- +2.44.0 + diff --git a/patches/0005-config-switch-to-split-irq-chip-as-default.patch b/patches/0007-config-switch-to-split-irq-chip-as-default.patch similarity index 71% rename from patches/0005-config-switch-to-split-irq-chip-as-default.patch rename to patches/0007-config-switch-to-split-irq-chip-as-default.patch index 859024d7..2980af4a 100644 --- a/patches/0005-config-switch-to-split-irq-chip-as-default.patch +++ b/patches/0007-config-switch-to-split-irq-chip-as-default.patch @@ -1,14 +1,14 @@ -From a11610b0efaf8f2dc21699c9600f1c8a60b47a62 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Stefan Hertrampf Date: Mon, 5 Feb 2024 13:13:50 +0100 -Subject: [PATCH 05/17] config: switch to split irq chip as default +Subject: [PATCH] config: switch to split irq chip as default --- Config.kmk | 1 - 1 file changed, 1 deletion(-) diff --git a/Config.kmk b/Config.kmk -index d353b0920f..7d09ca3972 100644 +index d353b0920..7d09ca397 100644 --- a/Config.kmk +++ b/Config.kmk @@ -2009,7 +2009,6 @@ endif @@ -20,5 +20,5 @@ index d353b0920f..7d09ca3972 100644 ifndef VBOX_HEADLESS DEFS += VBOX_WITH_GVT_RENDERING -- -2.43.0 +2.44.0 diff --git a/patches/0006-NEM-rm-redundant-split-irq-definitions.patch b/patches/0008-NEM-rm-redundant-split-irq-definitions.patch similarity index 94% rename from patches/0006-NEM-rm-redundant-split-irq-definitions.patch rename to patches/0008-NEM-rm-redundant-split-irq-definitions.patch index 52e0638e..4b6dee1f 100644 --- a/patches/0006-NEM-rm-redundant-split-irq-definitions.patch +++ b/patches/0008-NEM-rm-redundant-split-irq-definitions.patch @@ -1,14 +1,14 @@ -From bc094ae4151da1e4fa5bdcb603c1f6f51596e999 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Stefan Hertrampf Date: Mon, 5 Feb 2024 13:15:33 +0100 -Subject: [PATCH 06/17] NEM: rm redundant split irq definitions +Subject: [PATCH] NEM: rm redundant split irq definitions --- include/VBox/vmm/nem.h | 63 ------------------------------------------ 1 file changed, 63 deletions(-) diff --git a/include/VBox/vmm/nem.h b/include/VBox/vmm/nem.h -index 26d055fcd0..71f66d3dba 100644 +index 26d055fcd..71f66d3db 100644 --- a/include/VBox/vmm/nem.h +++ b/include/VBox/vmm/nem.h @@ -294,69 +294,6 @@ VMMR3_INT_DECL(int) NEMR3KvmGetHvCpuIdLeaves(PVM pVM, PCPUMCPUIDLEAF *outpCpuId, @@ -82,5 +82,5 @@ index 26d055fcd0..71f66d3dba 100644 * @{ */ /** Set if the range is replacing RAM rather that unused space. */ -- -2.43.0 +2.44.0 diff --git a/patches/0007-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch b/patches/0009-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch similarity index 89% rename from patches/0007-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch rename to patches/0009-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch index 7a8ef8e2..d7238940 100644 --- a/patches/0007-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch +++ b/patches/0009-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch @@ -1,7 +1,7 @@ -From 2a2fbce97aaa10a0e2f53f1cf7014cad67e808a0 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Tue, 6 Feb 2024 11:25:35 +0100 -Subject: [PATCH 07/17] NEM: KVM: disable KVM access to Hyper-V MSRs +Subject: [PATCH] NEM: KVM: disable KVM access to Hyper-V MSRs If we want KVM to handle these MSRs, we also need to sync them correcly in nemHCLnxImportState and nemHCLnxExportState. Otherwise, VM reboot and @@ -12,7 +12,7 @@ because the MSRs go out of sync. 1 file changed, 8 insertions(+) diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 38251a5568..1077864943 100644 +index 38251a556..107786494 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -1112,6 +1112,13 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) @@ -38,5 +38,5 @@ index 38251a5568..1077864943 100644 /** @todo Specify other ranges too? Like hyper-V and KVM to make sure we get * the MSR requests instead of KVM. */ -- -2.43.0 +2.44.0 diff --git a/patches/0008-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch b/patches/0010-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch similarity index 94% rename from patches/0008-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch rename to patches/0010-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch index c85d9ef7..2b45b4eb 100644 --- a/patches/0008-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch +++ b/patches/0010-NEM-don-t-clobber-TSC-during-VM-suspend-resume.patch @@ -1,7 +1,7 @@ -From 3a32ac6843458a971662290db3cab78a67cd0733 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Wed, 14 Feb 2024 15:48:25 +0000 -Subject: [PATCH 08/17] NEM: don't clobber TSC during VM suspend/resume +Subject: [PATCH] NEM: don't clobber TSC during VM suspend/resume When we suspend a VM it's TSC currently reverts to zero. This causes problems, such as hangs in Windows. Implement the missing TSC query @@ -11,7 +11,7 @@ and set functions to correctly restore the TSC. 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 1077864943..2b78453e71 100644 +index 107786494..2b78453e7 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -2592,8 +2592,31 @@ static int nemHCLnxExportState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, struct kvm_ @@ -91,5 +91,5 @@ index 1077864943..2b78453e71 100644 } -- -2.43.0 +2.44.0 diff --git a/patches/0009-vmm-rm-unused-pcid-hiding.patch b/patches/0011-vmm-rm-unused-pcid-hiding.patch similarity index 95% rename from patches/0009-vmm-rm-unused-pcid-hiding.patch rename to patches/0011-vmm-rm-unused-pcid-hiding.patch index 54e21d88..a73437fe 100644 --- a/patches/0009-vmm-rm-unused-pcid-hiding.patch +++ b/patches/0011-vmm-rm-unused-pcid-hiding.patch @@ -1,7 +1,7 @@ -From 054db71c81231f7c3e7b994d32cf15f191c40408 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Stefan Hertrampf Date: Mon, 19 Feb 2024 11:27:48 +0100 -Subject: [PATCH 09/17] vmm: rm unused pcid hiding +Subject: [PATCH] vmm: rm unused pcid hiding Since we have proper generic checking for features supported by KVM and hide unsupported features we do not need this explicit hiding anymore. @@ -10,7 +10,7 @@ unsupported features we do not need this explicit hiding anymore. 1 file changed, 45 deletions(-) diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp -index c448c9ecd8..a5f48497a1 100644 +index c448c9ecd..a5f48497a 100644 --- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp @@ -1419,51 +1419,6 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) @@ -66,5 +66,5 @@ index c448c9ecd8..a5f48497a1 100644 if (pCpum->u8PortableCpuIdLevel > 0) { -- -2.43.0 +2.44.0 diff --git a/patches/0012-doc-readme-additions.patch b/patches/0012-doc-readme-additions.patch new file mode 100644 index 00000000..bb6d549a --- /dev/null +++ b/patches/0012-doc-readme-additions.patch @@ -0,0 +1,114 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Nuernberger +Date: Mon, 19 Feb 2024 18:48:20 +0100 +Subject: [PATCH] doc: readme additions + +--- + README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 63 insertions(+), 4 deletions(-) + +diff --git a/README.md b/README.md +index b143e2e15..bdc3021f4 100644 +--- a/README.md ++++ b/README.md +@@ -6,12 +6,12 @@ VirtualBox KVM uses Linux KVM as the underlying hypervisor. + + ## What to expect + +-The basic look and feel of VirtualBox KVM will be the same as with an +-conventional VirtualBox. The user is able to boot the same guest VMs in their +-existing VirtualBox configuration. ++The basic look and feel of VirtualBox KVM will be the same as with upstream ++VirtualBox. The user is able to boot the same guest VMs as in their existing ++VirtualBox configuration. + + Nonetheless, there are the following benefits of using VirtualBox KVM compared +-to the conventional VirtualBox: ++to the upstream VirtualBox: + + * VirtualBox can run in parallel to QEMU/KVM + * VirtualBox kernel driver (`vboxdrv`) is not required +@@ -63,10 +63,17 @@ $ out/linux.amd64/release/bin/VirtualBox + The noticeable difference to the official build process is the addition of + `--with-kvm` when calling `./configure`. + ++**Note:** These instructions are intended for local building and testing ++purposes only. There are more considerations when packaging VirtualBox for a ++distribution. We do not advise or recommend instructions for packaging at this ++time. ++ + ## Known issues and limitations + + * Currently, Intel x86_64 is the only supported host platform. + * AMD will most likely work too but is considered experimental at the moment. ++ * Processor support for the `XSAVE` instruction is required. This implies a ++ 2nd Gen Core processor or newer. + * Linux is required as a host operating system for building and running + VirtualBox KVM. + * Starting with Intel Tiger Lake (11th Gen Core processors) or newer, split lock +@@ -74,6 +81,52 @@ The noticeable difference to the official build process is the addition of + the Linux kernel command line parameter `split_lock_detect=off` or using the + `split_lock_mitigate` sysctl. + ++## Networking ++ ++The new KVM backend utilizes the `--driverless` mode of VirtualBox. Some setups ++that require kernel module support will not work in this mode and prevent the ++VM from starting. Specifically, the Bridged adapter and "NAT Network" modes do ++not work. Only regular NAT is easily supported. More complex setups will need ++manual configuration, e.g., using `tun`/`tap` devices. ++ ++## USB pass-through ++ ++USB device pass-through is supported. Some `udev` rules are required to ++trigger the creation of fitting device nodes, though. VirtualBox provides the ++`out/linux.amd64/bin/VBoxCreateUSBNode.sh` script to create the right nodes. ++Distribution-provided packages of VirtualBox will usually take care of the ++required setup. The following is a short summary of the additional configuration ++steps, which might differ based on the distribution. Be sure to know what you ++are doing when following these steps. This can potentially interfere with ++existing installations. ++ ++* Create a group `vboxusers` and add your user to the group. Remember group ++ changes need a re-login or `newgrp` to take effect. ++```shell ++sudo groupadd -r vboxusers -U ++``` ++ ++* Place the `VBoxCreateUSBNode.sh` script in a system accessible folder ++```shell ++sudo mkdir /usr/lib/virtualbox ++sudo cp out/release/linux.amd64/bin/VBoxCreateUSBNode.sh /usr/lib/virtualbox ++sudo chown -R root:vboxusers /usr/lib/virtualbox ++``` ++ ++* Create a `udev` rule file (e.g. `60-vboxusb.rules`) in `/etc/udev/rules.d/` ++ with the following entries: ++```shell ++SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" ++SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" ++SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" ++SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" ++``` ++ ++* Reload the udev rules ++```shell ++sudo systemctl reload systemd-udevd ++``` ++ + ## How to engage + + If you would like to use VirtualBox with KVM or if you have a need for custom +@@ -84,3 +137,9 @@ services. Please reach out to us via our + + If you encounter any issues please use the provided issue template and describe + your problem as detailed as possible. ++ ++## Licensing ++ ++This source code is released under the same license terms as the original ++VirtualBox Open Source release it is derived from. See the `COPYING` file ++for details. +-- +2.44.0 + diff --git a/patches/0010-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch b/patches/0013-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch similarity index 96% rename from patches/0010-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch rename to patches/0013-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch index 6b0875c8..0442e21b 100644 --- a/patches/0010-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch +++ b/patches/0013-GIMAll-add-HyperV-PV-on-KVM-stub-implementation.patch @@ -1,7 +1,7 @@ -From 24f0ee5615a280e98947ecebfe18d55e178ce955 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Wed, 7 Feb 2024 13:56:44 +0000 -Subject: [PATCH 10/17] GIMAll: add HyperV PV on KVM stub implementation +Subject: [PATCH] GIMAll: add HyperV PV on KVM stub implementation --- src/VBox/VMM/VMMAll/GIMAllHvOnKvm.cpp | 134 ++++++++++++++++++++++++++ @@ -10,7 +10,7 @@ Subject: [PATCH 10/17] GIMAll: add HyperV PV on KVM stub implementation diff --git a/src/VBox/VMM/VMMAll/GIMAllHvOnKvm.cpp b/src/VBox/VMM/VMMAll/GIMAllHvOnKvm.cpp new file mode 100644 -index 0000000000..94870277df +index 000000000..94870277d --- /dev/null +++ b/src/VBox/VMM/VMMAll/GIMAllHvOnKvm.cpp @@ -0,0 +1,134 @@ @@ -149,5 +149,5 @@ index 0000000000..94870277df + AssertLogRelMsgReturn(false, ("%s", __PRETTY_FUNCTION__), VERR_NOT_SUPPORTED); +} -- -2.43.0 +2.44.0 diff --git a/patches/0011-GIMR3-add-HyperV-PV-on-KVM-implementation.patch b/patches/0014-GIMR3-add-HyperV-PV-on-KVM-implementation.patch similarity index 99% rename from patches/0011-GIMR3-add-HyperV-PV-on-KVM-implementation.patch rename to patches/0014-GIMR3-add-HyperV-PV-on-KVM-implementation.patch index 0725f636..125f8a77 100644 --- a/patches/0011-GIMR3-add-HyperV-PV-on-KVM-implementation.patch +++ b/patches/0014-GIMR3-add-HyperV-PV-on-KVM-implementation.patch @@ -1,7 +1,7 @@ -From 62d80511b6768c5ce2dadf2c5d1a8d01e513107d Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Wed, 7 Feb 2024 13:57:00 +0000 -Subject: [PATCH 11/17] GIMR3: add HyperV PV on KVM implementation +Subject: [PATCH] GIMR3: add HyperV PV on KVM implementation --- src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp | 720 +++++++++++++++++++++++++++ @@ -11,7 +11,7 @@ Subject: [PATCH 11/17] GIMR3: add HyperV PV on KVM implementation diff --git a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp new file mode 100644 -index 0000000000..0360ae0b52 +index 000000000..0360ae0b5 --- /dev/null +++ b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp @@ -0,0 +1,720 @@ @@ -736,7 +736,7 @@ index 0000000000..0360ae0b52 + return VERR_GIM_NO_DEBUG_CONNECTION; +} diff --git a/src/VBox/VMM/include/GIMHvInternal.h b/src/VBox/VMM/include/GIMHvInternal.h -index 14b00b7394..7308180cb5 100644 +index 14b00b739..7308180cb 100644 --- a/src/VBox/VMM/include/GIMHvInternal.h +++ b/src/VBox/VMM/include/GIMHvInternal.h @@ -1102,6 +1102,7 @@ AssertCompileSize(GIMHVEXTGETBOOTZEROMEM, 16); @@ -748,5 +748,5 @@ index 14b00b7394..7308180cb5 100644 /** * MMIO2 region indices. -- -2.43.0 +2.44.0 diff --git a/patches/0012-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch b/patches/0015-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch similarity index 84% rename from patches/0012-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch rename to patches/0015-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch index 5935d42a..1ca091d8 100644 --- a/patches/0012-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch +++ b/patches/0015-build-use-HyperV-on-KVM-GIM-implementation-when-VBOX.patch @@ -1,7 +1,7 @@ -From 63fee4de10e3bd3de96ce6103745a4b2a29b03b9 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Wed, 7 Feb 2024 13:57:22 +0000 -Subject: [PATCH 12/17] build: use HyperV on KVM GIM implementation when +Subject: [PATCH] build: use HyperV on KVM GIM implementation when VBOX_WITH_KVM is selected --- @@ -9,7 +9,7 @@ Subject: [PATCH 12/17] build: use HyperV on KVM GIM implementation when 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/VBox/VMM/Makefile.kmk b/src/VBox/VMM/Makefile.kmk -index 1d87ac3f2b..43c8b53185 100644 +index 1d87ac3f2..43c8b5318 100644 --- a/src/VBox/VMM/Makefile.kmk +++ b/src/VBox/VMM/Makefile.kmk @@ -137,7 +137,8 @@ VBoxVMM_SOURCES = \ @@ -33,5 +33,5 @@ index 1d87ac3f2b..43c8b53185 100644 VMMAll/TMAll.cpp \ VMMAll/TMAllCpu.cpp \ -- -2.43.0 +2.44.0 diff --git a/patches/0013-NEM-MSR-access-helpers.patch b/patches/0016-NEM-MSR-access-helpers.patch similarity index 94% rename from patches/0013-NEM-MSR-access-helpers.patch rename to patches/0016-NEM-MSR-access-helpers.patch index 52dd7860..4c343ac7 100644 --- a/patches/0013-NEM-MSR-access-helpers.patch +++ b/patches/0016-NEM-MSR-access-helpers.patch @@ -1,7 +1,7 @@ -From 04f4f243f9567bde1114a6596bd3cb2b18d8ce27 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Fri, 9 Feb 2024 08:58:06 +0000 -Subject: [PATCH 13/17] NEM: MSR access helpers +Subject: [PATCH] NEM: MSR access helpers --- include/VBox/vmm/nem.h | 18 +++++++++++ @@ -9,7 +9,7 @@ Subject: [PATCH 13/17] NEM: MSR access helpers 2 files changed, 56 insertions(+) diff --git a/include/VBox/vmm/nem.h b/include/VBox/vmm/nem.h -index 71f66d3dba..8603297854 100644 +index 71f66d3db..860329785 100644 --- a/include/VBox/vmm/nem.h +++ b/include/VBox/vmm/nem.h @@ -170,6 +170,24 @@ VMMR3_INT_DECL(int) NEMR3NotifyPhysRomRegisterLate(PVM pVM, RTGCPHYS GCPhys, RT @@ -38,7 +38,7 @@ index 71f66d3dba..8603297854 100644 * Asserts a specific interrupt line on both PIC and I/O APIC. * @param pVM The cross context VM structure. diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 2b78453e71..4e1876a944 100644 +index 2b78453e7..4e1876a94 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -1562,6 +1562,44 @@ VMMR3_INT_DECL(int) NEMR3LoadExec(PVM pVM) @@ -87,5 +87,5 @@ index 2b78453e71..4e1876a944 100644 { struct kvm_lapic_state state; -- -2.43.0 +2.44.0 diff --git a/patches/0014-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch b/patches/0017-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch similarity index 94% rename from patches/0014-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch rename to patches/0017-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch index 3cc5818e..321cc2d6 100644 --- a/patches/0014-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch +++ b/patches/0017-GIMHvOnKvm-reset-HV-MSRs-on-VM-reset.patch @@ -1,14 +1,14 @@ -From 2d6e7f2e912d4e411e1c53a2948b5827ecaceffe Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Fri, 9 Feb 2024 09:43:59 +0000 -Subject: [PATCH 14/17] GIMHvOnKvm: reset HV MSRs on VM reset +Subject: [PATCH] GIMHvOnKvm: reset HV MSRs on VM reset --- src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp -index 0360ae0b52..576e9dc211 100644 +index 0360ae0b5..576e9dc21 100644 --- a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp +++ b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp @@ -451,15 +451,32 @@ VMMR3_INT_DECL(void) gimR3HvReset(PVM pVM) @@ -55,5 +55,5 @@ index 0360ae0b52..576e9dc211 100644 } } -- -2.43.0 +2.44.0 diff --git a/patches/0015-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch b/patches/0018-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch similarity index 88% rename from patches/0015-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch rename to patches/0018-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch index 97909f79..c03b47a6 100644 --- a/patches/0015-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch +++ b/patches/0018-Revert-NEM-KVM-disable-KVM-access-to-Hyper-V-MSRs.patch @@ -1,7 +1,7 @@ -From 09db0738ed1610806adc6d82a4c2dd32176fed0a Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Fri, 9 Feb 2024 13:58:29 +0000 -Subject: [PATCH 15/17] Revert "NEM: KVM: disable KVM access to Hyper-V MSRs" +Subject: [PATCH] Revert "NEM: KVM: disable KVM access to Hyper-V MSRs" This reverts commit 18a6f0a5a32bdb98031839974233909388c40e53. --- @@ -9,7 +9,7 @@ This reverts commit 18a6f0a5a32bdb98031839974233909388c40e53. 1 file changed, 8 deletions(-) diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 4e1876a944..86717f8424 100644 +index 4e1876a94..86717f842 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -1112,13 +1112,6 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) @@ -35,5 +35,5 @@ index 4e1876a944..86717f8424 100644 /** @todo Specify other ranges too? Like hyper-V and KVM to make sure we get * the MSR requests instead of KVM. */ -- -2.43.0 +2.44.0 diff --git a/patches/0016-GIMHvOnKvm-state-save-resume-handling.patch b/patches/0019-GIMHvOnKvm-state-save-resume-handling.patch similarity index 98% rename from patches/0016-GIMHvOnKvm-state-save-resume-handling.patch rename to patches/0019-GIMHvOnKvm-state-save-resume-handling.patch index f512f03c..cd47b900 100644 --- a/patches/0016-GIMHvOnKvm-state-save-resume-handling.patch +++ b/patches/0019-GIMHvOnKvm-state-save-resume-handling.patch @@ -1,7 +1,7 @@ -From 7254652befe80f1728635d12b2e17b63aea694e6 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Tue, 20 Feb 2024 15:52:41 +0100 -Subject: [PATCH 16/17] GIMHvOnKvm: state save/resume handling +Subject: [PATCH] GIMHvOnKvm: state save/resume handling --- src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp | 220 +++++------------------ @@ -9,7 +9,7 @@ Subject: [PATCH 16/17] GIMHvOnKvm: state save/resume handling 2 files changed, 45 insertions(+), 177 deletions(-) diff --git a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp -index 576e9dc211..3627d1a27d 100644 +index 576e9dc21..3627d1a27 100644 --- a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp +++ b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp @@ -49,14 +49,11 @@ @@ -288,7 +288,7 @@ index 576e9dc211..3627d1a27d 100644 /** diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 86717f8424..12a0f98a5f 100644 +index 86717f842..12a0f98a5 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -1564,7 +1564,7 @@ VMMR3_INT_DECL(int) NEMR3KvmGetMsr(PVMCPU pVCpu, uint64_t msr, uint64_t* val) @@ -301,5 +301,5 @@ index 86717f8424..12a0f98a5f 100644 AssertLogRelMsgReturn(val != nullptr, ("NEMR3KvmGetMsr: \ -- -2.43.0 +2.44.0 diff --git a/patches/0017-GIMHvOnKvm-SynIC-STimer-support.patch b/patches/0020-GIMHvOnKvm-SynIC-STimer-support.patch similarity index 93% rename from patches/0017-GIMHvOnKvm-SynIC-STimer-support.patch rename to patches/0020-GIMHvOnKvm-SynIC-STimer-support.patch index 801467c9..2139688f 100644 --- a/patches/0017-GIMHvOnKvm-SynIC-STimer-support.patch +++ b/patches/0020-GIMHvOnKvm-SynIC-STimer-support.patch @@ -1,7 +1,7 @@ -From b3cdf45c8b3d6fa886b4879abe1d9c6cea696a07 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thomas Prescher Date: Tue, 20 Feb 2024 15:53:02 +0100 -Subject: [PATCH 17/17] GIMHvOnKvm: SynIC + STimer support +Subject: [PATCH] GIMHvOnKvm: SynIC + STimer support --- src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp | 8 +++++--- @@ -9,7 +9,7 @@ Subject: [PATCH 17/17] GIMHvOnKvm: SynIC + STimer support 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp -index 3627d1a27d..1683092685 100644 +index 3627d1a27..168309268 100644 --- a/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp +++ b/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp @@ -193,8 +193,8 @@ VMMR3_INT_DECL(int) gimR3HvInit(PVM pVM, PCFGMNODE pGimCfg) @@ -42,7 +42,7 @@ index 3627d1a27d..1683092685 100644 ; diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp -index 12a0f98a5f..82ebed65e6 100644 +index 12a0f98a5..82ebed65e 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp @@ -921,7 +921,7 @@ static int nemR3LnxInitGuestInterface(PVM pVM) @@ -55,5 +55,5 @@ index 12a0f98a5f..82ebed65e6 100644 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) -- -2.43.0 +2.44.0 diff --git a/patches/0021-doc-add-Intel-SR-IOV-graphics-documentation.patch b/patches/0021-doc-add-Intel-SR-IOV-graphics-documentation.patch new file mode 100644 index 00000000..b3d6f1ee --- /dev/null +++ b/patches/0021-doc-add-Intel-SR-IOV-graphics-documentation.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 26 Feb 2024 10:56:26 +0100 +Subject: [PATCH] doc: add Intel SR-IOV graphics documentation + +--- + README.intel-sriov-graphics.md | 111 +++++++++++++++++++++++++++++++++ + 1 file changed, 111 insertions(+) + create mode 100644 vboxsrc/README.intel-sriov-graphics.md + +diff --git a/README.intel-sriov-graphics.md b/README.intel-sriov-graphics.md +new file mode 100644 +index 000000000..0b287c483 +--- /dev/null ++++ b/README.intel-sriov-graphics.md +@@ -0,0 +1,111 @@ ++# Introduction ++ ++This document describes how to setup and use Intel SR-IOV graphics virtualization with VirtualBox KVM. ++The hardware graphics acceleration is not integrated in the GUI yet and requires manual setup. ++Yet, we deem it good enough for people to try this. ++ ++This is a feature which is currently under active development, everything noted here should be ++considered experimental. ++ ++ ++# Requirements ++ ++- Intel Alder Lake (12th Gen Core) or newer ++- Ubuntu 22.04 as host OS ++- VT-d must be enabled in BIOS. ++- IOMMU must be enabled in the host Linux kernel. ++- A Windows 10 or Windows 11 VM with __all__ updates installed ++- Make sure the SR-IOV capability is present: ++ - `lspci | grep VGA`, remember the BDF for the device, we use 0:2.0 in this tutorial ++ - `sudo lspci -s 0:2.0 -v | grep SR-IOV` ++ ++# Host Setup ++ ++The host needs a special Linux kernel which includes the SR-IOV graphics patches from Intel. These patches ++have not been upstreamed yet. In addition, the kernel needs to be booted with custom command line ++options in order for SR-IOV graphics to function properly. ++ ++## Installation with pre-built kernel packages ++ ++If you don't want to compile your own kernel, check the [the latest release](https://github.com/cyberus-technology/virtualbox-kvm/releases) for pre-built packages. ++Note that these packages are built for Ubuntu 22.04 and have not been tested with any ++other Linux distribution. These images are not signed. ++ ++## Installation with self-compiled kernel ++ ++- `sudo apt install flex bison elfutils dwarves dpkg-dev debhelper libelf-dev` ++- `mkdir kernel-intel-sriov` ++- `cd kernel-intel-sriov` ++- `git clone https://github.com/intel/linux-intel-lts.git --branch lts-v6.6.15-linux-240219T085932Z --single-branch` ++- `cd linux-intel-lts` ++- `make olddefconfig` ++- execute: ++ - `scripts/config --disable SYSTEM_TRUSTED_KEYS` ++ - `scripts/config --disable SYSTEM_REVOCATION_KEYS` ++- `make deb-pkg LOCALVERSION="-sriov" -j$(nproc)` ++- `cd ..` ++- `sudo dpkg -i *.deb` ++ ++## Preparing the Linux kernel for SR-IOV graphics ++ ++- Edit `/etc/defaults/grub` ++- Add `i915.enable_guc=3 i915.max_vfs=7 split_lock_detect=off` to `GRUB_CMDLINE_LINUX` ++- Set `GRUB_DEFAULT` to `Advanced options for Ubuntu>Ubuntu, with Linux 6.6.15-sriov` ++- Execute `update-grub` as root ++- Edit `/etc/security/limits.conf` (required because VFIO needs more locked memory than configured as default) ++ - add: ++ - `* soft memlock unlimited` ++ - `* hard memlock unlimited` ++- Reboot ++ ++## Verify Host Setup ++ ++Make sure you have booted the correct Linux kernel; `uname -r` should provide the following output: `6.6.15-sriov`. ++Check `sudo dmesg` for the following output which indicates that SR-IOV has been set up successfully: ++ ++``` ++i915 0000:00:02.0: enabling device (0006 -> 0007) ++i915 0000:00:02.0: Running in SR-IOV PF mode ++i915 0000:00:02.0: [drm] VT-d active for gfx access ++``` ++ ++# Setting up the vGPUs ++ ++- Execute the following commands as root: ++ - `lspci | grep VGA`, remember the BDF for the device, we use 0:2.0 in this tutorial ++ - `lspci -s 0:2.0 -n`, remember device/vendor id ++ - `echo " " > /sys/bus/pci/drivers/vfio-pci/new_id` ++ - `echo 7 > /sys/class/drm/card0/device/sriov_numvfs` ++ - `lspci -v -s 0:2.1`, verify vfio-pci driver is in use ++ - `chmod 0666 /dev/vfio/*` ++ ++# Setting up VirtualBox to use vGPUs ++ ++- Configure ICH9 Chipset: `VBoxManage modifyvm --chipset=ICH9` ++- Attach the vGPU: `VBoxManage modifyvm --attachvfio /sys/bus/pci/devices/0000\:00\:02.1` (no trailing slash) ++- Change display adapter: `VBoxManage modifyvm --graphicscontroller vga-virtiogpu` ++- Boot the VM ++- Verify that there are 2 new display adapters in device manager ++- Install latest Intel GPU driver or wait for Windows to install it automatically ++- Verify in Task Manager that GPU0 is present (Performance Tab) ++- Download and extract [the Intel Display Virtualization Drivers](https://www.intel.com/content/www/us/en/download/806254/nswe-display-virtualization-drivers-for-meteor-lake-ps-pv-meteor-lake-u-h-pv-and-raptor-lake-ps-beta.html) ++- Open Powershell as Admin ++- Change the execution policy: `Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser` ++- Execute `DVInstaller.ps1` ++- VM will reboot ++- Verify in Device Manager that both "Intel Iris Xe Graphics" and "DVServerUMD" are present in display adapters ++- Enjoy your GPU-accelerated VM ;) ++ ++# Limitations ++ ++- Host suspend/resume while GPU acceleration is in use is unsupported and will result in broken VM graphics ++- PIIX3 chipset is unsupported ++- Multiple virtual monitors are unsupported ++- Automatic display resizing is not supported ++ ++# Troubleshooting ++ ++- A vGPU can be removed from a VM via: ++ - `VBoxManage modifyvm --detachvfio /sys/bus/pci/devices/0000\:00\:02.1` (no trailing slash) ++ - `VBoxManage modifyvm --graphicscontroller vboxsvga` ++- After host suspend/resume, the graphics may recover when pressing `Win + Ctrl + Shift + B`. Some windows may stay black, in which case minimizing/maximizing may fix the problem. +-- +2.44.0 + diff --git a/patches/0022-doc-link-SR-IOV-howto-in-README.md.patch b/patches/0022-doc-link-SR-IOV-howto-in-README.md.patch new file mode 100644 index 00000000..bfcc4646 --- /dev/null +++ b/patches/0022-doc-link-SR-IOV-howto-in-README.md.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Wed, 28 Feb 2024 13:04:46 +0100 +Subject: [PATCH] doc: link SR-IOV howto in README.md + +--- + README.md | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/README.md b/README.md +index bdc3021f4..6fafd2ed0 100644 +--- a/README.md ++++ b/README.md +@@ -127,6 +127,11 @@ SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/v + sudo systemctl reload systemd-udevd + ``` + ++## SR-IOV Graphics Virtualization ++ ++If you want to use the graphics virtualization features of modern Intel processors, please refer to our ++[SR-IOV Graphics Virtualization HowTo](README.intel-sriov-graphics.md). ++ + ## How to engage + + If you would like to use VirtualBox with KVM or if you have a need for custom +-- +2.44.0 + diff --git a/patches/0023-doc-Clarify-KVM-backend-name.patch b/patches/0023-doc-Clarify-KVM-backend-name.patch new file mode 100644 index 00000000..849924f4 --- /dev/null +++ b/patches/0023-doc-Clarify-KVM-backend-name.patch @@ -0,0 +1,140 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Markus=20Partheym=C3=BCller?= + +Date: Thu, 7 Mar 2024 15:58:12 +0100 +Subject: [PATCH] doc: Clarify KVM backend name + +--- + README.intel-sriov-graphics.md | 9 ++++---- + README.md | 39 +++++++++++++++++----------------- + 2 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/README.intel-sriov-graphics.md b/README.intel-sriov-graphics.md +index 0b287c483..6e5332150 100644 +--- a/README.intel-sriov-graphics.md ++++ b/README.intel-sriov-graphics.md +@@ -1,8 +1,9 @@ + # Introduction + +-This document describes how to setup and use Intel SR-IOV graphics virtualization with VirtualBox KVM. +-The hardware graphics acceleration is not integrated in the GUI yet and requires manual setup. +-Yet, we deem it good enough for people to try this. ++This document describes how to setup and use Intel SR-IOV graphics ++virtualization with the KVM backend for VirtualBox. The hardware graphics ++acceleration is not integrated in the GUI yet and requires manual setup. Yet, we ++deem it good enough for people to try this. + + This is a feature which is currently under active development, everything noted here should be + considered experimental. +@@ -79,7 +80,7 @@ i915 0000:00:02.0: [drm] VT-d active for gfx access + - `lspci -v -s 0:2.1`, verify vfio-pci driver is in use + - `chmod 0666 /dev/vfio/*` + +-# Setting up VirtualBox to use vGPUs ++# Configuring vGPUs + + - Configure ICH9 Chipset: `VBoxManage modifyvm --chipset=ICH9` + - Attach the vGPU: `VBoxManage modifyvm --attachvfio /sys/bus/pci/devices/0000\:00\:02.1` (no trailing slash) +diff --git a/README.md b/README.md +index 6fafd2ed0..9f832c7fb 100644 +--- a/README.md ++++ b/README.md +@@ -1,19 +1,18 @@ +-# VirtualBox KVM ++# KVM Backend for VirtualBox + +-This repository contains an adapted version of the open source virtualization +-tool VirtualBox called VirtualBox KVM. +-VirtualBox KVM uses Linux KVM as the underlying hypervisor. ++This repository contains a KVM backend for the open source virtualization ++tool VirtualBox. With this backend, Linux KVM is used as the underlying hypervisor. ++ ++*Note:* VirtualBox is a trademark owned by Oracle. This project has no affiliation with Oracle. + + ## What to expect + +-The basic look and feel of VirtualBox KVM will be the same as with upstream +-VirtualBox. The user is able to boot the same guest VMs as in their existing +-VirtualBox configuration. ++The basic look and feel will be largely unchanged. The user is able to ++boot the same guest VMs as in their existing configuration. + +-Nonetheless, there are the following benefits of using VirtualBox KVM compared +-to the upstream VirtualBox: ++Nonetheless, there are the following benefits of using the KVM backend: + +-* VirtualBox can run in parallel to QEMU/KVM ++* VirtualBox VMs can run in parallel to QEMU/KVM + * VirtualBox kernel driver (`vboxdrv`) is not required + * Modern virtualization features supported by KVM are automatically used (e.g. + APICv) +@@ -26,10 +25,10 @@ workload. + + ## How to use + +-There are no prebuilt packages of VirtualBox KVM and it needs to be built from ++There are no prebuilt packages of the resulting program and it needs to be built from + source. The process of building VirtualBox from source can be found + [on virtualbox.org](https://www.virtualbox.org/wiki/Linux%20build%20instructions) and only +-minor adjustments are required to build VirtualBox with KVM as a backend. ++minor adjustments are required to integrate the KVM backend. + + On a fresh install of Ubuntu 22.04, you can use the following command to install + all prerequisites via `apt`: +@@ -57,14 +56,13 @@ to the following steps: + $ ./configure --with-kvm --disable-kmods --disable-docs --disable-hardening --disable-java + $ source ./env.sh + $ kmk +-$ out/linux.amd64/release/bin/VirtualBox + ``` + + The noticeable difference to the official build process is the addition of + `--with-kvm` when calling `./configure`. + + **Note:** These instructions are intended for local building and testing +-purposes only. There are more considerations when packaging VirtualBox for a ++purposes only. There are more considerations when packaging for a + distribution. We do not advise or recommend instructions for packaging at this + time. + +@@ -74,8 +72,8 @@ time. + * AMD will most likely work too but is considered experimental at the moment. + * Processor support for the `XSAVE` instruction is required. This implies a + 2nd Gen Core processor or newer. +-* Linux is required as a host operating system for building and running +- VirtualBox KVM. ++* Linux is required as a host operating system for building and running the KVM ++ backend. + * Starting with Intel Tiger Lake (11th Gen Core processors) or newer, split lock + detection must be turned off in the host system. This can be achieved using + the Linux kernel command line parameter `split_lock_detect=off` or using the +@@ -94,7 +92,7 @@ manual configuration, e.g., using `tun`/`tap` devices. + USB device pass-through is supported. Some `udev` rules are required to + trigger the creation of fitting device nodes, though. VirtualBox provides the + `out/linux.amd64/bin/VBoxCreateUSBNode.sh` script to create the right nodes. +-Distribution-provided packages of VirtualBox will usually take care of the ++Distribution-provided packages will usually take care of the + required setup. The following is a short summary of the additional configuration + steps, which might differ based on the distribution. Be sure to know what you + are doing when following these steps. This can potentially interfere with +@@ -134,7 +132,7 @@ If you want to use the graphics virtualization features of modern Intel processo + + ## How to engage + +-If you would like to use VirtualBox with KVM or if you have a need for custom ++If you would like to use our KVM backend or if you have a need for custom + virtualization solutions, we are happy to provide guidance and engineering + services. Please reach out to us via our + [support form](https://cyberus-technology.de/contact) or via e-mail at +@@ -146,5 +144,6 @@ your problem as detailed as possible. + ## Licensing + + This source code is released under the same license terms as the original +-VirtualBox Open Source release it is derived from. See the `COPYING` file +-for details. ++VirtualBox Open Source release it is derived from. See the upstream `COPYING` file ++for details. Make sure to follow [licensing conditions](https://www.virtualbox.org/wiki/Licensing_FAQ) ++when redistributing. +-- +2.44.0 + diff --git a/patches/0024-doc-update-readme.patch b/patches/0024-doc-update-readme.patch new file mode 100644 index 00000000..8c6b9cba --- /dev/null +++ b/patches/0024-doc-update-readme.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 8 Mar 2024 10:57:05 +0100 +Subject: [PATCH] doc: update readme + +--- + README.md | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/README.md b/README.md +index 9f832c7fb..dbfa7a707 100644 +--- a/README.md ++++ b/README.md +@@ -53,6 +53,13 @@ After having all the prerequisites installed, the build process can be condensed + to the following steps: + + ```shell ++$ # Download the VirtualBox 7.0.14 source package from Oracle. ++$ tar xf VirtualBox-7.0.14.tar.bz2 ++$ git clone https://github.com/cyberus-technology/virtualbox-kvm vbox-patches ++$ cd VirtualBox-7.0.14 ++$ git add * ++$ git commit -m "VirtualBox vanilla code" ++$ git am ../vbox-patches/*.patch + $ ./configure --with-kvm --disable-kmods --disable-docs --disable-hardening --disable-java + $ source ./env.sh + $ kmk +-- +2.44.0 + diff --git a/patches/0025-doc-move-readme-into-top-level.patch b/patches/0025-doc-move-readme-into-top-level.patch new file mode 100644 index 00000000..9986f72f --- /dev/null +++ b/patches/0025-doc-move-readme-into-top-level.patch @@ -0,0 +1,175 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 8 Mar 2024 10:57:59 +0100 +Subject: [PATCH] doc: move readme into top-level + +--- + README.md | 156 ------------------------------------------------------ + 1 file changed, 156 deletions(-) + delete mode 100644 vboxsrc/README.md + +diff --git a/README.md b/README.md +deleted file mode 100644 +index dbfa7a707..000000000 +--- a/README.md ++++ /dev/null +@@ -1,156 +0,0 @@ +-# KVM Backend for VirtualBox +- +-This repository contains a KVM backend for the open source virtualization +-tool VirtualBox. With this backend, Linux KVM is used as the underlying hypervisor. +- +-*Note:* VirtualBox is a trademark owned by Oracle. This project has no affiliation with Oracle. +- +-## What to expect +- +-The basic look and feel will be largely unchanged. The user is able to +-boot the same guest VMs as in their existing configuration. +- +-Nonetheless, there are the following benefits of using the KVM backend: +- +-* VirtualBox VMs can run in parallel to QEMU/KVM +-* VirtualBox kernel driver (`vboxdrv`) is not required +-* Modern virtualization features supported by KVM are automatically used (e.g. +- APICv) +-* KVM is part of the Linux kernel and therefore always directly available with +- every kernel update +- +-Due to the replacement of the underlying hypervisor, there will be differences +-in the guest performance. Performance differences heavily depend on the guest +-workload. +- +-## How to use +- +-There are no prebuilt packages of the resulting program and it needs to be built from +-source. The process of building VirtualBox from source can be found +-[on virtualbox.org](https://www.virtualbox.org/wiki/Linux%20build%20instructions) and only +-minor adjustments are required to integrate the KVM backend. +- +-On a fresh install of Ubuntu 22.04, you can use the following command to install +-all prerequisites via `apt`: +- +-```shell +-apt install acpica-tools chrpath doxygen g++-multilib libasound2-dev libcap-dev \ +- libcurl4-openssl-dev libdevmapper-dev libidl-dev libopus-dev libpam0g-dev \ +- libpulse-dev libqt5opengl5-dev libqt5x11extras5-dev qttools5-dev libsdl1.2-dev libsdl-ttf2.0-dev \ +- libssl-dev libvpx-dev libxcursor-dev libxinerama-dev libxml2-dev libxml2-utils \ +- libxmu-dev libxrandr-dev make nasm python3-dev python2-dev qttools5-dev-tools \ +- texlive texlive-fonts-extra texlive-latex-extra unzip xsltproc \ +- \ +- default-jdk libstdc++5 libxslt1-dev linux-kernel-headers makeself \ +- mesa-common-dev subversion yasm zlib1g-dev glslang-tools \ +- libc6-dev-i386 lib32stdc++6 libtpms-dev +-``` +- +-Newer GCC versions (>= 12) might cause build issues. The command above installs a +-compatible version on Ubuntu 22.04. +- +-After having all the prerequisites installed, the build process can be condensed +-to the following steps: +- +-```shell +-$ # Download the VirtualBox 7.0.14 source package from Oracle. +-$ tar xf VirtualBox-7.0.14.tar.bz2 +-$ git clone https://github.com/cyberus-technology/virtualbox-kvm vbox-patches +-$ cd VirtualBox-7.0.14 +-$ git add * +-$ git commit -m "VirtualBox vanilla code" +-$ git am ../vbox-patches/*.patch +-$ ./configure --with-kvm --disable-kmods --disable-docs --disable-hardening --disable-java +-$ source ./env.sh +-$ kmk +-``` +- +-The noticeable difference to the official build process is the addition of +-`--with-kvm` when calling `./configure`. +- +-**Note:** These instructions are intended for local building and testing +-purposes only. There are more considerations when packaging for a +-distribution. We do not advise or recommend instructions for packaging at this +-time. +- +-## Known issues and limitations +- +-* Currently, Intel x86_64 is the only supported host platform. +- * AMD will most likely work too but is considered experimental at the moment. +- * Processor support for the `XSAVE` instruction is required. This implies a +- 2nd Gen Core processor or newer. +-* Linux is required as a host operating system for building and running the KVM +- backend. +-* Starting with Intel Tiger Lake (11th Gen Core processors) or newer, split lock +- detection must be turned off in the host system. This can be achieved using +- the Linux kernel command line parameter `split_lock_detect=off` or using the +- `split_lock_mitigate` sysctl. +- +-## Networking +- +-The new KVM backend utilizes the `--driverless` mode of VirtualBox. Some setups +-that require kernel module support will not work in this mode and prevent the +-VM from starting. Specifically, the Bridged adapter and "NAT Network" modes do +-not work. Only regular NAT is easily supported. More complex setups will need +-manual configuration, e.g., using `tun`/`tap` devices. +- +-## USB pass-through +- +-USB device pass-through is supported. Some `udev` rules are required to +-trigger the creation of fitting device nodes, though. VirtualBox provides the +-`out/linux.amd64/bin/VBoxCreateUSBNode.sh` script to create the right nodes. +-Distribution-provided packages will usually take care of the +-required setup. The following is a short summary of the additional configuration +-steps, which might differ based on the distribution. Be sure to know what you +-are doing when following these steps. This can potentially interfere with +-existing installations. +- +-* Create a group `vboxusers` and add your user to the group. Remember group +- changes need a re-login or `newgrp` to take effect. +-```shell +-sudo groupadd -r vboxusers -U +-``` +- +-* Place the `VBoxCreateUSBNode.sh` script in a system accessible folder +-```shell +-sudo mkdir /usr/lib/virtualbox +-sudo cp out/release/linux.amd64/bin/VBoxCreateUSBNode.sh /usr/lib/virtualbox +-sudo chown -R root:vboxusers /usr/lib/virtualbox +-``` +- +-* Create a `udev` rule file (e.g. `60-vboxusb.rules`) in `/etc/udev/rules.d/` +- with the following entries: +-```shell +-SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +-SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +-SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" +-SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" +-``` +- +-* Reload the udev rules +-```shell +-sudo systemctl reload systemd-udevd +-``` +- +-## SR-IOV Graphics Virtualization +- +-If you want to use the graphics virtualization features of modern Intel processors, please refer to our +-[SR-IOV Graphics Virtualization HowTo](README.intel-sriov-graphics.md). +- +-## How to engage +- +-If you would like to use our KVM backend or if you have a need for custom +-virtualization solutions, we are happy to provide guidance and engineering +-services. Please reach out to us via our +-[support form](https://cyberus-technology.de/contact) or via e-mail at +-. +- +-If you encounter any issues please use the provided issue template and describe +-your problem as detailed as possible. +- +-## Licensing +- +-This source code is released under the same license terms as the original +-VirtualBox Open Source release it is derived from. See the upstream `COPYING` file +-for details. Make sure to follow [licensing conditions](https://www.virtualbox.org/wiki/Licensing_FAQ) +-when redistributing. +-- +2.44.0 + diff --git a/patches/0026-doc-move-github-issue-template-into-top-level-direct.patch b/patches/0026-doc-move-github-issue-template-into-top-level-direct.patch new file mode 100644 index 00000000..88f99661 --- /dev/null +++ b/patches/0026-doc-move-github-issue-template-into-top-level-direct.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 8 Mar 2024 10:59:54 +0100 +Subject: [PATCH] doc: move github issue template into top level directory + +--- + .github/ISSUE_TEMPLATE/issue_template.md | 37 ------------------------ + 1 file changed, 37 deletions(-) + delete mode 100644 vboxsrc/.github/ISSUE_TEMPLATE/issue_template.md + +diff --git a/.github/ISSUE_TEMPLATE/issue_template.md b/.github/ISSUE_TEMPLATE/issue_template.md +deleted file mode 100644 +index 264a4f24c..000000000 +--- a/.github/ISSUE_TEMPLATE/issue_template.md ++++ /dev/null +@@ -1,37 +0,0 @@ +---- +-name: Bug report +-about: Create a bug report +-title: '' +-labels: '' +-assignees: '' +- +---- +- +-### Bug Description +- +-A clear and concise description of what the bug is. +- +-### How to Reproduce +- +-Steps to reproduce the behavior. +- +-### VM configuration +- +-Guest OS configuration details: +- +-* Guest OS type and version (e.g. Windows 10 22H2) +-* Attach guest VM configuration file from `VirtualBox VMs//.vbox` +- +-Host OS details: +- +-* Host OS distribution +-* Host OS kernel version +- +-### Logs +- +-Following logs are required: +- +-* Linux kernel output +-* VirtualBox Release Log +- * In the VirtualBox GUI click the three dots next to the +- guest VM name -> Logs -> Save +-- +2.44.0 + diff --git a/patches/0027-doc-move-sr-iov-graphics-documentation-into-top-leve.patch b/patches/0027-doc-move-sr-iov-graphics-documentation-into-top-leve.patch new file mode 100644 index 00000000..eda786a2 --- /dev/null +++ b/patches/0027-doc-move-sr-iov-graphics-documentation-into-top-leve.patch @@ -0,0 +1,131 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 8 Mar 2024 11:01:23 +0100 +Subject: [PATCH] doc: move sr-iov graphics documentation into top-level + +--- + README.intel-sriov-graphics.md | 112 --------------------------------- + 1 file changed, 112 deletions(-) + delete mode 100644 vboxsrc/README.intel-sriov-graphics.md + +diff --git a/README.intel-sriov-graphics.md b/README.intel-sriov-graphics.md +deleted file mode 100644 +index 6e5332150..000000000 +--- a/README.intel-sriov-graphics.md ++++ /dev/null +@@ -1,112 +0,0 @@ +-# Introduction +- +-This document describes how to setup and use Intel SR-IOV graphics +-virtualization with the KVM backend for VirtualBox. The hardware graphics +-acceleration is not integrated in the GUI yet and requires manual setup. Yet, we +-deem it good enough for people to try this. +- +-This is a feature which is currently under active development, everything noted here should be +-considered experimental. +- +- +-# Requirements +- +-- Intel Alder Lake (12th Gen Core) or newer +-- Ubuntu 22.04 as host OS +-- VT-d must be enabled in BIOS. +-- IOMMU must be enabled in the host Linux kernel. +-- A Windows 10 or Windows 11 VM with __all__ updates installed +-- Make sure the SR-IOV capability is present: +- - `lspci | grep VGA`, remember the BDF for the device, we use 0:2.0 in this tutorial +- - `sudo lspci -s 0:2.0 -v | grep SR-IOV` +- +-# Host Setup +- +-The host needs a special Linux kernel which includes the SR-IOV graphics patches from Intel. These patches +-have not been upstreamed yet. In addition, the kernel needs to be booted with custom command line +-options in order for SR-IOV graphics to function properly. +- +-## Installation with pre-built kernel packages +- +-If you don't want to compile your own kernel, check the [the latest release](https://github.com/cyberus-technology/virtualbox-kvm/releases) for pre-built packages. +-Note that these packages are built for Ubuntu 22.04 and have not been tested with any +-other Linux distribution. These images are not signed. +- +-## Installation with self-compiled kernel +- +-- `sudo apt install flex bison elfutils dwarves dpkg-dev debhelper libelf-dev` +-- `mkdir kernel-intel-sriov` +-- `cd kernel-intel-sriov` +-- `git clone https://github.com/intel/linux-intel-lts.git --branch lts-v6.6.15-linux-240219T085932Z --single-branch` +-- `cd linux-intel-lts` +-- `make olddefconfig` +-- execute: +- - `scripts/config --disable SYSTEM_TRUSTED_KEYS` +- - `scripts/config --disable SYSTEM_REVOCATION_KEYS` +-- `make deb-pkg LOCALVERSION="-sriov" -j$(nproc)` +-- `cd ..` +-- `sudo dpkg -i *.deb` +- +-## Preparing the Linux kernel for SR-IOV graphics +- +-- Edit `/etc/defaults/grub` +-- Add `i915.enable_guc=3 i915.max_vfs=7 split_lock_detect=off` to `GRUB_CMDLINE_LINUX` +-- Set `GRUB_DEFAULT` to `Advanced options for Ubuntu>Ubuntu, with Linux 6.6.15-sriov` +-- Execute `update-grub` as root +-- Edit `/etc/security/limits.conf` (required because VFIO needs more locked memory than configured as default) +- - add: +- - `* soft memlock unlimited` +- - `* hard memlock unlimited` +-- Reboot +- +-## Verify Host Setup +- +-Make sure you have booted the correct Linux kernel; `uname -r` should provide the following output: `6.6.15-sriov`. +-Check `sudo dmesg` for the following output which indicates that SR-IOV has been set up successfully: +- +-``` +-i915 0000:00:02.0: enabling device (0006 -> 0007) +-i915 0000:00:02.0: Running in SR-IOV PF mode +-i915 0000:00:02.0: [drm] VT-d active for gfx access +-``` +- +-# Setting up the vGPUs +- +-- Execute the following commands as root: +- - `lspci | grep VGA`, remember the BDF for the device, we use 0:2.0 in this tutorial +- - `lspci -s 0:2.0 -n`, remember device/vendor id +- - `echo " " > /sys/bus/pci/drivers/vfio-pci/new_id` +- - `echo 7 > /sys/class/drm/card0/device/sriov_numvfs` +- - `lspci -v -s 0:2.1`, verify vfio-pci driver is in use +- - `chmod 0666 /dev/vfio/*` +- +-# Configuring vGPUs +- +-- Configure ICH9 Chipset: `VBoxManage modifyvm --chipset=ICH9` +-- Attach the vGPU: `VBoxManage modifyvm --attachvfio /sys/bus/pci/devices/0000\:00\:02.1` (no trailing slash) +-- Change display adapter: `VBoxManage modifyvm --graphicscontroller vga-virtiogpu` +-- Boot the VM +-- Verify that there are 2 new display adapters in device manager +-- Install latest Intel GPU driver or wait for Windows to install it automatically +-- Verify in Task Manager that GPU0 is present (Performance Tab) +-- Download and extract [the Intel Display Virtualization Drivers](https://www.intel.com/content/www/us/en/download/806254/nswe-display-virtualization-drivers-for-meteor-lake-ps-pv-meteor-lake-u-h-pv-and-raptor-lake-ps-beta.html) +-- Open Powershell as Admin +-- Change the execution policy: `Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser` +-- Execute `DVInstaller.ps1` +-- VM will reboot +-- Verify in Device Manager that both "Intel Iris Xe Graphics" and "DVServerUMD" are present in display adapters +-- Enjoy your GPU-accelerated VM ;) +- +-# Limitations +- +-- Host suspend/resume while GPU acceleration is in use is unsupported and will result in broken VM graphics +-- PIIX3 chipset is unsupported +-- Multiple virtual monitors are unsupported +-- Automatic display resizing is not supported +- +-# Troubleshooting +- +-- A vGPU can be removed from a VM via: +- - `VBoxManage modifyvm --detachvfio /sys/bus/pci/devices/0000\:00\:02.1` (no trailing slash) +- - `VBoxManage modifyvm --graphicscontroller vboxsvga` +-- After host suspend/resume, the graphics may recover when pressing `Win + Ctrl + Shift + B`. Some windows may stay black, in which case minimizing/maximizing may fix the problem. +-- +2.44.0 + diff --git a/patches/0028-NEM-KVM-cpuid-add-PASSTHRU_FEATURE_KVM_ONLY-helper.patch b/patches/0028-NEM-KVM-cpuid-add-PASSTHRU_FEATURE_KVM_ONLY-helper.patch new file mode 100644 index 00000000..afc973ce --- /dev/null +++ b/patches/0028-NEM-KVM-cpuid-add-PASSTHRU_FEATURE_KVM_ONLY-helper.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:39:33 +0000 +Subject: [PATCH] NEM/KVM: cpuid: add PASSTHRU_FEATURE_KVM_ONLY helper + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index a5f48497a..b279a89d9 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1331,6 +1331,13 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + ((enmConfig) && ((enmConfig) == CPUMISAEXTCFG_ENABLED_ALWAYS || (fHostFeature)) && (fAndExpr) ? (fConst) : 0) + #define PASSTHRU_FEATURE_TODO(enmConfig, fConst) ((enmConfig) ? (fConst) : 0) + ++#ifdef VBOX_WITH_KVM ++#define PASSTHRU_FEATURE_KVM_ONLY(fConst) (fConst) ++#else ++#define PASSTHRU_FEATURE_KVM_ONLY(fConst) (0) ++#endif ++ ++ + /* Cpuid 1: + * EAX: CPU model, family and stepping. + * +-- +2.44.0 + diff --git a/patches/0029-NEM-KVM-let-KVM-handle-MSR_IA32_ARCH_CAPABILITIES-an.patch b/patches/0029-NEM-KVM-let-KVM-handle-MSR_IA32_ARCH_CAPABILITIES-an.patch new file mode 100644 index 00000000..c67ffa50 --- /dev/null +++ b/patches/0029-NEM-KVM-let-KVM-handle-MSR_IA32_ARCH_CAPABILITIES-an.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 15 Mar 2024 12:34:43 +0000 +Subject: [PATCH] NEM/KVM: let KVM handle MSR_IA32_ARCH_CAPABILITIES and + MSR_IA32_SPEC_CTRL + +--- + src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +index 82ebed65e..94fdb9de5 100644 +--- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp ++++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +@@ -1031,8 +1031,17 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) + { + for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) + { ++ PCPUMCTXMSRS const pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVM->apCpusR3[idCpu]); ++ + int rc = nemR3LnxUpdateCpuIdsLeaves(pVM, pVM->apCpusR3[idCpu]); + AssertRCReturn(rc, rc); ++ ++ uint64_t val {0}; ++ NEMR3KvmGetMsr(pVM->apCpusR3[idCpu], MSR_IA32_ARCH_CAPABILITIES, &val); ++ pCtxMsrs->msr.ArchCaps = val; ++ ++ NEMR3KvmGetMsr(pVM->apCpusR3[idCpu], MSR_IA32_SPEC_CTRL, &val); ++ pCtxMsrs->msr.SpecCtrl = val; + } + } + +@@ -1089,6 +1098,8 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) + MSR_RANGE_ADD(MSR_IA32_SYSENTER_ESP); + MSR_RANGE_ADD(MSR_IA32_SYSENTER_EIP); + MSR_RANGE_ADD(MSR_IA32_CR_PAT); ++ MSR_RANGE_ADD(MSR_IA32_ARCH_CAPABILITIES); ++ MSR_RANGE_ADD(MSR_IA32_SPEC_CTRL); + /** @todo more? */ + MSR_RANGE_END(64); + +-- +2.44.0 + diff --git a/patches/0030-NEM-KVM-save-restore-IA32_ARCH_CAPABILITIES-and-IA32.patch b/patches/0030-NEM-KVM-save-restore-IA32_ARCH_CAPABILITIES-and-IA32.patch new file mode 100644 index 00000000..de82d47f --- /dev/null +++ b/patches/0030-NEM-KVM-save-restore-IA32_ARCH_CAPABILITIES-and-IA32.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Fri, 15 Mar 2024 14:12:42 +0000 +Subject: [PATCH] NEM/KVM: save/restore IA32_ARCH_CAPABILITIES and + IA32_SPEC_CTRL + +--- + src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +index 94fdb9de5..043dc5322 100644 +--- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp ++++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +@@ -2186,6 +2186,8 @@ static int nemHCLnxImportState(PVMCPUCC pVCpu, uint64_t fWhat, PCPUMCTX pCtx, st + if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS) + { + ADD_MSR(MSR_IA32_CR_PAT, pCtx->msrPAT); ++ ADD_MSR(MSR_IA32_ARCH_CAPABILITIES, pCtxMsrs->msr.ArchCaps); ++ ADD_MSR(MSR_IA32_SPEC_CTRL, pCtxMsrs->msr.SpecCtrl); + /** @todo What do we _have_ to add here? + * We also have: Mttr*, MiscEnable, FeatureControl. */ + } +@@ -2569,6 +2571,8 @@ static int nemHCLnxExportState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, struct kvm_ + if (fExtrn & CPUMCTX_EXTRN_OTHER_MSRS) + { + ADD_MSR(MSR_IA32_CR_PAT, pCtx->msrPAT); ++ ADD_MSR(MSR_IA32_ARCH_CAPABILITIES, pCtxMsrs->msr.ArchCaps); ++ ADD_MSR(MSR_IA32_SPEC_CTRL, pCtxMsrs->msr.SpecCtrl); + /** @todo What do we _have_ to add here? + * We also have: Mttr*, MiscEnable, FeatureControl. */ + } +-- +2.44.0 + diff --git a/patches/0031-NEM-KVM-cpuid-allow-guests-to-use-gigabyte-pages.patch b/patches/0031-NEM-KVM-cpuid-allow-guests-to-use-gigabyte-pages.patch new file mode 100644 index 00000000..aef7a7b6 --- /dev/null +++ b/patches/0031-NEM-KVM-cpuid-allow-guests-to-use-gigabyte-pages.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:18:03 +0000 +Subject: [PATCH] NEM/KVM: cpuid: allow guests to use gigabyte pages + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index b279a89d9..247f0fa32 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1597,7 +1597,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + | X86_CPUID_AMD_FEATURE_EDX_MMX + | X86_CPUID_AMD_FEATURE_EDX_FXSR + | X86_CPUID_AMD_FEATURE_EDX_FFXSR +- //| X86_CPUID_EXT_FEATURE_EDX_PAGE1GB ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_EXT_FEATURE_EDX_PAGE1GB) + | X86_CPUID_EXT_FEATURE_EDX_RDTSCP + //| RT_BIT_32(28) - reserved + //| X86_CPUID_EXT_FEATURE_EDX_LONG_MODE - turned on when necessary +-- +2.44.0 + diff --git a/patches/0032-NEM-KVM-cpuid-allow-guests-to-use-SMEP-and-SMAP.patch b/patches/0032-NEM-KVM-cpuid-allow-guests-to-use-SMEP-and-SMAP.patch new file mode 100644 index 00000000..33befb8e --- /dev/null +++ b/patches/0032-NEM-KVM-cpuid-allow-guests-to-use-SMEP-and-SMAP.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:21:34 +0000 +Subject: [PATCH] NEM/KVM: cpuid: allow guests to use SMEP and SMAP + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 247f0fa32..3c9d323f0 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1859,7 +1859,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| X86_CPUID_STEXT_FEATURE_EBX_HLE RT_BIT(4) + | PASSTHRU_FEATURE(pConfig->enmAvx2, pHstFeat->fAvx2, X86_CPUID_STEXT_FEATURE_EBX_AVX2) + | X86_CPUID_STEXT_FEATURE_EBX_FDP_EXCPTN_ONLY +- //| X86_CPUID_STEXT_FEATURE_EBX_SMEP RT_BIT(7) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_SMEP) + | X86_CPUID_STEXT_FEATURE_EBX_BMI2 + //| X86_CPUID_STEXT_FEATURE_EBX_ERMS RT_BIT(9) + | PASSTHRU_FEATURE(pConfig->enmInvpcid, pHstFeat->fInvpcid, X86_CPUID_STEXT_FEATURE_EBX_INVPCID) +@@ -1872,7 +1872,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| RT_BIT(17) - reserved + | PASSTHRU_FEATURE_TODO(pConfig->enmRdSeed, X86_CPUID_STEXT_FEATURE_EBX_RDSEED) + //| X86_CPUID_STEXT_FEATURE_EBX_ADX RT_BIT(19) +- //| X86_CPUID_STEXT_FEATURE_EBX_SMAP RT_BIT(20) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_SMAP) + //| RT_BIT(21) - reserved + //| RT_BIT(22) - reserved + | PASSTHRU_FEATURE(pConfig->enmCLFlushOpt, pHstFeat->fClFlushOpt, X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT) +-- +2.44.0 + diff --git a/patches/0033-NEM-KVM-cpuid-allow-guests-to-use-Enhanced-REP-MOVSB.patch b/patches/0033-NEM-KVM-cpuid-allow-guests-to-use-Enhanced-REP-MOVSB.patch new file mode 100644 index 00000000..12e70650 --- /dev/null +++ b/patches/0033-NEM-KVM-cpuid-allow-guests-to-use-Enhanced-REP-MOVSB.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:24:32 +0000 +Subject: [PATCH] NEM/KVM: cpuid: allow guests to use Enhanced REP MOVSB/STOSB + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 3c9d323f0..bf0dc09af 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1861,7 +1861,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + | X86_CPUID_STEXT_FEATURE_EBX_FDP_EXCPTN_ONLY + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_SMEP) + | X86_CPUID_STEXT_FEATURE_EBX_BMI2 +- //| X86_CPUID_STEXT_FEATURE_EBX_ERMS RT_BIT(9) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_ERMS) + | PASSTHRU_FEATURE(pConfig->enmInvpcid, pHstFeat->fInvpcid, X86_CPUID_STEXT_FEATURE_EBX_INVPCID) + //| X86_CPUID_STEXT_FEATURE_EBX_RTM RT_BIT(11) + //| X86_CPUID_STEXT_FEATURE_EBX_PQM RT_BIT(12) +-- +2.44.0 + diff --git a/patches/0034-NEM-KVM-allow-guests-to-use-ADX.patch b/patches/0034-NEM-KVM-allow-guests-to-use-ADX.patch new file mode 100644 index 00000000..ad32e9be --- /dev/null +++ b/patches/0034-NEM-KVM-allow-guests-to-use-ADX.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:44:41 +0000 +Subject: [PATCH] NEM/KVM: allow guests to use ADX + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index bf0dc09af..3d8832871 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1871,7 +1871,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512F RT_BIT(16) + //| RT_BIT(17) - reserved + | PASSTHRU_FEATURE_TODO(pConfig->enmRdSeed, X86_CPUID_STEXT_FEATURE_EBX_RDSEED) +- //| X86_CPUID_STEXT_FEATURE_EBX_ADX RT_BIT(19) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_ADX) + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_SMAP) + //| RT_BIT(21) - reserved + //| RT_BIT(22) - reserved +-- +2.44.0 + diff --git a/patches/0035-NEM-KVM-allow-guests-to-use-SHA-1-and-SHA-256-extens.patch b/patches/0035-NEM-KVM-allow-guests-to-use-SHA-1-and-SHA-256-extens.patch new file mode 100644 index 00000000..4396145d --- /dev/null +++ b/patches/0035-NEM-KVM-allow-guests-to-use-SHA-1-and-SHA-256-extens.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:45:27 +0000 +Subject: [PATCH] NEM/KVM: allow guests to use SHA-1 and SHA-256 extensions + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 3d8832871..359af2b1d 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1881,7 +1881,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512PF RT_BIT(26) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512ER RT_BIT(27) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512CD RT_BIT(28) +- //| X86_CPUID_STEXT_FEATURE_EBX_SHA RT_BIT(29) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_SHA) + //| RT_BIT(30) - reserved + //| RT_BIT(31) - reserved + ; +-- +2.44.0 + diff --git a/patches/0036-NEM-KVM-allow-guests-to-use-Fast-Short-REP-MOVSB.patch b/patches/0036-NEM-KVM-allow-guests-to-use-Fast-Short-REP-MOVSB.patch new file mode 100644 index 00000000..15d01f37 --- /dev/null +++ b/patches/0036-NEM-KVM-allow-guests-to-use-Fast-Short-REP-MOVSB.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:48:39 +0000 +Subject: [PATCH] NEM/KVM: allow guests to use Fast Short REP MOVSB + +--- + include/iprt/x86.h | 2 ++ + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/include/iprt/x86.h b/include/iprt/x86.h +index 95ab7b439..0233d41b1 100644 +--- a/include/iprt/x86.h ++++ b/include/iprt/x86.h +@@ -693,6 +693,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX; + /** ECX Bit 30 - SGX_LC - Supports SGX launch configuration. */ + #define X86_CPUID_STEXT_FEATURE_ECX_SGX_LC RT_BIT_32(30) + ++/** EDX Bit 4 - FSRM - Supports Fast Short REP MOVSB */ ++#define X86_CPUID_STEXT_FEATURE_EDX_FSRM RT_BIT(4) + /** EDX Bit 10 - MD_CLEAR - Supports flushing MDS related buffers. */ + #define X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR RT_BIT_32(10) + /** EDX Bit 26 - IBRS & IBPB - Supports the IBRS flag in IA32_SPEC_CTRL and +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 359af2b1d..4bf98a427 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1889,6 +1889,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1 - we do not do vector functions yet. + ; + pCurLeaf->uEdx &= 0 ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_FSRM) + | PASSTHRU_FEATURE(pConfig->enmMdsClear, pHstFeat->fMdsClear, X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR) + //| X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB RT_BIT(26) + //| X86_CPUID_STEXT_FEATURE_EDX_STIBP RT_BIT(27) +-- +2.44.0 + diff --git a/patches/0037-NEM-KVM-allow-guests-to-use-cache-line-write-back-CL.patch b/patches/0037-NEM-KVM-allow-guests-to-use-cache-line-write-back-CL.patch new file mode 100644 index 00000000..70926a72 --- /dev/null +++ b/patches/0037-NEM-KVM-allow-guests-to-use-cache-line-write-back-CL.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 13:50:56 +0000 +Subject: [PATCH] NEM/KVM: allow guests to use cache line write back (CLWB) + +--- + include/iprt/x86.h | 2 ++ + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/iprt/x86.h b/include/iprt/x86.h +index 0233d41b1..abaf70224 100644 +--- a/include/iprt/x86.h ++++ b/include/iprt/x86.h +@@ -667,6 +667,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX; + #define X86_CPUID_STEXT_FEATURE_EBX_SMAP RT_BIT_32(20) + /** EBX Bit 23 - CLFLUSHOPT - Supports CLFLUSHOPT (Cache Line Flush). */ + #define X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT RT_BIT_32(23) ++/** EBX Bit 24 - CLWB - Supports CLWB (Cache Line write-back). */ ++#define X86_CPUID_STEXT_FEATURE_EBX_CLWB RT_BIT_32(24) + /** EBX Bit 25 - INTEL_PT - Supports Intel Processor Trace. */ + #define X86_CPUID_STEXT_FEATURE_EBX_INTEL_PT RT_BIT_32(25) + /** EBX Bit 26 - AVX512PF - Supports AVX512PF. */ +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 4bf98a427..b4e84c63d 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1876,7 +1876,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + //| RT_BIT(21) - reserved + //| RT_BIT(22) - reserved + | PASSTHRU_FEATURE(pConfig->enmCLFlushOpt, pHstFeat->fClFlushOpt, X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT) +- //| RT_BIT(24) - reserved ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EBX_CLWB) + //| X86_CPUID_STEXT_FEATURE_EBX_INTEL_PT RT_BIT(25) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512PF RT_BIT(26) + //| X86_CPUID_STEXT_FEATURE_EBX_AVX512ER RT_BIT(27) +-- +2.44.0 + diff --git a/patches/0038-NEM-KVM-expose-IBRS-IBPB-STIBP-and-SSBD-to-the-guest.patch b/patches/0038-NEM-KVM-expose-IBRS-IBPB-STIBP-and-SSBD-to-the-guest.patch new file mode 100644 index 00000000..16f4f1e6 --- /dev/null +++ b/patches/0038-NEM-KVM-expose-IBRS-IBPB-STIBP-and-SSBD-to-the-guest.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 12:30:15 +0000 +Subject: [PATCH] NEM/KVM: expose IBRS, IBPB, STIBP and SSBD to the guest + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 5 +++-- + src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp | 1 + + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index b4e84c63d..42d8a00f5 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1891,10 +1891,11 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + pCurLeaf->uEdx &= 0 + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_FSRM) + | PASSTHRU_FEATURE(pConfig->enmMdsClear, pHstFeat->fMdsClear, X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR) +- //| X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB RT_BIT(26) +- //| X86_CPUID_STEXT_FEATURE_EDX_STIBP RT_BIT(27) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_STIBP) + | PASSTHRU_FEATURE(pConfig->enmFlushCmdMsr, pHstFeat->fFlushCmd, X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD) + | PASSTHRU_FEATURE(pConfig->enmArchCapMsr, pHstFeat->fArchCap, X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_SSBD) + ; + + /* Mask out INVPCID unless FSGSBASE is exposed due to a bug in Windows 10 SMP guests, see @bugref{9089#c15}. */ +diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +index 043dc5322..1807c8174 100644 +--- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp ++++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +@@ -1100,6 +1100,7 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) + MSR_RANGE_ADD(MSR_IA32_CR_PAT); + MSR_RANGE_ADD(MSR_IA32_ARCH_CAPABILITIES); + MSR_RANGE_ADD(MSR_IA32_SPEC_CTRL); ++ MSR_RANGE_ADD(MSR_IA32_PRED_CMD); + /** @todo more? */ + MSR_RANGE_END(64); + +-- +2.44.0 + diff --git a/patches/0039-NEM-KVM-expose-SERIALIZE-instruction-to-the-guest.patch b/patches/0039-NEM-KVM-expose-SERIALIZE-instruction-to-the-guest.patch new file mode 100644 index 00000000..10b60d4f --- /dev/null +++ b/patches/0039-NEM-KVM-expose-SERIALIZE-instruction-to-the-guest.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 12:49:25 +0000 +Subject: [PATCH] NEM/KVM: expose SERIALIZE instruction to the guest + +--- + include/iprt/x86.h | 2 ++ + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/include/iprt/x86.h b/include/iprt/x86.h +index abaf70224..b9dffccf1 100644 +--- a/include/iprt/x86.h ++++ b/include/iprt/x86.h +@@ -699,6 +699,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX; + #define X86_CPUID_STEXT_FEATURE_EDX_FSRM RT_BIT(4) + /** EDX Bit 10 - MD_CLEAR - Supports flushing MDS related buffers. */ + #define X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR RT_BIT_32(10) ++/** EDX Bit 14 - SERIALIZE - Supports the SERIALIZE CPU instruction. */ ++#define X86_CPUID_STEXT_FEATURE_EDX_SERIALIZE RT_BIT_32(14) + /** EDX Bit 26 - IBRS & IBPB - Supports the IBRS flag in IA32_SPEC_CTRL and + * IBPB command in IA32_PRED_CMD. */ + #define X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB RT_BIT_32(26) +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index 42d8a00f5..ab44cf161 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1890,6 +1890,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + ; + pCurLeaf->uEdx &= 0 + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_FSRM) ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_SERIALIZE) + | PASSTHRU_FEATURE(pConfig->enmMdsClear, pHstFeat->fMdsClear, X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR) + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB) + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_STIBP) +-- +2.44.0 + diff --git a/patches/0040-NEM-KVM-expose-GFNI-to-the-guest.patch b/patches/0040-NEM-KVM-expose-GFNI-to-the-guest.patch new file mode 100644 index 00000000..94eb6592 --- /dev/null +++ b/patches/0040-NEM-KVM-expose-GFNI-to-the-guest.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 19:45:47 +0000 +Subject: [PATCH] NEM/KVM: expose GFNI to the guest + +--- + include/iprt/x86.h | 2 ++ + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/include/iprt/x86.h b/include/iprt/x86.h +index b9dffccf1..96c7d1b01 100644 +--- a/include/iprt/x86.h ++++ b/include/iprt/x86.h +@@ -688,6 +688,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX; + #define X86_CPUID_STEXT_FEATURE_ECX_PKU RT_BIT_32(3) + /** ECX Bit 4 - OSPKE - Protection keys for user mode pages enabled. */ + #define X86_CPUID_STEXT_FEATURE_ECX_OSPKE RT_BIT_32(4) ++/** ECX Bit 8 - GFNI - Supports Galois Field instructions . */ ++#define X86_CPUID_STEXT_FEATURE_ECX_GFNI RT_BIT_32(8) + /** ECX Bits 17-21 - MAWAU - Value used by BNDLDX and BNDSTX. */ + #define X86_CPUID_STEXT_FEATURE_ECX_MAWAU UINT32_C(0x003e0000) + /** ECX Bit 22 - RDPID - Support pread process ID. */ +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index ab44cf161..bc756ceb7 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1887,6 +1887,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + ; + pCurLeaf->uEcx &= 0 + //| X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1 - we do not do vector functions yet. ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_ECX_GFNI) + ; + pCurLeaf->uEdx &= 0 + | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_FSRM) +-- +2.44.0 + diff --git a/patches/0041-NEM-KVM-expose-F16C-to-the-guest.patch b/patches/0041-NEM-KVM-expose-F16C-to-the-guest.patch new file mode 100644 index 00000000..d922f072 --- /dev/null +++ b/patches/0041-NEM-KVM-expose-F16C-to-the-guest.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 19:50:08 +0000 +Subject: [PATCH] NEM/KVM: expose F16C to the guest + +--- + src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +index bc756ceb7..d3df15578 100644 +--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp ++++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp +@@ -1414,7 +1414,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig) + | PASSTHRU_FEATURE(pConfig->enmXSave, pHstFeat->fXSaveRstor, X86_CPUID_FEATURE_ECX_XSAVE) + //| X86_CPUID_FEATURE_ECX_OSXSAVE - mirrors CR4.OSXSAVE state, set dynamically. + | PASSTHRU_FEATURE(pConfig->enmAvx, pHstFeat->fAvx, X86_CPUID_FEATURE_ECX_AVX) +- //| X86_CPUID_FEATURE_ECX_F16C - not implemented yet. ++ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_FEATURE_ECX_F16C) + | PASSTHRU_FEATURE_TODO(pConfig->enmRdRand, X86_CPUID_FEATURE_ECX_RDRAND) + //| X86_CPUID_FEATURE_ECX_HVP - Set explicitly later. + ; +-- +2.44.0 + diff --git a/patches/0042-NEM-KVM-let-KVM-handle-IA32_FLUSH_CMD.patch b/patches/0042-NEM-KVM-let-KVM-handle-IA32_FLUSH_CMD.patch new file mode 100644 index 00000000..27c5fe51 --- /dev/null +++ b/patches/0042-NEM-KVM-let-KVM-handle-IA32_FLUSH_CMD.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Prescher +Date: Mon, 18 Mar 2024 20:23:15 +0000 +Subject: [PATCH] NEM/KVM: let KVM handle IA32_FLUSH_CMD + +--- + src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +index 1807c8174..96d7bc20a 100644 +--- a/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp ++++ b/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp +@@ -1101,6 +1101,7 @@ int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) + MSR_RANGE_ADD(MSR_IA32_ARCH_CAPABILITIES); + MSR_RANGE_ADD(MSR_IA32_SPEC_CTRL); + MSR_RANGE_ADD(MSR_IA32_PRED_CMD); ++ MSR_RANGE_ADD(MSR_IA32_FLUSH_CMD); + /** @todo more? */ + MSR_RANGE_END(64); + +-- +2.44.0 + diff --git a/patches/0043-vbox-workaround-resume-failing-with-VERR_CPUM_INVALI.patch b/patches/0043-vbox-workaround-resume-failing-with-VERR_CPUM_INVALI.patch new file mode 100644 index 00000000..6b6fd33f --- /dev/null +++ b/patches/0043-vbox-workaround-resume-failing-with-VERR_CPUM_INVALI.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Julian Stecklina +Date: Thu, 22 Feb 2024 16:27:56 +0100 +Subject: [PATCH] vbox: workaround resume failing with + VERR_CPUM_INVALID_XSAVE_HDR + +--- + src/VBox/VMM/VMMR3/CPUM.cpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/VBox/VMM/VMMR3/CPUM.cpp b/src/VBox/VMM/VMMR3/CPUM.cpp +index 7e0fbd32f..408102f8d 100644 +--- a/src/VBox/VMM/VMMR3/CPUM.cpp ++++ b/src/VBox/VMM/VMMR3/CPUM.cpp +@@ -2845,10 +2845,21 @@ static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVers + rc = SSMR3GetStructEx(pSSM, &pGstCtx->XState.Hdr, sizeof(pGstCtx->XState.Hdr), + 0, g_aCpumXSaveHdrFields, NULL); + AssertRCReturn(rc, rc); ++#ifndef VBOX_WITH_KVM ++ /* ++ * This assertion triggers on resume when the guest was ++ * suspended early during boot. The hypothesis is that this ++ * happens when XSAVE is not enabled yet. Seems harmless for ++ * now. ++ * ++ * See: virtualbox#69 ++ */ ++ + AssertLogRelMsgReturn(!(pGstCtx->XState.Hdr.bmXState & ~pGstCtx->fXStateMask), + ("bmXState=%#RX64 fXStateMask=%#RX64\n", + pGstCtx->XState.Hdr.bmXState, pGstCtx->fXStateMask), + VERR_CPUM_INVALID_XSAVE_HDR); ++#endif + } + if (pGstCtx->fXStateMask & XSAVE_C_YMM) + { +-- +2.44.0 +