From 158dbcc7ae1719a613a4846b20b45b68023bedf4 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 1 Jun 2017 10:14:23 +0200 Subject: [PATCH] vbox5: enable unrestricted guest support Issue #2338 --- repos/ports/run/vm_ubuntu_14_04_32.vbox | 2 +- repos/ports/run/vm_ubuntu_14_04_64.vbox | 2 +- repos/ports/run/vm_ubuntu_16_04_32.vbox | 2 +- repos/ports/run/vm_ubuntu_16_04_64.vbox | 2 +- repos/ports/src/virtualbox5/hm.cc | 19 +++++++++---------- repos/ports/src/virtualbox5/pgm.cc | 3 --- repos/ports/src/virtualbox5/spec/nova/pgm.cc | 7 +++++-- repos/ports/src/virtualbox5/spec/nova/sup.cc | 7 +++++-- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/repos/ports/run/vm_ubuntu_14_04_32.vbox b/repos/ports/run/vm_ubuntu_14_04_32.vbox index 9b181f2201..b9894edef4 100644 --- a/repos/ports/run/vm_ubuntu_14_04_32.vbox +++ b/repos/ports/run/vm_ubuntu_14_04_32.vbox @@ -22,7 +22,7 @@ - + diff --git a/repos/ports/run/vm_ubuntu_14_04_64.vbox b/repos/ports/run/vm_ubuntu_14_04_64.vbox index 7e70bb52b7..b7c814f63d 100644 --- a/repos/ports/run/vm_ubuntu_14_04_64.vbox +++ b/repos/ports/run/vm_ubuntu_14_04_64.vbox @@ -22,7 +22,7 @@ - + diff --git a/repos/ports/run/vm_ubuntu_16_04_32.vbox b/repos/ports/run/vm_ubuntu_16_04_32.vbox index a883804706..d06fffe09d 100644 --- a/repos/ports/run/vm_ubuntu_16_04_32.vbox +++ b/repos/ports/run/vm_ubuntu_16_04_32.vbox @@ -22,7 +22,7 @@ - + diff --git a/repos/ports/run/vm_ubuntu_16_04_64.vbox b/repos/ports/run/vm_ubuntu_16_04_64.vbox index dee5e940a4..9fe1c1d4e2 100644 --- a/repos/ports/run/vm_ubuntu_16_04_64.vbox +++ b/repos/ports/run/vm_ubuntu_16_04_64.vbox @@ -22,7 +22,7 @@ - + diff --git a/repos/ports/src/virtualbox5/hm.cc b/repos/ports/src/virtualbox5/hm.cc index 28f9669c08..a189ee3c36 100644 --- a/repos/ports/src/virtualbox5/hm.cc +++ b/repos/ports/src/virtualbox5/hm.cc @@ -37,12 +37,6 @@ VMMR3DECL(int) HMR3Init(PVM pVM) &pVM->hm.s.vmx.fAllowUnrestricted, true); AssertRCReturn(rc, rc); - /* XXX fix Ubuntu and unrestricted guest support, disable by default atm */ - if (pVM->hm.s.vmx.fAllowUnrestricted) { - pVM->hm.s.vmx.fAllowUnrestricted = false; - Genode::warning("unrestricted guest support disabled"); - } - /* check whether to enable pae and nx bit - in 64bit host mode */ rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnablePAE", &enable_pae_nx, false); @@ -72,6 +66,8 @@ VMMR3DECL(int) HMR3Init(PVM pVM) pVM->hm.s.vmx.fUnrestrictedGuest = true; pVM->fHMEnabledFixed = true; + pVM->hm.s.fNestedPaging = true; + return VINF_SUCCESS; } @@ -106,8 +102,6 @@ VMMR3_INT_DECL(int) HMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) } } - pVM->hm.s.fNestedPaging = true; - return rc; } @@ -170,8 +164,13 @@ VMMR3_INT_DECL(void) HMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmSha /** * Restarting I/O instruction refused in ring-0 - no mean for us */ -VBOXSTRICTRC HMR3RestartPendingIOInstr(PVM, PVMCPU, PCPUMCTX) { - return VERR_NOT_FOUND; } +VBOXSTRICTRC HMR3RestartPendingIOInstr(PVM, PVMCPU pVCpu, PCPUMCTX) +{ + HMPENDINGIO enmType = pVCpu->hm.s.PendingIO.enmType; + if (enmType != HMPENDINGIO_INVALID) + Genode::error("unimplemented: restart pending I/O"); + return VERR_NOT_FOUND; +} VMMR3DECL(bool) HMR3IsPostedIntrsEnabled(PUVM pUVM) diff --git a/repos/ports/src/virtualbox5/pgm.cc b/repos/ports/src/virtualbox5/pgm.cc index 6d2d6f67c7..83ff122287 100644 --- a/repos/ports/src/virtualbox5/pgm.cc +++ b/repos/ports/src/virtualbox5/pgm.cc @@ -24,9 +24,6 @@ static bool verbose = false; int PGMMap(PVM pVM, RTGCUINTPTR GCPtr, RTHCPHYS HCPhys, uint32_t cbPages, unsigned fFlags) { - /* GCPtr steams from the #unimplemented# MMR3HyperReserve call, which - * returns a value - seems to be used solely in RC mode */ - if (verbose) Genode::log(__func__, ": GCPtr=", Genode::Hex(GCPtr), " " "HCPHys=", Genode::Hex(HCPhys), " " diff --git a/repos/ports/src/virtualbox5/spec/nova/pgm.cc b/repos/ports/src/virtualbox5/spec/nova/pgm.cc index b0966d0f33..1422c3709c 100644 --- a/repos/ports/src/virtualbox5/spec/nova/pgm.cc +++ b/repos/ports/src/virtualbox5/spec/nova/pgm.cc @@ -230,8 +230,11 @@ Genode::uint64_t * Vcpu_handler::pdpte_map(VM *pVM, RTGCPHYS cr3) PPGMPAGE pPage = &pRam->aPages[iPage]; /* - Vmm::printf("%u gcphys=0x%lx host=0x%lx type=%lx state=0x%lx\n", __LINE__, - cr3, PGM_PAGE_GET_HCPHYS(pPage), PGM_PAGE_GET_TYPE(pPage), PGM_PAGE_GET_STATE(pPage)); + if (VERBOSE_PGM) + Vmm::log(__LINE__, " gcphys=", Vmm::Hex(cr3), + " host=", Vmm::Hex(PGM_PAGE_GET_HCPHYS(pPage)), + " type=", Vmm::Hex(PGM_PAGE_GET_TYPE(pPage)), + " state=",Vmm::Hex(PGM_PAGE_GET_STATE(pPage))); */ Genode::uint64_t *pdpte = reinterpret_cast(PGM_PAGE_GET_HCPHYS(pPage) + (cr3 & PAGE_OFFSET_MASK)); diff --git a/repos/ports/src/virtualbox5/spec/nova/sup.cc b/repos/ports/src/virtualbox5/spec/nova/sup.cc index 749e7c1d82..af2d20b3f0 100644 --- a/repos/ports/src/virtualbox5/spec/nova/sup.cc +++ b/repos/ports/src/virtualbox5/spec/nova/sup.cc @@ -301,8 +301,12 @@ int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, switch (uOperation) { case VMMR0_DO_GVMM_CREATE_VM: + { genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr); + GVMMCREATEVMREQ &req = reinterpret_cast(*pReqHdr); + SUPR3QueryHWACCLonGenodeSupport(reinterpret_cast(req.pVMR3)); + /* reserve lower chunk ids */ try { for (unsigned i = 0; i < CHUNKID_START; i++) { @@ -315,7 +319,7 @@ int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, } return VINF_SUCCESS; - + } case VMMR0_DO_GVMM_REGISTER_VMCPU: genode_VMMR0_DO_GVMM_REGISTER_VMCPU(pVMR0, idCpu); return VINF_SUCCESS; @@ -361,7 +365,6 @@ int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, return VINF_SUCCESS; case VMMR0_DO_VMMR0_INIT: - SUPR3QueryHWACCLonGenodeSupport(reinterpret_cast(pVMR0)); return VINF_SUCCESS; case VMMR0_DO_GVMM_DESTROY_VM: