VirtualBox

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

Last change on this file since 61605 was 58122, checked in by vboxsync, 9 years ago

VMM: Made @param pVM more uniform and to the point.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Id: GIMR0.cpp 58122 2015-10-08 17:11:58Z 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/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#define LOG_GROUP LOG_GROUP_GIM
23#include "GIMInternal.h"
24#include "GIMHvInternal.h"
25
26#include <VBox/err.h>
27#include <VBox/vmm/vm.h>
28
29
30/**
31 * Does ring-0 per-VM GIM initialization.
32 *
33 * @returns VBox status code.
34 * @param pVM The cross context VM structure.
35 */
36VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM)
37{
38 if (!GIMIsEnabled(pVM))
39 return VINF_SUCCESS;
40
41 switch (pVM->gim.s.enmProviderId)
42 {
43 case GIMPROVIDERID_HYPERV:
44 return gimR0HvInitVM(pVM);
45
46 case GIMPROVIDERID_KVM:
47 return gimR0KvmInitVM(pVM);
48
49 default:
50 break;
51 }
52 return VINF_SUCCESS;
53}
54
55
56/**
57 * Does ring-0 per-VM GIM termination.
58 *
59 * @returns VBox status code.
60 * @param pVM The cross context VM structure.
61 */
62VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM)
63{
64 if (!GIMIsEnabled(pVM))
65 return VINF_SUCCESS;
66
67 switch (pVM->gim.s.enmProviderId)
68 {
69 case GIMPROVIDERID_HYPERV:
70 return gimR0HvTermVM(pVM);
71
72 case GIMPROVIDERID_KVM:
73 return gimR0KvmTermVM(pVM);
74
75 default:
76 break;
77 }
78 return VINF_SUCCESS;
79}
80
81
82/**
83 * Updates the paravirtualized TSC supported by the GIM provider.
84 *
85 * @returns VBox status code.
86 * @retval VINF_SUCCESS if the paravirt. TSC is setup and in use.
87 * @retval VERR_GIM_NOT_ENABLED if no GIM provider is configured for this VM.
88 * @retval VERR_GIM_PVTSC_NOT_AVAILABLE if the GIM provider does not support any
89 * paravirt. TSC.
90 * @retval VERR_GIM_PVTSC_NOT_IN_USE if the GIM provider supports paravirt. TSC
91 * but the guest isn't currently using it.
92 *
93 * @param pVM The cross context VM structure.
94 * @param u64Offset The computed TSC offset.
95 *
96 * @thread EMT(pVCpu)
97 */
98VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
99{
100 switch (pVM->gim.s.enmProviderId)
101 {
102 case GIMPROVIDERID_HYPERV:
103 return gimR0HvUpdateParavirtTsc(pVM, u64Offset);
104
105 case GIMPROVIDERID_KVM:
106 return VINF_SUCCESS;
107
108 case GIMPROVIDERID_NONE:
109 return VERR_GIM_NOT_ENABLED;
110
111 default:
112 break;
113 }
114 return VERR_GIM_PVTSC_NOT_AVAILABLE;
115}
116
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