Skip to content

Commit 2b53d63

Browse files
committed
patches: update for version 20250207
1 parent 565877c commit 2b53d63

File tree

4 files changed

+45
-2566
lines changed

4 files changed

+45
-2566
lines changed

README.intel-sriov-graphics.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ deem it good enough for people to try this.
88
This is a feature which is currently under active development, everything noted here should be
99
considered experimental.
1010

11+
**Note**: [dev-20240828](https://github.com/cyberus-technology/virtualbox-kvm/releases/tag/dev-20240828) was the last
12+
release of our KVM backend supporting SR-IOV graphics. Make sure to use that for SR-IOV graphics experiments.
1113

1214
# Requirements
1315

14-
- Intel Alder Lake (12th Gen Core) or newer
16+
- Intel CPU with SR-IOV graphics support
17+
- [Intel Knowledge Base Article]( https://www.intel.com/content/www/us/en/support/articles/000093216/graphics/processor-graphics.html#primary-content)
1518
- Ubuntu 22.04 as host OS
1619
- VT-d must be enabled in BIOS.
1720
- IOMMU must be enabled in the host Linux kernel.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ After having all the prerequisites installed, the build process can be condensed
5353
to the following steps:
5454

5555
```shell
56-
$ # Download the VirtualBox 7.1.4 source package from Oracle.
57-
$ tar xf VirtualBox-7.1.4.tar.bz2
56+
$ # Download the VirtualBox 7.1.6 source package from Oracle.
57+
$ tar xf VirtualBox-7.1.6a.tar.bz2
5858
$ git clone https://github.com/cyberus-technology/virtualbox-kvm vbox-kvm
59-
$ cd VirtualBox-7.1.4
59+
$ cd VirtualBox-7.1.6
6060
$ git init
6161
$ git add *
6262
$ git commit -m "VirtualBox vanilla code"

patches/0001-NEM-Implement-KVM-backend.patch

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ NEM/KVM: fix hardened builds with KVM
322322
src/VBox/VMM/VMMAll/TMAllVirtual.cpp | 4 +
323323
src/VBox/VMM/VMMR3/APIC.cpp | 21 +
324324
src/VBox/VMM/VMMR3/CPUM.cpp | 15 +
325-
src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 28 +-
325+
src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp | 29 +-
326326
src/VBox/VMM/VMMR3/EM.cpp | 11 +
327327
src/VBox/VMM/VMMR3/GIMHv.cpp | 77 +-
328328
src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp | 640 ++++++++
@@ -333,12 +333,12 @@ NEM/KVM: fix hardened builds with KVM
333333
src/VBox/VMM/VMMR3/VMM.cpp | 5 +
334334
src/VBox/VMM/include/GIMHvInternal.h | 11 +
335335
src/VBox/VMM/include/NEMInternal.h | 34 +-
336-
36 files changed, 3089 insertions(+), 175 deletions(-)
336+
36 files changed, 3089 insertions(+), 176 deletions(-)
337337
create mode 100644 vboxsrc/src/VBox/VMM/VMMAll/GIMAllHvOnKvm.cpp
338338
create mode 100644 vboxsrc/src/VBox/VMM/VMMR3/GIMHvOnKvm.cpp
339339

340340
diff --git a/Config.kmk b/Config.kmk
341-
index bdcbd3987c..6ac1d9baee 100644
341+
index 22bf3414b1..2203ef9923 100644
342342
--- a/Config.kmk
343343
+++ b/Config.kmk
344344
@@ -1677,6 +1677,19 @@ ifdef VBOX_HEADLESS
@@ -376,7 +376,7 @@ index bdcbd3987c..6ac1d9baee 100644
376376

377377
# Don't flood CDEFS, old MASMs doesn't like too many defines.
378378
ifdef VBOX_WITH_DEBUGGER
379-
@@ -3683,6 +3704,8 @@ ifndef VBOX_GCC_std
379+
@@ -3682,6 +3703,8 @@ ifndef VBOX_GCC_std
380380
VBOX_GCC_std := -std=c++17
381381
# else if "$(VBOX_CLANG_VERSION_CXX)" vge 60000 # Most language features complete by v6. Lib stuff was less complete in v6, but hopefully acceptable for out purposes.
382382
#VBOX_GCC_std := -std=c++17
@@ -769,7 +769,7 @@ index 9a3d42fdf3..3540374de3 100644
769769
# ifdef IN_RING0
770770

771771
diff --git a/include/iprt/x86.h b/include/iprt/x86.h
772-
index 31d73ace18..54a411b925 100644
772+
index 9515abb958..d5a2923047 100644
773773
--- a/include/iprt/x86.h
774774
+++ b/include/iprt/x86.h
775775
@@ -682,6 +682,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
@@ -790,14 +790,19 @@ index 31d73ace18..54a411b925 100644
790790
/** ECX Bits 17-21 - MAWAU - Value used by BNDLDX and BNDSTX. */
791791
#define X86_CPUID_STEXT_FEATURE_ECX_MAWAU UINT32_C(0x003e0000)
792792
/** ECX Bit 22 - RDPID - Support pread process ID. */
793-
@@ -710,8 +714,12 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
793+
@@ -710,6 +714,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
794794
/** ECX Bit 30 - SGX_LC - Supports SGX launch configuration. */
795795
#define X86_CPUID_STEXT_FEATURE_ECX_SGX_LC RT_BIT_32(30)
796796

797797
+/** EDX Bit 4 - FSRM - Supports Fast Short REP MOVSB */
798798
+#define X86_CPUID_STEXT_FEATURE_EDX_FSRM RT_BIT(4)
799-
/** EDX Bit 10 - MD_CLEAR - Supports flushing MDS related buffers. */
799+
/** EDX bit 9 - SRBDS_CTRL - (Special Register Buffer Data Sample Control)
800+
* Supports IA32_MCU_OPT_CTRL and IA32_MCU_OPT_CTRL.RNGDS_MITG_DIS. */
801+
#define X86_CPUID_STEXT_FEATURE_EDX_SRBDS_CTRL RT_BIT_32(9)
802+
@@ -717,6 +723,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
800803
#define X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR RT_BIT_32(10)
804+
/** EDX Bit 11 - TSX_FORCE_ABORT - Supports for IA32_TSX_FORCE_ABORT MSR. */
805+
#define X86_CPUID_STEXT_FEATURE_EDX_TSX_FORCE_ABORT RT_BIT_32(11)
801806
+/** EDX Bit 14 - SERIALIZE - Supports the SERIALIZE CPU instruction. */
802807
+#define X86_CPUID_STEXT_FEATURE_EDX_SERIALIZE RT_BIT_32(14)
803808
/** EDX Bit 20 - CET_IBT - Supports CET indirect branch tracking features. */
@@ -1325,10 +1330,10 @@ index 495322dc04..7358b5a965 100644
13251330
return VINF_SUCCESS;
13261331
}
13271332
diff --git a/src/VBox/HostDrivers/Support/Makefile.kmk b/src/VBox/HostDrivers/Support/Makefile.kmk
1328-
index b3902ab751..1f5b64414b 100644
1333+
index 39586e172c..322c0e9997 100644
13291334
--- a/src/VBox/HostDrivers/Support/Makefile.kmk
13301335
+++ b/src/VBox/HostDrivers/Support/Makefile.kmk
1331-
@@ -195,6 +195,7 @@ SUPR3_DEFS = \
1336+
@@ -197,6 +197,7 @@ SUPR3_DEFS = \
13321337
$(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
13331338
$(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
13341339
$(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
@@ -1434,10 +1439,10 @@ index 66e4101a85..bc71af791c 100644
14341439
$(QUIET)$(SED) -n -e 's/^ *LOG_GROUP_\([A-Z0-9_]*\),.*$(DOLLAR)/{ LOG_GROUP_\1, "\1" },/p' --output "$@" "$<"
14351440
endif # !VBOX_ONLY_VALIDATIONKIT
14361441
diff --git a/src/VBox/VMM/Makefile.kmk b/src/VBox/VMM/Makefile.kmk
1437-
index 60279b52d3..4f6cfdb33b 100644
1442+
index 569175ccdf..98991ed01f 100644
14381443
--- a/src/VBox/VMM/Makefile.kmk
14391444
+++ b/src/VBox/VMM/Makefile.kmk
1440-
@@ -137,7 +137,8 @@ VBoxVMM_SOURCES = \
1445+
@@ -140,7 +140,8 @@ VBoxVMM_SOURCES = \
14411446
VMMR3/EMR3Nem.cpp \
14421447
VMMR3/GCM.cpp \
14431448
VMMR3/GIM.cpp \
@@ -1447,7 +1452,7 @@ index 60279b52d3..4f6cfdb33b 100644
14471452
VMMR3/GIMKvm.cpp \
14481453
VMMR3/GIMMinimal.cpp \
14491454
VMMR3/IEMR3.cpp \
1450-
@@ -219,7 +220,8 @@ VBoxVMM_SOURCES = \
1455+
@@ -222,7 +223,8 @@ VBoxVMM_SOURCES = \
14511456
VMMAll/EMAll.cpp \
14521457
VMMAll/GCMAll.cpp \
14531458
VMMAll/GIMAll.cpp \
@@ -1735,7 +1740,7 @@ index 14964921f2..bcdbe9d83b 100644
17351740
APIC_REG_COUNTER(&pApicCpu->StatPostIntrCnt, "%u", "APIC/VCPU stats / number of apicPostInterrupt calls.");
17361741
for (size_t i = 0; i < RT_ELEMENTS(pApicCpu->aStatVectors); i++)
17371742
diff --git a/src/VBox/VMM/VMMR3/CPUM.cpp b/src/VBox/VMM/VMMR3/CPUM.cpp
1738-
index a3aecdefd7..12c1c3b792 100644
1743+
index a05721b1ea..6238eb0718 100644
17391744
--- a/src/VBox/VMM/VMMR3/CPUM.cpp
17401745
+++ b/src/VBox/VMM/VMMR3/CPUM.cpp
17411746
@@ -1842,9 +1842,13 @@ void cpumR3InitVmxGuestFeaturesAndMsrs(PVM pVM, PCFGMNODE pCpumCfg, PCVMXMSRS pH
@@ -1775,10 +1780,10 @@ index a3aecdefd7..12c1c3b792 100644
17751780
if (pGstCtx->fXStateMask & XSAVE_C_YMM)
17761781
{
17771782
diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
1778-
index 455f55c70c..884247ee96 100644
1783+
index 3e49b9c822..e2a5136f1a 100644
17791784
--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
17801785
+++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
1781-
@@ -1341,6 +1341,13 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
1786+
@@ -1344,6 +1344,13 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
17821787
((enmConfig) && ((enmConfig) == CPUMISAEXTCFG_ENABLED_ALWAYS || (fHostFeature)) && (fAndExpr) ? (fConst) : 0)
17831788
#define PASSTHRU_FEATURE_TODO(enmConfig, fConst) ((enmConfig) ? (fConst) : 0)
17841789

@@ -1792,7 +1797,7 @@ index 455f55c70c..884247ee96 100644
17921797
/* Cpuid 1:
17931798
* EAX: CPU model, family and stepping.
17941799
*
1795-
@@ -1600,7 +1607,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
1800+
@@ -1603,7 +1610,7 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
17961801
| X86_CPUID_AMD_FEATURE_EDX_MMX
17971802
| X86_CPUID_AMD_FEATURE_EDX_FXSR
17981803
| X86_CPUID_AMD_FEATURE_EDX_FFXSR
@@ -1801,7 +1806,7 @@ index 455f55c70c..884247ee96 100644
18011806
| X86_CPUID_EXT_FEATURE_EDX_RDTSCP
18021807
//| RT_BIT_32(28) - reserved
18031808
//| X86_CPUID_EXT_FEATURE_EDX_LONG_MODE - turned on when necessary
1804-
@@ -1862,9 +1869,9 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
1809+
@@ -1865,9 +1872,9 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
18051810
//| X86_CPUID_STEXT_FEATURE_EBX_HLE RT_BIT(4)
18061811
| PASSTHRU_FEATURE(pConfig->enmAvx2, pHstFeat->fAvx2, X86_CPUID_STEXT_FEATURE_EBX_AVX2)
18071812
| X86_CPUID_STEXT_FEATURE_EBX_FDP_EXCPTN_ONLY
@@ -1813,7 +1818,7 @@ index 455f55c70c..884247ee96 100644
18131818
| PASSTHRU_FEATURE(pConfig->enmInvpcid, pHstFeat->fInvpcid, X86_CPUID_STEXT_FEATURE_EBX_INVPCID)
18141819
//| X86_CPUID_STEXT_FEATURE_EBX_RTM RT_BIT(11)
18151820
//| X86_CPUID_STEXT_FEATURE_EBX_PQM RT_BIT(12)
1816-
@@ -1876,10 +1883,11 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
1821+
@@ -1879,10 +1886,11 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
18171822
| PASSTHRU_FEATURE_TODO(pConfig->enmRdSeed, X86_CPUID_STEXT_FEATURE_EBX_RDSEED)
18181823
| PASSTHRU_FEATURE(pConfig->enmAdx, pHstFeat->fAdx, X86_CPUID_STEXT_FEATURE_EBX_ADX)
18191824
//| X86_CPUID_STEXT_FEATURE_EBX_SMAP RT_BIT(20)
@@ -1826,7 +1831,7 @@ index 455f55c70c..884247ee96 100644
18261831
//| X86_CPUID_STEXT_FEATURE_EBX_INTEL_PT RT_BIT(25)
18271832
//| X86_CPUID_STEXT_FEATURE_EBX_AVX512PF RT_BIT(26)
18281833
//| X86_CPUID_STEXT_FEATURE_EBX_AVX512ER RT_BIT(27)
1829-
@@ -1890,13 +1898,17 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
1834+
@@ -1893,18 +1901,21 @@ static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
18301835
;
18311836
pCurLeaf->uEcx &= 0
18321837
//| X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1 - we do not do vector functions yet.
@@ -1835,42 +1840,47 @@ index 455f55c70c..884247ee96 100644
18351840
pCurLeaf->uEdx &= 0
18361841
+ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_FSRM)
18371842
+ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_SERIALIZE)
1843+
//| X86_CPUID_STEXT_FEATURE_EDX_SRBDS_CTRL RT_BIT(9)
18381844
| PASSTHRU_FEATURE(pConfig->enmMdsClear, pHstFeat->fMdsClear, X86_CPUID_STEXT_FEATURE_EDX_MD_CLEAR)
1845+
//| X86_CPUID_STEXT_FEATURE_EDX_TSX_FORCE_ABORT RT_BIT_32(11)
1846+
//| X86_CPUID_STEXT_FEATURE_EDX_CET_IBT RT_BIT(20)
18391847
- //| X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB RT_BIT(26)
18401848
- //| X86_CPUID_STEXT_FEATURE_EDX_STIBP RT_BIT(27)
18411849
+ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB)
18421850
+ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_STIBP)
18431851
| PASSTHRU_FEATURE(pConfig->enmFlushCmdMsr, pHstFeat->fFlushCmd, X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD)
18441852
| PASSTHRU_FEATURE(pConfig->enmArchCapMsr, pHstFeat->fArchCap, X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP)
1853+
//| X86_CPUID_STEXT_FEATURE_EDX_CORECAP RT_BIT_32(30)
1854+
- //| X86_CPUID_STEXT_FEATURE_EDX_SSBD RT_BIT_32(31)
18451855
+ | PASSTHRU_FEATURE_KVM_ONLY(X86_CPUID_STEXT_FEATURE_EDX_SSBD)
18461856
;
18471857

18481858
/* Mask out INVPCID unless FSGSBASE is exposed due to a bug in Windows 10 SMP guests, see @bugref{9089#c15}. */
1849-
@@ -2811,6 +2823,7 @@ static int cpumR3CpuIdReadConfig(PVM pVM, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pC
1859+
@@ -2933,6 +2944,7 @@ static int cpumR3CpuIdReadConfig(PVM pVM, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pC
18501860
AssertLogRelRCReturn(rc, rc);
18511861
if (pConfig->fNestedHWVirt)
18521862
{
18531863
+#ifndef VBOX_WITH_KVM_NESTING
18541864
/** @todo Think about enabling this later with NEM/KVM. */
18551865
if (VM_IS_NEM_ENABLED(pVM))
18561866
{
1857-
@@ -2820,6 +2833,7 @@ static int cpumR3CpuIdReadConfig(PVM pVM, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pC
1867+
@@ -2942,6 +2954,7 @@ static int cpumR3CpuIdReadConfig(PVM pVM, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pC
18581868
else if (!fNestedPagingAndFullGuestExec)
18591869
return VMSetError(pVM, VERR_CPUM_INVALID_HWVIRT_CONFIG, RT_SRC_POS,
18601870
"Cannot enable nested VT-x/AMD-V without nested-paging and unrestricted guest execution!\n");
18611871
+#endif
18621872
}
18631873
}
18641874

1865-
@@ -3736,6 +3750,7 @@ VMMR3_INT_DECL(void) CPUMR3SetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFea
1875+
@@ -3888,6 +3901,7 @@ VMMR3_INT_DECL(void) CPUMR3SetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFea
18661876
* Note! ASSUMES CPUMCPUIDFEATURE_APIC is called first.
18671877
*/
18681878
case CPUMCPUIDFEATURE_X2APIC:
18691879
+#ifndef VBOX_WITH_KVM
18701880
pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
18711881
if (pLeaf)
18721882
pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_X2APIC;
1873-
@@ -3750,6 +3765,7 @@ VMMR3_INT_DECL(void) CPUMR3SetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFea
1883+
@@ -3902,6 +3916,7 @@ VMMR3_INT_DECL(void) CPUMR3SetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFea
18741884
}
18751885

18761886
LogRel(("CPUM: SetGuestCpuIdFeature: Enabled x2APIC\n"));
@@ -4832,7 +4842,7 @@ index 29522e02be..9216ebb1d4 100644
48324842
* MMIO2 region indices.
48334843
*/
48344844
diff --git a/src/VBox/VMM/include/NEMInternal.h b/src/VBox/VMM/include/NEMInternal.h
4835-
index 18aecd8c02..3d77505b29 100644
4845+
index e6cffe55ca..3a5022e755 100644
48364846
--- a/src/VBox/VMM/include/NEMInternal.h
48374847
+++ b/src/VBox/VMM/include/NEMInternal.h
48384848
@@ -35,8 +35,17 @@
@@ -4872,8 +4882,8 @@ index 18aecd8c02..3d77505b29 100644
48724882

48734883
#elif defined(RT_OS_WINDOWS)
48744884
/** Set if we've created the EMTs. */
4875-
@@ -417,7 +431,9 @@ typedef struct NEMCPU
4876-
bool fGCMTrapXcptDE : 1;
4885+
@@ -433,7 +447,9 @@ typedef struct NEMCPU
4886+
#endif
48774887

48784888
#if defined(RT_OS_LINUX)
48794889
- uint8_t abPadding[3];
@@ -4883,7 +4893,7 @@ index 18aecd8c02..3d77505b29 100644
48834893
/** The KVM VCpu file descriptor. */
48844894
int32_t fdVCpu;
48854895
/** Pointer to the KVM_RUN data exchange region. */
4886-
@@ -430,6 +446,21 @@ typedef struct NEMCPU
4896+
@@ -446,6 +462,21 @@ typedef struct NEMCPU
48874897
/** Status of the FIQ line when last seen. */
48884898
bool fFiqLastSeen;
48894899
# else
@@ -4905,7 +4915,7 @@ index 18aecd8c02..3d77505b29 100644
49054915
/** The MSR_IA32_APICBASE value known to KVM. */
49064916
uint64_t uKvmApicBase;
49074917
#endif
4908-
@@ -760,4 +791,3 @@ int nemHCNativeNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS
4918+
@@ -776,4 +807,3 @@ int nemHCNativeNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS
49094919
RT_C_DECLS_END
49104920

49114921
#endif /* !VMM_INCLUDED_SRC_include_NEMInternal_h */

0 commit comments

Comments
 (0)