vbox5: update to 5.1.14

- use more upstream hm code
- add call to memory check as done in vbox4
- add in principle all vbox devices and drivers
- avoid null pointer during VM startup (patch reported to vbox-devel list)
- avoid endless loop in usb root hub

Issue #2338
This commit is contained in:
Alexander Boettcher 2017-01-31 16:10:52 +01:00 committed by Christian Helmuth
parent 572609b30a
commit 4f8a497bbf
18 changed files with 162 additions and 109 deletions

View File

@ -1,12 +1,19 @@
include $(REP_DIR)/lib/mk/virtualbox5-common.inc
LIBS += stdcxx
SRC_CC = sup.cc pgm.cc
INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(call select_from_repositories,src/lib/pthread)
INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox5/frontend
vpath sup.cc $(REP_DIR)/src/virtualbox5/spec/nova/
vpath pgm.cc $(REP_DIR)/src/virtualbox5/spec/nova/

View File

@ -1,19 +1,26 @@
include $(REP_DIR)/lib/mk/virtualbox5-common.inc
SRC_CC += Devices/PC/DevFwCommon.cpp
SRC_CC += Devices/PC/DevPcBios.cpp
SRC_CC += Devices/Bus/DevPCI.cpp
SRC_CC += Devices/PC/DevACPI.cpp
SRC_CC += Devices/PC/ACPI/VBoxAcpi.cpp
SRC_C += Devices/PC/DevPcArch.c
SRC_CC += Devices/Bus/DevPciIch9.cpp
SRC_CC += Devices/Bus/MsiCommon.cpp
SRC_CC += Devices/Bus/MsixCommon.cpp
SRC_CC += Devices/EFI/DevSmc.cpp
SRC_CC += Devices/Input/DevPS2.cpp
SRC_CC += Devices/Input/PS2K.cpp
SRC_CC += Devices/Input/PS2M.cpp
SRC_CC += Devices/PC/DevAPIC.cpp
SRC_CC += Devices/PC/DevACPI.cpp
SRC_CC += Devices/PC/DevFwCommon.cpp
SRC_CC += Devices/PC/DevDMA.cpp
SRC_CC += Devices/PC/DevHPET.cpp
SRC_CC += Devices/PC/DevIoApic.cpp
SRC_CC += Devices/PC/DevLPC.cpp
SRC_CC += Devices/PC/DevPcBios.cpp
SRC_C += Devices/PC/DevPcArch.c
SRC_CC += Devices/PC/DevPit-i8254.cpp
SRC_CC += Devices/PC/DevPIC.cpp
SRC_CC += Devices/PC/DevRTC.cpp
SRC_CC += Devices/PC/DevDMA.cpp
SRC_CC += Devices/PC/DevAPIC.cpp
SRC_CC += Devices/PC/ACPI/VBoxAcpi.cpp
SRC_CC += Devices/Graphics/DevVGA.cpp
SRC_CC += Devices/Graphics/DevVGA_VBVA.cpp
SRC_CC += Devices/Graphics/DevVGA_VDMA.cpp
@ -33,7 +40,6 @@ SRC_CC += Devices/Network/DevPCNet.cpp
SRC_CC += Devices/VMMDev/VMMDev.cpp
SRC_CC += Devices/VMMDev/VMMDevHGCM.cpp
SRC_CC += Devices/Serial/DevSerial.cpp
SRC_CC += Devices/PC/DevIoApic.cpp
SRC_CC += Devices/Audio/AudioMixBuffer.cpp
SRC_CC += Devices/Audio/AudioMixer.cpp

View File

@ -5,6 +5,9 @@ LIBS += stdcxx
SRC_CC = sup.cc
INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include

View File

@ -58,6 +58,8 @@ SRC_CC += VMM/VMMAll/EMAll.cpp
SRC_CC += VMM/VMMR3/EM.cpp
SRC_CC += VMM/VMMR3/EMHM.cpp
SRC_CC += VMM/VMMAll/HMAll.cpp
SRC_CC += VMM/VMMR3/TRPM.cpp
SRC_CC += VMM/VMMAll/SELMAll.cpp

View File

@ -1 +1 @@
020f44048cce7d299293e5ebc72b356f3aff1ff0
570552db8aed1167dc7c910e2693833209ddfede

View File

@ -1,17 +1,17 @@
LICENSE := GPLv2
VERSION := 5.1.10
VERSION := 5.1.14
DOWNLOADS := virtualbox.archive virtualbox_sdk.archive
VIRTUALBOX_TBZ2 := VirtualBox-$(VERSION).tar.bz2
VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-112026.zip
VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-112924.zip
URL(virtualbox) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_TBZ2)
DIR(virtualbox) := src/app/virtualbox
SHA(virtualbox) := 041b0cf8f7fe292da34fc520eaa2c8894e76c7fe
SHA(virtualbox) := 9f5c4880b6a94bf57a6c6e64166753147ccee5e1
URL(virtualbox_sdk) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_SDK_ZIP)
DIR(virtualbox_sdk) := src/app/virtualbox_sdk
SHA(virtualbox_sdk) := d6262eb7d897030ffdcd2622ec01535ed34db4dd
SHA(virtualbox_sdk) := c94dc6fcd0ccd02d6342865c0c53e7ae16c72acc
PATCHES_DIR := src/virtualbox5/patches
PATCHES_DIR_VBOX4 := src/virtualbox/patches

View File

@ -23,12 +23,10 @@
#include <VBox/com/ptr.h>
#include <iprt/param.h>
#if VBOX_VERSION_MAJOR == 4
#include "MachineImpl.h"
HRESULT genode_setup_machine(ComObjPtr<Machine> machine);
HRESULT genode_check_memory_config(ComObjPtr<Machine> machine);
#endif
/**
* Returns true if a vCPU could be started. If false we run without

View File

@ -124,6 +124,12 @@ void genode_update_tsc(void (*update_func)(void), unsigned long update_us)
}
HRESULT genode_setup_machine(ComObjPtr<Machine> machine)
{
return genode_check_memory_config(machine);
}
extern "C" void pthread_yield() { Genode::warning(__func__, " unimplemented"); }
int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages,

View File

@ -33,29 +33,37 @@ extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
int rc = 0;
/* platform */
REGISTER(DevicePCI);
REGISTER(DevicePciIch9);
REGISTER(DevicePcArch);
REGISTER(DevicePcBios);
REGISTER(DeviceIOAPIC);
REGISTER(DevicePS2KeyboardMouse);
REGISTER(DevicePIIX3IDE);
REGISTER(DeviceI8254);
REGISTER(DeviceI8259);
REGISTER(DeviceDMA);
REGISTER(DeviceHPET);
REGISTER(DeviceSmc);
REGISTER(DeviceMC146818);
REGISTER(DeviceACPI);
REGISTER(DevicePCI);
REGISTER(DevicePCIBridge);
/* devices */
REGISTER(DevicePS2KeyboardMouse);
REGISTER(DeviceVga);
REGISTER(DeviceFloppyController);
REGISTER(DeviceSerialPort);
REGISTER(DevicePIIX3IDE);
REGISTER(DeviceAHCI);
REGISTER(DevicePCNet);
REGISTER(DeviceE1000);
REGISTER(DeviceVMMDev);
REGISTER(DeviceOHCI);
REGISTER(DevicePCNet);
#ifdef VBOX_WITH_E1000
REGISTER(DeviceE1000);
#endif
REGISTER(DeviceICHAC97);
REGISTER(DeviceHDA);
REGISTER(DeviceOHCI);
REGISTER(DeviceACPI);
REGISTER(DeviceDMA);
REGISTER(DeviceFloppyController);
REGISTER(DeviceSerialPort);
#ifdef VBOX_WITH_AHCI
REGISTER(DeviceAHCI);
#endif
REGISTER(DevicePCIBridge);
REGISTER(DevicePciIch9Bridge);
REGISTER(DeviceLPC);
return VINF_SUCCESS;
}

View File

@ -97,13 +97,9 @@ void Host::i_getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
HRESULT Host::i_checkUSBProxyService()
TRACE(S_OK)
/*
#include "HostUSBDeviceImpl.h"
#include "USBDeviceFilterImpl.h"
bool HostUSBDevice::isMatch(const USBDeviceFilter::Data &aData)
bool HostUSBDevice::i_isMatch(const USBDeviceFilter::BackupableUSBDeviceFilterData &)
DUMMY(false)
*/
#endif

View File

@ -37,6 +37,7 @@
#include "console.h"
#include "fb.h"
#include "vmm.h"
#include "sup.h"
static char c_vbox_file[128];
static char c_vbox_vmname[128];
@ -120,6 +121,10 @@ HRESULT setupmachine(Genode::Env &env)
if (FAILED(rc))
return rc;
rc = genode_setup_machine(machine);
if (FAILED(rc))
return rc;
rc = virtualbox->RegisterMachine(machine);
if (FAILED(rc))
return rc;
@ -140,22 +145,6 @@ HRESULT setupmachine(Genode::Env &env)
if (FAILED(rc))
return rc;
/* request max available memory */
size_t memory_genode = genode_env().ram().avail() >> 20;
size_t memory_vmm = 28;
if (memory_vbox + memory_vmm > memory_genode) {
using Genode::error;
error("Configured memory ", memory_vmm, " MB (vbox file) is insufficient.");
error(memory_genode, " MB (1) - ",
memory_vmm, " MB (2) = ",
memory_genode - memory_vmm, " MB (3)");
error("(1) available memory based defined by Genode config");
error("(2) minimum memory required for VBox VMM");
error("(3) maximal available memory to VM");
return E_FAIL;
}
/* Console object */
static ComPtr<IConsole> gConsole;
rc = session->COMGETTER(Console)(gConsole.asOutParam());

View File

@ -57,12 +57,15 @@ VMMR3DECL(int) HMR3Init(PVM pVM)
for (VMCPUID i = 0; i < pVM->cCpus; i++)
pVM->aCpus[i].hm.s.fActive = false;
pVM->hm.s.fNestedPaging = true;
#if HC_ARCH_BITS == 64
PGMSetLargePageUsage(pVM, true);
#endif
/* XXX check for intel and feature bits XXX */
if (pVM->hm.s.vmx.fAllowUnrestricted)
pVM->hm.s.vmx.fUnrestrictedGuest = true;
pVM->fHMEnabledFixed = true;
return VINF_SUCCESS;
}
@ -97,16 +100,12 @@ VMMR3_INT_DECL(int) HMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
}
}
pVM->hm.s.fNestedPaging = true;
return rc;
}
VMMDECL(bool) HMIsEnabledNotMacro(PVM pVM)
{
return pVM->fHMEnabled;
}
VMMR3DECL(bool) HMR3IsVmxPreemptionTimerUsed(PVM pVM)
{
if (VERBOSE_HM)
@ -121,10 +120,6 @@ VMMR3DECL(bool) HMR3IsActive(PVMCPU pVCpu)
return pVCpu->hm.s.fActive;
}
VMM_INT_DECL(bool) HMIsLongModeAllowed(PVM pVM)
{
return HMIsEnabled(pVM) && pVM->hm.s.fAllow64BitGuests;
}
VMMR3DECL(bool) HMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx)
{
@ -137,7 +132,7 @@ VMMR3DECL(bool) HMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx)
VMMR3DECL(bool) HMR3IsEventPending(PVMCPU pVCpu)
{
return false;
return HMIsEnabled(pVCpu->pVMR3) && pVCpu->hm.s.Event.fPending;
}
@ -157,53 +152,18 @@ VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx)
return pVCpu->hm.s.fActive;
}
VMM_INT_DECL(int) HMFlushTLB(PVMCPU pVCpu) {
return VINF_SUCCESS;
}
VMM_INT_DECL(bool) HMAreNestedPagingAndFullGuestExecEnabled(PVM pVM)
{
return HMIsEnabled(pVM)
&& ( (pVM->hm.s.vmx.fSupported && pVM->hm.s.vmx.fAllowUnrestricted)
|| pVM->hm.s.svm.fSupported);
}
VMMR3_INT_DECL(void) HMR3ResetCpu(PVMCPU pVCpu)
{
pVCpu->hm.s.fActive = false;
}
VMM_INT_DECL(bool) HMIsNestedPagingActive(PVM pVM)
{
return HMIsEnabled(pVM);
}
/* VMM/VMMAll/HMAll.cpp */
VMM_INT_DECL(PGMMODE) HMGetShwPagingMode(PVM pVM)
{
Assert(HMIsNestedPagingActive(pVM));
if (pVM->hm.s.svm.fSupported)
return PGMMODE_NESTED;
// Assert(pVM->hm.s.vmx.fSupported);
return PGMMODE_EPT;
}
VMMR3_INT_DECL(void) HMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmShadowMode, PGMMODE enmGuestMode)
{
}
VMM_INT_DECL(int) HMFlushTLBOnAllVCpus(PVM pVM)
{
if (VERBOSE_HM)
Genode::log(__func__, " called");
return VINF_SUCCESS;
}
/**
* Restarting I/O instruction refused in ring-0 - no mean for us
*/
VBOXSTRICTRC HMR3RestartPendingIOInstr(PVM, PVMCPU, PCPUMCTX) {
return VERR_NOT_FOUND; }

View File

@ -8,3 +8,4 @@ iem_wip.patch
dbg.patch
dev_e1000.patch
tm_tpr_vbox5.patch
vm.patch

View File

@ -185,3 +185,15 @@ index 2f01f69..9b13e37 100644
pFilter->i_getId() = NULL;
}
}
--- a/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
@@ -599,7 +614,8 @@
uint64_t tsNext = vusbRhR3ProcessFrame(pThis, false /* fCallback */);
- if (tsNext >= 250 * RT_NS_1US)
+ /* spinning as high priority thread is evil */
+ if (true) //tsNext >= 250 * RT_NS_1US)
{
rc = RTSemEventMultiWaitEx(pThis->hSemEventPeriodFrame, RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_UNINTERRUPTIBLE,
tsNext);

View File

@ -546,6 +546,17 @@ index a717aff..3d52b9f 100644
{ NULL, NULL, 0 }
#undef MY_ERR
--- a/src/app/virtualbox/src/VBox/Main/include/MachineImpl.h
+++ b/src/app/virtualbox/src/VBox/Main/include/MachineImpl.h
@@ -39,7 +39,7 @@
#include "Performance.h"
#include "PerformanceImpl.h"
-#include "ThreadTask.h"
#endif /* VBOX_WITH_RESOURCE_USAGE_API */
+#include "ThreadTask.h"
// generated header
#include "SchemaDefs.h"
--- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
@@ -8227,8 +8227,14 @@

View File

@ -0,0 +1,26 @@
--- a/src/app/virtualbox/src/VBox/VMM/VMMR3/VM.cpp
+++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/VM.cpp
@@ -605,7 +605,7 @@
rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_GVMM_CREATE_VM, 0, &CreateVMReq.Hdr);
if (RT_SUCCESS(rc))
{
- PVM pVM = pUVM->pVM = CreateVMReq.pVMR3;
+ PVM pVM = CreateVMReq.pVMR3;
AssertRelease(VALID_PTR(pVM));
AssertRelease(pVM->pVMR0 == CreateVMReq.pVMR0);
AssertRelease(pVM->pSession == pUVM->vm.s.pSession);
@@ -635,6 +635,14 @@
pUVM->aCpus[i].pVM = pVM;
}
+ /*
+ * vmR3EmulationThreadWithId checks (from within another thread) for
+ * !pUVM->pVM. If not null the function also expects
+ * pUVM->aCpus[i].pVCpu to be not null. So, make the assignment after
+ * pUVM->aCpus[i] are actually initialized.
+ */
+ ASMCompilerBarrier();
+ pUVM->pVM = pVM;
/*
* Init the configuration.

View File

@ -325,3 +325,32 @@ void genode_VMMR0_DO_GVMM_REGISTER_VMCPU(PVMR0 pVMR0, VMCPUID idCpu)
PVM pVM = reinterpret_cast<PVM>(pVMR0);
pVM->aCpus[idCpu].hNativeThreadR0 = RTThreadNativeSelf();
}
HRESULT genode_check_memory_config(ComObjPtr<Machine> machine)
{
HRESULT rc;
/* Validate configured memory of vbox file and Genode config */
ULONG memory_vbox;
rc = machine->COMGETTER(MemorySize)(&memory_vbox);
if (FAILED(rc))
return rc;
/* Request max available memory */
size_t memory_genode = genode_env().ram().avail() >> 20;
size_t memory_vmm = 28;
if (memory_vbox + memory_vmm > memory_genode) {
using Genode::error;
error("Configured memory ", memory_vmm, " MB (vbox file) is insufficient.");
error(memory_genode, " MB (1) - ",
memory_vmm, " MB (2) = ",
memory_genode - memory_vmm, " MB (3)");
error("(1) available memory based defined by Genode config");
error("(2) minimum memory required for VBox VMM");
error("(3) maximal available memory to VM");
return E_FAIL;
}
return S_OK;
}

View File

@ -24,8 +24,11 @@ void name(void) { \
while (1) { Assert(!"not implemented"); } \
}
DUMMY(DBGFR3CoreWrite)
DUMMY(DBGCRegisterCommands)
DUMMY(DBGFR3AsLineByAddrA)
DUMMY(DBGFR3AsSymbolByAddrA)
DUMMY(DBGFR3CoreWrite)
DUMMY(DBGFR3LogModifyDestinations)
DUMMY(DBGFR3LogModifyFlags)
DUMMY(DBGFR3LogModifyGroups)
@ -38,17 +41,12 @@ DUMMY(DBGFR3StackWalkBegin)
DUMMY(DBGFR3StackWalkBeginEx)
DUMMY(DBGFR3StackWalkNext)
DUMMY(DBGFR3StackWalkEnd)
DUMMY(DBGFR3PagingDumpEx)
DUMMY(DBGFR3PlugInUnload)
DUMMY(DBGFR3PlugInUnloadAll)
DUMMY(HBDMgrDestroy)
DUMMY(HMGetPaePdpes)
DUMMY(HMInvalidatePage)
DUMMY(HMInvalidatePageOnAllVCpus)
DUMMY(HMInvalidatePhysPage)
DUMMY(HMSetSingleInstruction)
DUMMY(HMR3CheckError)
DUMMY(HMR3DisablePatching)
DUMMY(HMR3EnablePatching)
@ -81,7 +79,6 @@ DUMMY(pgmR3SyncPTResolveConflictPAE)
DUMMY(PGMR3HandlerVirtualRegister)
DUMMY(DBGFR3PagingDumpEx)
DUMMY(MMPagePhys2PageEx)
DUMMY(PGMR3DbgR3Ptr2GCPhys)
@ -217,4 +214,6 @@ DUMMY(GIMExecHypercallInstr)
DUMMY(GIMReadMsr)
DUMMY(GIMWriteMsr)
DUMMY(RTDbgLineFree)
DUMMY(RTDbgSymbolFree)
} /* extern "C" */