VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/GIMR0.cpp@ 55316

Last change on this file since 55316 was 54819, checked in by vboxsync, 10 years ago

VMM/GIM: Implemented KVM paravirt. provider.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: GIMR0.cpp 54819 2015-03-17 17:58:30Z vboxsync $ */
2/** @file
3 * Guest Interface Manager (GIM) - Host Context Ring-0.
4 */
5
6/*
7 * Copyright (C) 2014-2015 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_GIM
22#include "GIMInternal.h"
23#include "GIMHvInternal.h"
24
25#include <VBox/err.h>
26#include <VBox/vmm/vm.h>
27
28
29/**
30 * Does ring-0 per-VM GIM initialization.
31 *
32 * @returns VBox status code.
33 * @param pVM Pointer to the VM.
34 */
35VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM)
36{
37 if (!GIMIsEnabled(pVM))
38 return VINF_SUCCESS;
39
40 switch (pVM->gim.s.enmProviderId)
41 {
42 case GIMPROVIDERID_HYPERV:
43 return gimR0HvInitVM(pVM);
44
45 default:
46 break;
47 }
48 return VINF_SUCCESS;
49}
50
51
52/**
53 * Does ring-0 per-VM GIM termination.
54 *
55 * @returns VBox status code.
56 * @param pVM Pointer to the VM.
57 */
58VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM)
59{
60 if (!GIMIsEnabled(pVM))
61 return VINF_SUCCESS;
62
63 switch (pVM->gim.s.enmProviderId)
64 {
65 case GIMPROVIDERID_HYPERV:
66 return gimR0HvTermVM(pVM);
67
68 default:
69 break;
70 }
71 return VINF_SUCCESS;
72}
73
74
75/**
76 * Updates the paravirtualized TSC supported by the GIM provider.
77 *
78 * @returns VBox status code.
79 * @retval VINF_SUCCESS if the paravirt. TSC is setup and in use.
80 * @retval VERR_GIM_NOT_ENABLED if no GIM provider is configured for this VM.
81 * @retval VERR_GIM_PVTSC_NOT_AVAILABLE if the GIM provider does not support any
82 * paravirt. TSC.
83 * @retval VERR_GIM_PVTSC_NOT_IN_USE if the GIM provider supports paravirt. TSC
84 * but the guest isn't currently using it.
85 *
86 * @param pVM Pointer to the VM.
87 * @param u64Offset The computed TSC offset.
88 *
89 * @thread EMT(pVCpu)
90 */
91VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
92{
93 switch (pVM->gim.s.enmProviderId)
94 {
95 case GIMPROVIDERID_HYPERV:
96 return gimR0HvUpdateParavirtTsc(pVM, u64Offset);
97
98 case GIMPROVIDERID_KVM:
99 return VINF_SUCCESS;
100
101 case GIMPROVIDERID_NONE:
102 return VERR_GIM_NOT_ENABLED;
103
104 default:
105 break;
106 }
107 return VERR_GIM_PVTSC_NOT_AVAILABLE;
108}
109
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette