GIMHv.cpp revision 6d0dfca130b3267e60e6dcb6f8cea0487534680a
65697a26b524640b83828b715160c798c43a0424vboxsync * GIM - Guest Interface Manager, Hyper-V implementation.
65697a26b524640b83828b715160c798c43a0424vboxsync * Copyright (C) 2014 Oracle Corporation
65697a26b524640b83828b715160c798c43a0424vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
65697a26b524640b83828b715160c798c43a0424vboxsync * available from http://www.virtualbox.org. This file is free software;
65697a26b524640b83828b715160c798c43a0424vboxsync * you can redistribute it and/or modify it under the terms of the GNU
65697a26b524640b83828b715160c798c43a0424vboxsync * General Public License (GPL) as published by the Free Software
65697a26b524640b83828b715160c798c43a0424vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
65697a26b524640b83828b715160c798c43a0424vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
65697a26b524640b83828b715160c798c43a0424vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
65697a26b524640b83828b715160c798c43a0424vboxsync/*******************************************************************************
65697a26b524640b83828b715160c798c43a0424vboxsync* Header Files *
65697a26b524640b83828b715160c798c43a0424vboxsync*******************************************************************************/
65697a26b524640b83828b715160c798c43a0424vboxsync/*******************************************************************************
65697a26b524640b83828b715160c798c43a0424vboxsync* Defined Constants And Macros *
65697a26b524640b83828b715160c798c43a0424vboxsync*******************************************************************************/
65697a26b524640b83828b715160c798c43a0424vboxsync//#define GIMHV_HYPERCALL "GIMHvHypercall"
65697a26b524640b83828b715160c798c43a0424vboxsync * GIM Hyper-V saved-state version.
65697a26b524640b83828b715160c798c43a0424vboxsync/*******************************************************************************
65697a26b524640b83828b715160c798c43a0424vboxsync* Global Variables *
65697a26b524640b83828b715160c798c43a0424vboxsync*******************************************************************************/
65697a26b524640b83828b715160c798c43a0424vboxsync# define GIMHV_MSRRANGE(a_uFirst, a_uLast, a_szName) \
65697a26b524640b83828b715160c798c43a0424vboxsync { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName, { 0 }, { 0 }, { 0 }, { 0 } }
65697a26b524640b83828b715160c798c43a0424vboxsync# define GIMHV_MSRRANGE(a_uFirst, a_uLast, a_szName) \
65697a26b524640b83828b715160c798c43a0424vboxsync { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName }
65697a26b524640b83828b715160c798c43a0424vboxsync * Array of MSR ranges supported by Hyper-V.
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE0_START, MSR_GIM_HV_RANGE0_END, "Hyper-V range 0"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE1_START, MSR_GIM_HV_RANGE1_END, "Hyper-V range 1"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE2_START, MSR_GIM_HV_RANGE2_END, "Hyper-V range 2"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE3_START, MSR_GIM_HV_RANGE3_END, "Hyper-V range 3"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE4_START, MSR_GIM_HV_RANGE4_END, "Hyper-V range 4"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE5_START, MSR_GIM_HV_RANGE5_END, "Hyper-V range 5"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE6_START, MSR_GIM_HV_RANGE6_END, "Hyper-V range 6"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE7_START, MSR_GIM_HV_RANGE7_END, "Hyper-V range 7"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE8_START, MSR_GIM_HV_RANGE8_END, "Hyper-V range 8"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE9_START, MSR_GIM_HV_RANGE9_END, "Hyper-V range 9"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE10_START, MSR_GIM_HV_RANGE10_END, "Hyper-V range 10"),
65697a26b524640b83828b715160c798c43a0424vboxsync GIMHV_MSRRANGE(MSR_GIM_HV_RANGE11_START, MSR_GIM_HV_RANGE11_END, "Hyper-V range 11")
65697a26b524640b83828b715160c798c43a0424vboxsync * Initializes the Hyper-V GIM provider.
65697a26b524640b83828b715160c798c43a0424vboxsync * @returns VBox status code.
65697a26b524640b83828b715160c798c43a0424vboxsync * @param pVM Pointer to the VM.
65697a26b524640b83828b715160c798c43a0424vboxsync * @param uVersion The interface version this VM should use.
65697a26b524640b83828b715160c798c43a0424vboxsync AssertReturn(pVM->gim.s.enmProviderId == GIMPROVIDERID_HYPERV, VERR_INTERNAL_ERROR_5);
65697a26b524640b83828b715160c798c43a0424vboxsync * Determine interface capabilities based on the version.
65697a26b524640b83828b715160c798c43a0424vboxsync /* Basic features. */
65697a26b524640b83828b715160c798c43a0424vboxsync //| GIM_HV_BASE_FEAT_VP_RUNTIME_MSR
65697a26b524640b83828b715160c798c43a0424vboxsync //| GIM_HV_BASE_FEAT_BASIC_SYNTH_IC
65697a26b524640b83828b715160c798c43a0424vboxsync //| GIM_HV_BASE_FEAT_SYNTH_TIMER_MSRS
65697a26b524640b83828b715160c798c43a0424vboxsync //| GIM_HV_BASE_FEAT_STAT_PAGES_MSR
65697a26b524640b83828b715160c798c43a0424vboxsync //| GIM_HV_BASE_FEAT_GUEST_IDLE_STATE_MSR
return VINF_SUCCESS;
return rc;
return VINF_SUCCESS;
int rc = PDMR3LdrGetSymbolRC(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallRC);
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Failed to enable the hypercall page. GCPhys=%#RGp rc=%Rrc"),
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Hypercall MMIO2 region not registered. Missing GIM device?!"));
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Failed to enable the TSC page. GCPhys=%#RGp rc=%Rrc"),
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("TSC-page MMIO2 region not registered. Missing GIM device?!"));
return rc;
VMMR3_INT_DECL(int) GIMR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSequence, uint32_t uTscSequence)
int rc;
return VINF_SUCCESS;
if ( fUseThisTscSequence
LogRel(("GIM: HyperV: Enabled TSC page at %#RGp - u64TscScale=%#RX64 u64TscKHz=%#RX64 (%'RU64)\n", GCPhysTscPage,
return VINF_SUCCESS;
return VERR_GIM_OPERATION_FAILED;
return VINF_SUCCESS;
return VERR_GIM_PVTSC_NOT_ENABLED;
return VINF_SUCCESS;
return VERR_GIM_HYPERCALLS_NOT_ENABLED;
return VINF_SUCCESS;
return VINF_SUCCESS;
return rc;